Unable to start springboot app - Resource location must not be null - spring

Tried springboot for the first time but I am unable to get it to start.
I used the sample app: https://github.com/spring-guides/gs-spring-boot.git
I also made modifications to use an embedded jetty instead of tomcat but still no success.
The exception I get is this: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.IllegalArgumentException: Resource location must not be null.
This is on MacOSX.
Edit: I have confirmed this is an environment issue. I can start the app just fine in a linux(fedora) VM but for whatever reason I run into this problem on my Mac. Not sure if anyone else run into this and has any clues on what might be causing this.
Edit 2: So this appears to be an issue with trying to configure ssl by default. I am not sure why this is the case since I haven't specified this anywhere; So my question now is, how do I disable https in spring-boot?
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T09:29:23-08:00)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
Any help is appreciated.
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.IllegalArgumentException: Resource location must not be null
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) ~[spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at hello.Application.main(Application.java:15) [classes!/:0.1.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [gs-spring-boot-0.1.0.jar:0.1.0]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [gs-spring-boot-0.1.0.jar:0.1.0]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [gs-spring-boot-0.1.0.jar:0.1.0]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [gs-spring-boot-0.1.0.jar:0.1.0]
Caused by: java.lang.IllegalArgumentException: Resource location must not be null
at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.util.ResourceUtils.getURL(ResourceUtils.java:131) ~[spring-core-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.configureSslKeyStore(TomcatEmbeddedServletContainerFactory.java:417) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.configureSsl(TomcatEmbeddedServletContainerFactory.java:395) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.customizeSsl(TomcatEmbeddedServletContainerFactory.java:332) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.customizeConnector(TomcatEmbeddedServletContainerFactory.java:311) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:169) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
... 16 common frames omitted

Adding:
server.ssl.enabled=false
in my application.properties solved the problem. I assume ssl configuration was expected based on the parent boot starter pom?? Again, not sure why this is working fine in a linux VM.
Don't have time to dive deeper into this, maybe someone else can shed a bit more light.

I had been disabling and enabling HTTPS (server.ssl.enabled=true) but had forgotten to add these back:
server.ssl.key-store=file:///Users/...
server.ssl.key-store-password=******
Might help some one in the future.

This might help someone:
Any ssl config could cause this, In my case I had following left over configuration:
server.ssl.protocol=TLS
server.ssl.enabled-protocols=TLSv1.2
removing these fixed the issue.

It happened to me when I had ssl.enabled : true but other SSL parameters were not set (because of bad indentation in YAML file). This is how it looks in config/application.yaml when working good.
environments:
production:
server:
port: 9080
ssl:
enabled: true
key-store: /home/peter/app/ucast.rewara.com/ucast.rewara.com.cert.jks
key-store-password: drowssapekaf
key-password: ewerw23121sdsd
key-alias: ucast.rewara.com
grails:
serverURL: "https://ucast.rewara.com:9080"`

I think you could config in file application.properties
#SSL:
server.ssl.enabled=false
If you want to build local. It will not force you to provide the associated certificates for the SSL (http://)
Else you build in remote server (https://) -> using ssl -> true.

Related

java.lang.IllegalStateException: Unable to load config data from 'http://localhost:8888'

I am facing an issue with Spring cloud. The used versions are,
Spring boot version: 2.4.4
Spring cloud version: 2020.0.2
Your input will help me to resolve the microservice startup issue.
I have a spring cloud config server which pick the data from repository and the endpoint
http://localhost:8888/xyz-service/default returning data.
I am trying to read the configuration from microservice which fails to connect to the config server, please refer below error
13:25:09.887 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed
*java.lang.IllegalStateException: Unable to load config data from 'optional:configserver:http://localhost:8888*'
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:125)
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.resolve(StandardConfigDataLocationResolver.java:112)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.lambda$resolve$1(ConfigDataLocationResolvers.java:114)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:125)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:114)
at org.springframework.boot.context.config.ConfigDataLocationResolvers.resolve(ConfigDataLocationResolvers.java:106)
at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:101)
at org.springframework.boot.context.config.ConfigDataImporter.resolve(ConfigDataImporter.java:93)
at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:81)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:119)
at org.springframework.boot.context.config.ConfigDataEnvironment.processInitial(ConfigDataEnvironment.java:230)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:217)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:88)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:80)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
at com.microservice.limitmicroservice.LimitMicroserviceApplication.main(LimitMicroserviceApplication.java:10)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.IllegalStateException: File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/'
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferencesForFile(StandardConfigDataLocationResolver.java:200)
at org.springframework.boot.context.config.StandardConfigDataLocationResolver.getReferences(StandardConfigDataLocationResolver.java:122)
... 35 common frames omitted
Process finished with exit code 0
I see the person did not answer, I have two different applications. They have the same config and the same POM but one gives me this error.
This is the config for both applications, both uses spring boot version 2.4.4, uses java 11, spring cloud 2020.0.2
spring.cloud.config.enabled=false
spring.jmx.enabled=true
management.endpoints.web.exposure.include=*
but the second one fails with similar the error than above
java.lang.IllegalStateException: Unable to load config data from 'optional:configserver:'
Make sure you have the following dependency in your pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
The main reason for this problem is that spring boot does not know how to read the configuration from (for example) repository on github. To solve this problem, you should check whether the following dependency exists in the corresponding module (versions can be different) :
implementation 'org.springframework.cloud:spring-cloud-starter-config:3.1.5'
Connecting this starter should solve your problem

Exception: Multiple service implementations found for interface DeployableContainer when running Arquillian tests

I'm trying to follow the example project "Feedback" from Continuous Enterprise Development in Java, ch. 3 with a bit of modification.
I am using IntelliJ Idea and its JBoss-Forge plugin which shouldn't differ from using the console like in the book.
So far I've created a new project with the following characteristics:
Java 1.8
JEE 7
Wildfly 10.1.0.Final
JUnit 4.12
Arquillian 1.1.13.0
Hibernate
Maven profile: arquillian-wildfly-remote
I've followed every step from the tutorial, all using the IntelliJ plugin:
set ACCEPT_DEFAULTS true
created the project
set up persistence with Hibernate
set up validation with Hibernate validator
created entity FeedbackEntry
scaffolded the UI
forge install-plugin arquillian
set up Arquillian with Wildfly remote container
created an Arquillian
built and deploy the app
All of them ended successfully, I can open the UI and store some values in the DB. The problem comes when trying to run the test: I create an Wildfly Remote Arquillian container:
After clicking OK this is the stacktrace I get:
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)
at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)
... 8 more
Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container arquillian-wildfly-remote
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85)
at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:78)
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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:263)
at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:73)
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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:288)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:63)
... 13 more
Caused by: java.lang.IllegalStateException: Multiple service implementations found for interface org.jboss.arquillian.container.spi.client.container.DeployableContainer. org.jboss.as.arquillian.container.remote.RemoteDeployableContainer, org.arquillian.container.chameleon.ChameleonContainer
at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.onlyOne(ServiceRegistryLoader.java:74)
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76)
... 37 more
Test ignored.
Test ignored.
Process finished with exit code 255
I've searched in many places and I only have found this. However I don't think I have more than 1 container, only Wildfly, so I'm completely clueless about this.
Pom and other key files here: https://gist.github.com/josemigallas/a139fc601b022356391fad5b2ec588b0
Why is this failing and how can I solve/workaround this issue?
From my experience, it might be an issue with Arquillian Plugin or IDEA Maven support having troubles with activating the profile. Please make sure that arquillian-wildfly-remote is in fact enabled by default (if it's ticked then untick and tick it again :)). Also run the test using regular JUnit runner, not the Arquillian one.
I think this is a problem when using IntelliJ with Arquillian support. Can you try to run it from CLI?

Grails 3 JMS Error during sending messages

Due to issue https://github.com/gpc/jms/issues/27 I have add to application.yml
jms:
containers:
standard:
connectionFactoryBean: jmsConnectionFactory
adapters:
standard:
messageConverterBean: standardJmsMessageConverter
persistenceInterceptorBean: persistenceInterceptor
Application starts, but during sending message application get error
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'standardJmsTemplate' is defined at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:704)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1175)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
at
org.springframework.beans.factory.BeanFactory$getBean$3.call(Unknown
Source) at
grails.plugin.jms.JmsService.normalizeServiceCtx(JmsService.groovy:381)
at sun.reflect.GeneratedMethodAccessor1971.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at grails.plugin.jms.JmsService.send(JmsService.groovy:147) at
grails.plugin.jms.JmsService.send(JmsService.groovy) at
grails.plugin.jms.JmsService$send.call(Unknown Source)
Grails 3.1.14
org.grails.plugins:jms:2.0.0.RC1
I hope, the error possible to solve by configureation
No Idea how it works, but fixed by additional lines in application.yml (Just copied from plugin code)
jms:
templates:
standard:
connectionFactoryBean: jmsConnectionFactory
messageConverterBean: standardJmsMessageConverter

Memcached and Tomcat 8 Session Manager Issue

We were using Memcached for session management in our web application with Tomcat 7 and it worked liked charm. In order for it work, I added following jars to Tomcat's lib folder
spymemcached-2.8.12.jar
couchbase-client-1.1.4.jar
memcached-session-manager-tc7-1.6.5.jar
memcached-session-manager-1.6.5.jar
And made following change to Tomcat's server.xml
<Context path="customersupport" docBase="customerSupportOrderCentral#v2" sessionCookieName="CUSTOMERSUPPORT-JSESSIONID">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:oc-cs-elasticcache.w8eptf.cfg.usw1.cache.amazonaws.com:11211"
sticky="false" requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$" />
</Context>
Now we are in process of upgrading our JDK to 1.8 and Tomcat version to 8. I have been researching online for it and it turned out since tomcat 8 doesn't support getSessionCookieName, I have to update memcache jar files for tomcat 8. so I added new set of jar files at tomcat's lib folder as below.
spymemcached-2.11.1.jar
memcached-session-manager-tc8-1.8.1.jar
memcached-session-manager-1.8.1.jar
couchbase-client-1.4.0.jar
And Kept server.xml same but now Tomcat is throwing following error while starting up.
06-Jan-2016 07:03:48.934 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw error
java.lang.NoClassDefFoundError: org/apache/catalina/Lifecycle
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1012)
at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1178)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:766)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1344)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1451)
at org.apache.catalina.startup.Catalina.load(Catalina.java:551)
at org.apache.catalina.startup.Catalina.load(Catalina.java:599)
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:497)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
If I dont change server.xml to include memcache manager, its working fine but with memcache session manager its throwing above error. I can really use some help here to resolve this issue.
Thanks
I had the same issue and got stuck for 2 days. The issue on my end was I had the below memcache specific jars in tomcat/lib and in another project specific classpath - tomcat/{project}/conf. The issue got resolved when I removed these jars from tomcat/{project}/conf
spymemcached-2.11.1.jar
memcached-session-manager-tc8-1.8.1.jar
memcached-session-manager-1.8.1.jar

Tomcat 7 - unable to load class X warnings

Lately I've noticed that after deploying a web application to Tomcat 7 from Eclipse, I'm getting 30+ warnings in the Catalina log file that look like the following:
Oct 17, 2011 3:33:47 PM org.apache.catalina.startup.ContextConfig
checkHandlesTypes WARNING: Unable to load class
[com.sun.codemodel.JArrayClass$1] to check against the #HandlesTypes
annotation of one or more ServletContentInitializers.
java.lang.ClassNotFoundException: com.sun.codemodel.JArrayClass$1 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at
org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:1969)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1932)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1826)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1785)
at
org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1771)
at
org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1254)
at
org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:316)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5103)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:932)
at
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:723)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:379)
at
org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303) at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
The application still works fine, it's just a pain to have to scroll past all these warnings to get to debugging lines. Any idea on how to fix these warnings?
Turns out that the jaxb-xjc.jar wasn't needed for deployment so I just ended up removing it from the classpath which ended up getting rid of all the warning messages.
The following forum post also outlines a problem that occurs when using Metro 2.1.1 with Servlet 3.0 WebApps - may also be of value:
http://www.java.net/forum/topic/glassfish/metro-and-jaxb/metro-211-and-servlet-version-30-tomcat-many-startup-errors
Check your dependencies. One (or more) of them contain META-INF/services/javax.servlet.ServletContainerInitializer file. This file contains class names of type ServletContainerInitializer. ServletContainerInitializers usually have #HandlesTypes annotation which refers classes. One of the referred classes imports/use com.sun.codemodel.JArrayClass which is not on your webapp's classpath.
This question also could be useful: Class implementing ServletContainerInitializer in web.xml
I faced the same issue with tomcat version 7.0.23. I didn't notice this issue after I switched to Tomcat 7.0.33.
Even when I just replaced ${tomcat.dir}/lib/*jars with the jars from the latest tomcat, the problem was solved.
Alternatively, if it helps
two other solutions work
Modify web.xml for every war in webapps and change the web-app version to 2.5 from 3.0
or
Add metadata-complete=true to web-app tag

Resources