JPA application not getting deployed in Cloud Foundary - IBM Bluemix - jpa

I have created JPA Spring boot application which is working properly in my local environment, however, while deploying it to Java Liberty Cloud Foundary app in IBM Bluemix with following error:
Local IDE: Eclipse Oxygen
when I run this application on my local IDE, it accessed cloud Db Compose for MySQL and give result as expected.
http://localhost:8080/users/all
Deployment in IBM Bluemix, it's give an error message
Server: IBM Bluemix
Deployment: Cloud Foundary
Cloud Foundary App: Java Liberty
DataBase : Compose for MySQL
Error 404: SRVE0190E: File not found: /
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<dependencies>
<!-- Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
messages.log
[9/15/17 9:59:23:464 UTC] 00000026 com.ibm.ws.webcontainer.osgi.mbeans.PluginGenerator I SRVE9103I: A configuration file for a web server plugin was automatically generated for this server at /home/vcap/app/wlp/usr/servers/defaultServer/logs/state/plugin-cfg.xml.
[9/15/17 9:59:23:990 UTC] 00000033 com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver com.ibm.ws.injectionengine.InjectionProcessorManager.getAllDeclaredFields 249" at ffdc_17.09.15_09.59.23.0.log
[9/15/17 9:59:24:002 UTC] 00000033 com.ibm.ws.injectionengine.InjectionProcessorManager W CWNEN0047W: Resource annotations on the fields of the org.springframework.web.servlet.view.tiles3.TilesConfigurer$CompositeELResolverImpl class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver
[9/15/17 9:59:24:020 UTC] 00000033 com.ibm.ws.logging.internal.impl.IncidentImpl I FFDC1015I: An FFDC Incident has been created: "java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver com.ibm.wsspi.injectionengine.MethodMap.getAllDeclaredMethods 106" at ffdc_17.09.15_09.59.24.0.log
[9/15/17 9:59:24:021 UTC] 00000033 com.ibm.wsspi.injectionengine.MethodMap W CWNEN0049W: Resource annotations on the methods of the org.springframework.web.servlet.view.tiles3.TilesConfigurer$CompositeELResolverImpl class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver
ffdc_17.09.15_09.59.23.0.log
Exception = java.lang.NoClassDefFoundError
Source = com.ibm.ws.injectionengine.InjectionProcessorManager.getAllDeclaredFields
probeid = 249
Stack Dump = java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver
at java.lang.J9VMInternals.prepareClassImpl(Native Method)
at java.lang.J9VMInternals.prepare(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at com.ibm.ws.injectionengine.InjectionProcessorManager.getAllDeclaredFields(InjectionProcessorManager.java:375)
at com.ibm.ws.injectionengine.InjectionProcessorManager.processAnnotations(InjectionProcessorManager.java:216)
at com.ibm.ws.injectionengine.AbstractInjectionEngine.processInjectionMetaData(AbstractInjectionEngine.java:514)
at com.ibm.ws.injectionengine.osgi.internal.OSGiInjectionEngineImpl.processInjectionMetaData(OSGiInjectionEngineImpl.java:239)
at com.ibm.ws.injectionengine.ReferenceContextImpl.processImpl(ReferenceContextImpl.java:595)
at com.ibm.ws.injectionengine.ReferenceContextImpl.process(ReferenceContextImpl.java:290)
at com.ibm.ws.injectionengine.osgi.internal.OSGiReferenceContextImpl.process(OSGiReferenceContextImpl.java:31)
at com.ibm.ws.webcontainer.osgi.webapp.WebApp.commonInitializationStart(WebApp.java:255)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1039)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6595)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463)
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:1120)
at com.ibm.ws.webcontainer.osgi.WebContainer.access$000(WebContainer.java:104)
at com.ibm.ws.webcontainer.osgi.WebContainer$2.run(WebContainer.java:932)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.tiles.el.ScopeELResolver
at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:499)
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:282)
at java.lang.ClassLoader.loadClassHelper(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:477)
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:449)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 23 more

Related

Quarkus Using Reactive Hibernate: Parameter 'dataSource' may not be null

