Использование кундера в качестве драйвера базы данных для весны дает ошибку
Я пытаюсь использовать Kundera для доступа к базе данных для моего приложения (mongodb). Однако я получаю сообщение об ошибке: 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).
Полный журнал>
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).
Я понятия не имею, что с этим делать. За последние 4 дня у меня были различные ошибки, связанные с использованием Kundera и Spring, и мне пришлось многократно повторять попытку, чтобы выполнить отладку. Но я понятия не имею, с чего начать. Также я использую Intellij.
Если кому-то нужна дополнительная информация, не стесняйтесь спрашивать.
Заранее спасибо.
РЕДАКТИРОВАТЬ: Весенние конфиги:
persistence.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>
applicationContext.xml
<?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>
App.java
package main;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan
@EnableAutoConfiguration
@SpringBootApplication
public class App {
public static void main(String[] args){
SpringApplication.run(App.class, args);
}
}
1 ответ
Я подозреваю, что это может быть связано с зависимостью Spring-JPA в связке. Попробуйте удалить его и посмотреть, работает ли он!