Error configuring application listener of class org.springframework.web.context.ContextLoaderListener - spring

I'm trying to deploy my application through IntelliJ IDEA 11.0, and it is giving me the following error:
09:35:52,997 WARN [JAXWSDeployerHookPreJSE] Cannot load servlet class: org.springframework.web.servlet.ViewRendererServlet
09:35:52,999 INFO [TomcatDeployer] deploy, ctxPath=/my-portlet-1.0, warUrl=.../tmp/deploy/tmp555932443707493677my-portlet-1.0-exp.war/
09:35:53,386 ERROR [0]] Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
...
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
09:35:53,391 ERROR [0]] Skipped installing application listeners due to previous error(s)
09:35:53,391 ERROR [StandardContext] Error listenerStart
09:35:53,391 ERROR [StandardContext] Context [/my-portlet-1.0] startup failed due to previous errors
09:35:53,402 WARN [ServiceController] Problem starting service jboss.web.deployment:war=my-portlet-1.0.war,id=-135869088
org.jboss.deployment.DeploymentException: URL file:/C:/JBOSS/jboss-portal-2.7.2/server/default/tmp/deploy/tmp555932443707493677my-portlet-1.0-exp.war/ deployment failed
at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:386)
at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
...
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
09:35:53,407 ERROR [MainDeployer] Could not start deployment: file:C:/Users/Abbas/Projects/my-app/my-portlet/target/my-portlet-1.0.war
org.jboss.deployment.DeploymentException: URL file:/C:/JBOSS/jboss-portal-2.7.2/server/default/tmp/deploy/tmp555932443707493677my-portlet-1.0-exp.war/ deployment failed
at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:386)
at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
...
at java.lang.Thread.run(Thread.java:662)
[2012-07-25 09:35:53,431] Artifact my-portlet:war: Error during artifact deployment. See server log for details.
Does anyone know how to fix this?

Actually I was also facing the same problem and after wasting a lot of time. I realized that actually it is a very silly error. You must have changed the pom file and update the dependencies. But once we do so the jar files of maven dependencies are removed from deployment Assembly.
All you need to do is:
Right click the project folder.
click on properties.
click on Web Deployment Assembly.
check if maven dependencies are listed or not.
if not click the add button
from the list select the maven dependencies and done, apply and OK!
Hope this solve your problem. If you still have it!

ContextLoaderListener is in org.springframework.web-3.0.4.RELEASE.jar
You mentioned a file called org.springframework-3.0.4.RELEASE.jar, which is different.
Maybe you have a typo in your dependencies file?

Related

unable to call webservice from osgi bundle

while deploying an osgi bundle on karaf ,which is internally calling webservice through jbpm process..showing below error...
ERROR | Error in thread 'ActiveMQ Session Task-1'
javax.xml.ws.spi.FactoryFinder$ConfigurationError: Provider
org.apache.cxf.jaxws.spi.ProviderImpl not found
at javax.xml.ws.spi.FactoryFinder$2.run(FactoryFinder.java:143)
at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java:251)
at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:137)
at javax.xml.ws.spi.FactoryFinder.access$300(FactoryFinder.java:44)
at javax.xml.ws.spi.FactoryFinder$3.run(FactoryFinder.java:242)
at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java:251)
at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:173)
at javax.xml.ws.spi.Provider.provider(Provider.java:43)
at javax.xml.ws.Service.<init>(Service.java:35)
at net.webservicex.GeoIPService.<init>(GeoIPService.java:42)
at org.bt.nga.workitemhandlers.GeoIPServiceWorkItemHandler.executeWorkItem(GeoIPServiceWorkItemHandler.java:33)
at org.drools.core.process.instance.impl.DefaultWorkItemManager.internalExecuteWorkItem(DefaultWorkItemManager.java:71)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:138)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:173)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:366)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:325)
at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:73)
at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:44)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:173)
at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)
at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:236)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:439)
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:208)
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:191)
at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:183)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:1787)
at org.bt.nga.service.api.ProcessEngineImpl.executeProcess(ProcessEngineImpl.java:48)
at org.bt.nga.consumer.ActiveMQListener.onMessage(ActiveMQListener.java:52)
at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1401)
at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)
at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Thanks for your help in advance
This error says that some bundle tried to load the class org.apache.cxf.jaxws.spi.ProviderImpl but failed to do so, perhaps because of a missing import.
I can't say any more than that because there is not enough information in the question.