I'm trying to switch from tranditional database accessing to reactive. In pom.xml i have added:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-reactive</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-reactive-pg-client</artifactId>
</dependency>
and in application.properties:
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=postgres
quarkus.datasource.password=pw
quarkus.datasource.reactive.url = postgresql://localhost:5432/postgres
quarkus.datasource.jdbc = false
When i start Quarkus there is the error:
ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.IllegalArgumentException: Parameter 'dataSource' may not be null
at org.wildfly.common.Assert.checkNotNullParamChecked(Assert.java:71)
at org.wildfly.common.Assert.checkNotNullParam(Assert.java:49)
at org.wildfly.security.auth.realm.jdbc.QueryConfiguration.<init>(QueryConfiguration.java:40)
at org.wildfly.security.auth.realm.jdbc.QueryBuilder.buildQuery(QueryBuilder.java:97)
at org.wildfly.security.auth.realm.jdbc.JdbcSecurityRealmBuilder.build(JdbcSecurityRealmBuilder.java:55)
at io.quarkus.elytron.security.jdbc.JdbcRecorder.createRealm(JdbcRecorder.java:42)
at io.quarkus.deployment.steps.ElytronSecurityJdbcProcessor$configureJdbcRealmAuthConfig173765586.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.ElytronSecurityJdbcProcessor$configureJdbcRealmAuthConfig173765586.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:43)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:123)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
at java.base/java.lang.Thread.run(Thread.java:833)
These are the reasons of the problem and the approaches to fix that:
Did you set the dataSource parameter in the ReactiveHibernate constructor? If not, you can do that using the #ConfigProperty annotation
Check if the parameter is not null or has a valid value.

How to register a custom ProtocolMapper in Keycloak?

I'm struggling with registering a custom ProtocolMapper in Keycloak. I would like to add some data from my database on token request. So i followed the idea given in Keycloak add extra claims from database / external source.
I implemented the ProtocolMapper interface and added the file
META-INF/services/org.keycloak.protocol.ProtocolMapper
containing the reference to my class. So far so good and Keycloak recognizes the new implementation. I'm also able to configure it via the admin console.
To add some data to the token I think I must also add one/some of the interfaces
org.keycloak.protocol.oidc.mappers.UserInfoTokenMapper
org.keycloak.protocol.oidc.mappers.OIDCIDTokenMapper
org.keycloak.protocol.oidc.mappers.OIDCAccessTokenMapper
and implement the methods according to the interface(s).
The problem now is that as soon as I add the interface I get the following log message:
08:55:07,292 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."keycloak-spi.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."keycloak-spi.jar".POST_MODULE
: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "keycloak-spi.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: Failed to link at/lotterien/jam/keycloak/spi/JamAuthorizationInfoProtocolMapper (Module "deployment.keycloak-spi.jar" from Service Module Loader): org/keycloak/protocol/oidc/mappers/UserInfoTokenMapper
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:713)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:60)
at org.keycloak.provider.ProviderManager.load(ProviderManager.java:92)
at org.keycloak.services.DefaultKeycloakSessionFactory.loadFactories(DefaultKeycloakSessionFactory.java:214)
at org.keycloak.services.DefaultKeycloakSessionFactory.deploy(DefaultKeycloakSessionFactory.java:115)
at org.keycloak.provider.ProviderManagerRegistry.deploy(ProviderManagerRegistry.java:42)
at org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor.deploy(KeycloakProviderDeploymentProcessor.java:55)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 5 more
Why does Keycloak not find its own interface? Shouldn't it be provided out of the box?
What do I miss to make it work?
Edit 1
I got a little bit further. I added a file
META-INF/jboss-deployment-structure.xml
with content
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.keycloak.keycloak-services"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
and now the exception is gone.
Unfortunately the method transformUserInfoToken() in my class is still not called on token request.
Can anyone put me in the right direction please?
It finally works. Even there are still open questions I could implement the needed functionality.
I had to implement the Interface
org.keycloak.protocol.oidc.mappers.OIDCAccessTokenMapper
(instead of org.keycloak.protocol.oidc.mappers.UserInfoTokenMapper)
Now my transformAccessToken() method is called on every request to URL http://<host>:<port>/auth/realms/testrealm/protocol/openid-connect/token
I think the problem came from my misunderstanding of the terms AccessToken, UserInfo and IDToken. I thought all three are part of the token generated. But it seems the OIDCAccessTokenMapper is the only way to get additional information into the access token.
The remaining open question for me is where the UserInfo and the IDToken would appear. Maybe somebody can give an answer for that.
I have a solution for MY specific problem. I had the same error - but already had a jboss-deployment-structure.xml with comparable contents. The reason it didnĀ“t work for me was, that I had an EAR containing my implementation and libs as JARs. So the needed structure for jboss-deployment-structure.xml differed.
I post it here for others struggling with the same problem:
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
<system export="true">
<paths>
<path name="com/sun/xml/internal/ws/spi"/>
</paths>
</system>
</dependencies>
</deployment>
<sub-deployment name="org.my.implementation-1.0-SNAPSHOT.jar">
<dependencies>
<module name="org.keycloak.keycloak-core"/>
<module name="org.keycloak.keycloak-server-spi"/>
<module name="org.keycloak.keycloak-server-spi-private"/>
<module name="org.keycloak.keycloak-services"/>
<module name="javax.ws.rs.api"/>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>

