我尝试使用Kundera访问我的应用程序的数据库(mongodb)。但是,我在启动时遇到错误:var MenuDisplayModule = (function ($, window, document, Handlebars) {
var module = {};
module.menuItems = [];
module.init = function () {
console.info('BreadcrumbDisplayModule Init');
};
module.template = function (array) {
module.menuItems = array;
var filteredMenuItems = array.slice(0);
_template(filteredMenuItems);
}
module.filterChange = function (filterText) {
var filteredMenuItems = module.menuItems.slice(0);
filteredMenuItems.forEach(function (item, index) {
var filteredItems = item.MenuItems.filter(function (el) {
return (el.MenuText.includes(filterText));
});
filteredMenuItems[index].MenuItems = filteredItems;
})
_template(filteredMenuItems);
}
function _template(filteredMenuItems) {
var menu_items_source = $("#menu-items-template").html();
var menu_items_template = Handlebars.compile(menu_items_source);
$("#menu-items-placeholder").empty().html(menu_items_template({ menuItems: filteredMenuItems }));
}
return module;
}(window.jQuery, window, document, window.Handlebars));
。
为了能够使用数据库我需要设置什么?
完整的错误消息:
Cannot determine embedded database driver class for database type NONE
完整日志>
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
我不知道该怎么做。我在过去的4天里遇到过与使用Kundera和Spring相关的各种错误,为了调试,我不得不重试很多次。但我不知道从哪里开始。我也在使用Intellij。
如果有人想要任何其他信息,请随时提出。
提前谢谢。
编辑: 春天的配置:
的persistence.xml
Connected to the target VM, address: '127.0.0.1:17260', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.0.RELEASE)
2017-03-28 21:53:10.162 INFO 204 --- [ main] main.App
: Starting App on DESKTOP-J12LM4I with PID 204
(D:\--omitted--\resttest\build\classes\main started by Johan Vikström in D:\--omitted--\resttest)
2017-03-28 21:53:10.165 INFO 204 --- [ main] main.App
: No active profile set, falling back to default profiles: default
2017-03-28 21:53:10.318 INFO 204 --- [ main]
ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6cd28fa7: startup date [Tue Mar 28 21:53:10 CEST 2017]; root of context hierarchy
2017-03-28 21:53:11.648 INFO 204 --- [ main]
f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject'
annotation found and supported for autowiring
2017-03-28 21:53:11.718 INFO 204 --- [ main]
trationDelegate$BeanPostProcessorChecker : Bean'org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration' of type [org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-28 21:53:11.786 INFO 204 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'validator' of type
[org.springframework.validation.beanvalidation.LocalValidatorFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-28 21:53:11.833 INFO 204 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$e1fc46a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-03-28 21:53:12.210 INFO 204 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080
(http)
2017-03-28 21:53:12.226 INFO 204 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-03-28 21:53:12.227 INFO 204 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache
Tomcat/8.5.11
2017-03-28 21:53:12.369 INFO 204 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].
[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-03-28 21:53:12.369 INFO 204 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext:
initialization completed in 2054 ms
2017-03-28 21:53:12.669 INFO 204 --- [ost-startStop-1]
o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2017-03-28 21:53:12.681 INFO 204 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-03-28 21:53:12.682 INFO 204 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-03-28 21:53:12.682 INFO 204 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-03-28 21:53:12.683 INFO 204 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2017-03-28 21:53:12.773 WARN 204 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
2017-03-28 21:53:12.780 INFO 204 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-03-28 21:53:12.785 ERROR 204 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
的applicationContext.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
https://raw.github.com/impetus-opensource/Kundera/Kundera-2.0.4/kundera-core/src/test/resources/META-INF/persistence_2_0.xsd"
version="2.0">
<!--
The mongodb installation must allow outside connections.
-->
<persistence-unit name="mongo_pu">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<class>main.storage.entites.UserEntity</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="kundera.nodes" value="192.168.10.190" />
<property name="kundera.port" value="27017" />
<property name="kundera.keyspace" value="test" />
<property name="kundera.client.lookup.class"
value="com.impetus.client.mongodb.MongoDBClientFactory" />
</properties>
</persistence-unit>
App.java
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<context:component-scan base-package="main" />
<beans:bean id="dao" class="main.storage.DaoImpl">
</beans:bean>
<beans:bean id="userDao" class="main.storage.UserDaoImpl"/>
<beans:bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<beans:property name="persistenceUnitName" value="mongo_pu"/>
</beans:bean>
<beans:bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<beans:property name="entityManagerFactory" ref="entityManagerFactory" />
</beans:bean>
答案 0 :(得分:0)
我怀疑,这可能是由于spring-jpa依赖带来了捆绑。尝试删除它,看它是否有效!