Unable to start neo4j afer copying elasticsearch jar files to plugin folder

I am getting below error in neo4j console.log after copying jar files from dependency folder of elasticsearch to plugin folder of neo4j
2015-12-11 08:08:21.697+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase#623dc0b8' was successfully initialized, but failed to start. Please see attach
ed cause exception. Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase#623dc0b8' was successfully initialized, but failed to start. Please see attached cause exception.
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase#623dc0b8' was successfully initialized, but failed to start. Please see attached cause exceptio
n.
at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:67)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:234)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:97)
at org.neo4j.server.CommunityBootstrapper.start(CommunityBootstrapper.java:48)
at org.neo4j.server.CommunityBootstrapper.main(CommunityBootstrapper.java:35)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase#623dc0b8' was successfully initialized, but failed to start. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:462)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:194)
... 3 more
Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, /var/lib/neo4j/data/graph.db
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:143)
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(CommunityFacadeFactory.java:43)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:108)
at org.neo4j.server.CommunityNeoServer$1.newGraphDatabase(CommunityNeoServer.java:66)
at org.neo4j.server.database.LifecycleManagingDatabase.start(LifecycleManagingDatabase.java:95)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)
... 5 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions#28d2afd8' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:434)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:66)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:102)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:139)
... 10 more
Caused by: org.neo4j.kernel.impl.util.UnsatisfiedDependencyException: java.lang.IllegalArgumentException: No dependency satisfies type class org.neo4j.kernel.impl.util.StringLogger
at org.neo4j.kernel.impl.util.DependenciesProxy$ProxyHandler.invoke(DependenciesProxy.java:79)
at com.sun.proxy.$Proxy6.getStringLogger(Unknown Source)
at org.neo4j.elasticsearch.ElasticSearchKernelExtensionFactory.newKernelExtension(ElasticSearchKernelExtensionFactory.java:39)
at org.neo4j.elasticsearch.ElasticSearchKernelExtensionFactory.newKernelExtension(ElasticSearchKernelExtensionFactory.java:20)
Your problem could be because Neo4j and ElasticSearch using different version of Lucene.
In JVM you can't have one jar with two different versions.

Spring MVC | java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

Hi! Although I've found very similar questions over the forum, none of them was meeting my requirement.
I am using Tomcat 7 to deploy my spring app. However, I am facing:
‘java.lang.ClassNotFoundException:
org.springframework.web.context.ContextLoaderListener’ error,
java.lang.ClassNotFoundException:
org.springframework.web.context.ContextLoaderListener at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at
org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at
org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at
org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100)
at
org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Oct 09, 2012 7:37:32 PM org.apache.catalina.core.StandardContext
listenerStart SEVERE: Skipped installing application listeners due to
previous error(s) Oct 09, 2012 8:00:48 PM
org.apache.catalina.core.ApplicationContext log
I have verified that org.springframework.web-3.1.2.RELEASE.jar is present in the WEB-INF\ \lib\ folder and the required file is present inside it. Kindly note that I am not using any build tool to deploy this web-app like maven.
I have tried to clean and reinstall the app, restarted Tomcat, but didn't have any luck.
Please help.
In WEB-INF\ \lib\ where? In artifacts, or in the project? if it is in the project then it does not mean it is in classpath, If you are using eclipse and did not edit output classpath by eclipse - tomcat setting then you should make sure the .jar file is in:
..\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\YourApp\WEB-INF\lib
that is the default place that eclipse makes artifact and deploys it from there. So make sure you included jar file in eclipse build path configuration. First time when you add new jar or something that related to classpath then do: right click on tomcat(in eclipse) then publish from menu, By this way eclipse updates whole artifact.
Worth verifying if you have the project structure and required jars in classpath. You can take help of this if required for set up.
If you are sure all the jars are available in your lib directory, try cleaning tomcat work directory.
From eclipse (servers view), right click on Tomcat server and then click on the menu "Clean Tomcat Work Directory).