Spring MVC - Send email, Bean creation

I'm trying to set up my Spring MVC app to send email, but i think i'm doing something wrong in the configuration
In My AppConfig i instantiate the Bean:
#Bean
public JavaMailSender mailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setDefaultEncoding("UTF-8");
return mailSender;
}
Then in my application.properties I have:
mail.port= 465
mail.host= smtp.gmail.com
mail.username= username
mail.password= password
emailTo = info#beingsmart.it
emailSubject = ALERT - ePark Server
mail.smtp.auth = true
mail.smtp.starttls.enable = true
mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.properties.mail.smtp.socketFactory.fallback = false
When I try to send the email i'm getting
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.mail.javamail.JavaMailSender]: Factory method 'mailSender' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/mail/AuthenticationFailedException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 49 more
Caused by: java.lang.NoClassDefFoundError: javax/mail/AuthenticationFailedException
at it.besmart.config.AppConfig.mailSender(AppConfig.java:128)
at it.besmart.config.AppConfig$$EnhancerBySpringCGLIB$$b2a09c0.CGLIB$mailSender$7(<generated>)
at it.besmart.config.AppConfig$$EnhancerBySpringCGLIB$$b2a09c0$$FastClassBySpringCGLIB$$dd65f050.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318)
at it.besmart.config.AppConfig$$EnhancerBySpringCGLIB$$b2a09c0.mailSender(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 50 more
Caused by: java.lang.ClassNotFoundException: javax.mail.AuthenticationFailedException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
... 61 more
EDIT
I added javax mail to my pom
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.6</version>
</dependency>
Now I have a different exception when trying to send the email
java.lang.NoClassDefFoundError: com/sun/mail/util/MessageRemovedIOException
It looks like an authentication error, but i'm thinking that JavaMailSender does not takes the setting in my application.properties, could it be?
Thanks
It seems to be missing dependency rather than anything else. If using spring boot have dependency like:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
If you don't I suggest you look inside that POM and figure out what are the missing pieces.
In your particular case it seems you need:
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.5</version>
</dependency>
Generic advice:
ClassNotFoundException means class which you need is not on classpath. It's usually a missing dependency
Google to find which jar contains the missing class
Find the library it on maven central
Add to dependencies

Exception in thread "main" java.io.IOException: Cannot initialize Cluster

I am trying to run a simple Hadoop Map reduce program on eclipse in windows. Iam getting the following exception.
Exception in thread "main" java.io.IOException: Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses.
at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:121)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:83)
at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:76)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1188)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1184)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)
at org.apache.hadoop.mapreduce.Job.connect(Job.java:1183)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1212)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1236)
at com.hadoop.mapreduce.WordCountDriverClass.main(WordCountDriverClass.java:41)
These are the jar files I have added in the project.
com.google.guava_1.6.0.jar
commons-configuration-1.7.jar
commons-lang-2.6.jar
commons-logging-1.1.3.jar
commons.collections-3.2.1.jar
guava-13.0.1.jar
hadoop-annotations-2.7.2.jar
hadoop-auth-2.6.0.jar
hadoop-common-2.3.0.jar
hadoop-common.jar
hadoop-mapreduce-client-core-2.0.2-alpha.jar
hadoop-mapreduce-client-core-2.7.2.jar
hadoop-mapreduce-client-jobclient-2.2.0.jar
hadoop-test-1.2.1.jar
log4j-1.2.17.jar
slf4j-api-1.7.7.jar
slf4j-simple-1.6.1.jar
I have added those jar files after checking the exception messages in the console. But I couldn't understand this exception.
Can anyone please help me fixing this.
This is my driver class.
Configuration conf = new Configuration();
// Creating a job
Job job = Job.getInstance(conf,"WordCountDriverClass");
job.setJarByClass(WordCountDriverClass.class);
job.setMapperClass(WordCountMapper.class);
job.setReducerClass(WordCountReducer.class);
job.setNumReduceTasks(2);
job.setInputFormatClass(KeyValueTextInputFormat.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path("inputfiles"));
FileOutputFormat.setOutputPath(job, new Path("outputfiles"));
job.waitForCompletion(true);
Looks like you are running the wordcount example, what it requires are 1.2.1 hadoop-core and 2.2.0 hadoop-common. If you use Maven instead, the config should be as simple as
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.2.0</version>
</dependency>

error in deploying a SpringBoot webapp into tomcat with MongoDB

I am new to SpringBoot . I have successfully executed a webapp using springboot with embedded tomcat.Facing issue when trying to deploy this spring boot webapp into a external Tomcat server.
I got bellow error
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).
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.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).
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) [spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5456) [catalina.jar:7.0.54]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.54]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [catalina.jar:7.0.54]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [catalina.jar:7.0.54]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.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).
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
... 26 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.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).
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
... 28 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.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).
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
... 40 common frames omitted
Caused by: 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).
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.getDriverClassName(DataSourceProperties.java:180) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration.dataSource(DataSourceAutoConfiguration.java:121) ~[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_60]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_60]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
... 41 common frames omitted
2016-03-23 11:55:09.834 INFO 8268 --- [ost-startStop-1] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/classes/, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/aopalliance-1.0.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/classmate-1.1.0.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/hibernate-validator-5.2.4.Final.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jackson-annotations-2.6.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jackson-core-2.6.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jackson-databind-2.6.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jboss-logging-3.3.0.Final.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jcl-over-slf4j-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/jul-to-slf4j-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/log4j-over-slf4j-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/logback-classic-1.1.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/logback-core-1.1.5.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/mongo-java-driver-2.13.3.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/mysql-connector-java-5.1.38.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/slf4j-api-1.7.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/snakeyaml-1.16.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-aop-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-beans-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-autoconfigure-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-data-mongodb-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-logging-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-security-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-validation-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-boot-starter-web-1.3.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-context-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-core-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-data-commons-1.11.4.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-data-mongodb-1.8.4.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-expression-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-orm-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-security-config-4.0.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-security-core-4.0.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-security-web-4.0.3.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-web-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/spring-webmvc-4.2.5.RELEASE.jar, file:/C:/SATYAJIT/Recrosoft/workplace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/springDemo/WEB-INF/lib/validation-api-1.1.0.Final.jar]
2016-03-23 11:55:09.839 ERROR 8268 --- [ina-startStop-1] org.apache.catalina.core.ContainerBase : A child container failed during start
I am using spring boot 1.3.3 with jdk7.
any help would be good - as anyone had similar problems when deploying spring boot apps as a WAR into a external server?
Here are my files
pom.xml
<project.......>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<groupId>SpringBootDemo</groupId>
<artifactId>SpringBootDemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBootDemo Maven Webapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
</dependencies>
<build>
<finalName>SpringBootDemo</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
ApplicatationStart.java
package com.springDemo;
#Configuration
#ComponentScan(basePackages="com.springDemo")
#EnableAutoConfiguration
#SpringBootApplication
public class ApplicatationStart extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ApplicatationStart.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(ApplicatationStart.class, args);
}
}
application.properties
server.contextPath =/springDemo
#for mongo db
spring.data.mongodb.uri=mongodb://localhost/admin
#spring.data.mongodb.host=localhost
#spring.data.mongodb.port=27017
# security properties
security.basic.enabled=false
management.security.enabled=false
The point is that the spring-boot-starter-security is pulling the spring-jdbc dependency. This dependency triggers the DataSourceAutoConfiguration to create a DataSource as you haven't defined one explicitly it assumes an in memory on like H2, HSQLDB or Derby. However those aren't on your classpath so startup fails.
Now you have 2 options to fix this. The first is the explicitly disable the DataSourceAutoConfiguration by adding it as an exclude to the #SpringBootApplication annotation.
#SpringBootApplication(exclude= DataSourceAutoConfiguration.class)
public class ApplicatationStart extends SpringBootServletInitializer { ... }
Pro Tip: You should also remove the #Configuration, #ComponentScan and #EnableAutoConfiguration as those are implied by #SpringBootApplication.
The other option is to exclude the spring-jdbc dependency from the spring-boot-starter-security dependency.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<excludes>
<exclude>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</exclude>
</excludes>
</dependency>