Moving ehcache server from one machine to another

We have been using ehcache.server.1.0.0.war for almost a year.
This week we moved to new computer. We copied cache and changed ehcache.xml accordingly.
However, the new server is now not starting. It throws the error:
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
at org.slf4j.impl.JDK14LoggerAdapter.warn(JDK14LoggerAdapter.java:429)
at net.sf.ehcache.store.DiskStore.deleteIndexIfCorrupt(DiskStore.java:267)
at net.sf.ehcache.store.DiskStore.initialiseFiles(DiskStore.java:210)
at net.sf.ehcache.store.DiskStore.<init>(DiskStore.java:166)
at net.sf.ehcache.store.DiskStore.create(DiskStore.java:187)
at net.sf.ehcache.Cache.createDiskStore(Cache.java:1069)
at net.sf.ehcache.Cache.initialise(Cache.java:941)
at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:921)
at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:607)
at net.sf.ehcache.CacheManager.init(CacheManager.java:336)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:276)
at net.sf.ehcache.CacheManager.create(CacheManager.java:636)
at net.sf.ehcache.CacheManager.getInstance(CacheManager.java:657)
at net.sf.ehcache.server.soap.EhcacheWebServiceEndpoint.<init>(EhcacheWebServiceEndpoint.java:71)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
Any ideas appreciated.
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
This error happens when you have wrong slf4j version of the jar. Check carefully all jar versions/sizes on your old server and make sure they are the same on a new server.
Also diff. versions of the jars could be in your new app server system classpath that would interfere with your application classpath. You should configure class loading order policy in your deployment descriptor (its specific to the app server vendor you are using)

SLF4J: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized

I have the following maven dependency in my pom file:
<!-- depends on slf4j-api, log4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
When I deploy the project into tomcat, I am getting the error message:
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.ExceptionInInitializerError
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:288)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
at org.springframework.web.context.ContextCleanupListener.<clinit>(ContextCleanupListener.java:43)
... 16 more
When I look at the deployed war file, I see in the war file the following jars (among others):
slf4j-api-1.6.4.jar
slf4j-log4j12-1.6.4.jar
The strange thing is, that I don't see there any log4j.jar (even though it's a dependency of slf4j-log4j12-1.6.4.jar
Questions:
Why was log4j.jar not packed in the war file?
What does the error message mean and how to solve it?
I had this issue due to a bad jar file in the repository. Deleting the entire log4j directory in the Maven repository fixed it once I did Maven > Update Dependencies and it re-downloaded them.
The simple thing is, cause you didn't give it as dependency in your pom, cause slf4j is a logging facade which means you have to give the real implementation with it. The error message gives you a hint to the explanation of the cause of this error.
I got this error too and I actually had the log4j.jar in my war file.
But it turned out to be a classloader issue in my case: I had a jar in my shared/lib which tried to log with slf4j but that classloader did not have the log4j available.
It seems as if you need to downgrade your project to slf4j 1.4.2 to work with the log4j available in your tomcat. They are binary incompatible. You would also hang on to the provided afterwards, so you dont include them double.
The alternative is to get the other project to include the libraries themselves and remove from tomcat common. I know of no other exclusion mechanism on the tomcat.
For reference, and probably not helpful, I currently deploy on weblogic and it has a deployment specification that allows one to exclude server common classes and use bundled classes instead, such as the below snippet (with reference)

Resources