Spring under Geronimo v2.1 with Jetty - java

I trying to deploy Java EE web application on Geronimo container with Jetty web server. Unfortunately I have some troubles, I'm getting NoSuchMethod error. I saw that somebody had similar problem, and the solution was to remove redundant spring-framework library from classpath. But it doesn't work for me, my classpath is correctly constructed. Here's contents of WEB-INF/lib directory:
aopalliance-1.0.jar
commons-collections-3.2.1.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
h2-1.3.164.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.6.9.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
javassist-3.12.1.GA.jar
log4j-1.2.16.jar
slf4j-api-1.6.4.jar
slf4j-log4j12-1.6.4.jar
spring-aop-3.1.1.RELEASE.jar
spring-asm-3.1.1.RELEASE.jar
spring-beans-3.1.1.RELEASE.jar
spring-context-3.1.1.RELEASE.jar
spring-core-3.1.1.RELEASE.jar
spring-expression-3.1.1.RELEASE.jar
spring-hibernate3-2.0.8.jar
spring-jdbc-3.1.1.RELEASE.jar
spring-orm-3.1.1.RELEASE.jar
spring-tx-3.1.1.RELEASE.jar
spring-web-3.1.1.RELEASE.jar
spring-webmvc-3.1.1.RELEASE.jar
spring-webmvc-3.1.1.RELEASE-sources.jar
Referencing to redundant libraries trouble, is that possible that web container loads own version of spring-framework different than given in WEB-INF/lib? I thought that WEB-INF/lib directory has better priority... It's my first project under Geronimo, but I saw that project can contain geronimo-web.xml file, maybe I should place there something referenced with library loading/dependencies?
Here's the stacktrace:
Geronimo Application Server started
2012-02-24 20:19:17,463 WARN [JettyModuleBuilder] Web application . does not contain a WEB-INF/geronimo-web.xml deployment plan. This may or may not be a problem, depending on whether you have things like resource references that need to be resolved. You can also give the deployer a separate deployment plan file on the command line.
2012-02-24 20:19:22,122 ERROR [log] failed dispatcher
org.apache.xbean.recipe.ConstructionException: Error invoking constructor: public org.springframework.web.servlet.DispatcherServlet()
at org.apache.xbean.recipe.ReflectionUtil$ConstructorFactory.create(ReflectionUtil.java:962)
at org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276)
at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
at org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:173)
at org.apache.geronimo.jetty6.JettyWebAppContext.newInstance(JettyWebAppContext.java:317)
at org.apache.geronimo.jetty6.InternalJettyServletHolder.newInstance(InternalJettyServletHolder.java:81)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:253)
at org.apache.geronimo.jetty6.InternalJettyServletHolder.internalDoStart(InternalJettyServletHolder.java:120)
at org.apache.geronimo.jetty6.InternalJettyServletHolder.access$000(InternalJettyServletHolder.java:38)
at org.apache.geronimo.jetty6.InternalJettyServletHolder$StartCommand.lifecycleMethod(InternalJettyServletHolder.java:131)
at org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleCommand(AbstractImmutableHandler.java:62)
at org.apache.geronimo.jetty6.handler.ThreadClassloaderHandler.lifecycleCommand(ThreadClassloaderHandler.java:57)
at org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleCommand(AbstractImmutableHandler.java:60)
at org.apache.geronimo.jetty6.handler.InstanceContextHandler.lifecycleCommand(InstanceContextHandler.java:81)
at org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleCommand(AbstractImmutableHandler.java:60)
at org.apache.geronimo.jetty6.handler.UserTransactionHandler.lifecycleCommand(UserTransactionHandler.java:63)
at org.apache.geronimo.jetty6.handler.AbstractImmutableHandler.lifecycleCommand(AbstractImmutableHandler.java:60)
at org.apache.geronimo.jetty6.handler.ComponentContextHandler.lifecycleCommand(ComponentContextHandler.java:57)
at org.apache.geronimo.jetty6.InternalJettyServletHolder.doStart(InternalJettyServletHolder.java:107)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
at org.mortbay.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:980)
at org.mortbay.jetty.servlet.ServletHandler.setServletMappings(ServletHandler.java:1037)
at org.mortbay.jetty.servlet.ServletHandler.addServletMapping(ServletHandler.java:736)
at org.apache.geronimo.jetty6.JettyWebAppContext.registerServletHolder(JettyWebAppContext.java:497)
at org.apache.geronimo.jetty6.JettyServletHolder.<init>(JettyServletHolder.java:80)
at sun.reflect.GeneratedConstructorAccessor62.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:948)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:294)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:294)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:555)
at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:456)
at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:188)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:563)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:544)
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.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
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.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:867)
at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
at org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265)
at java.security.AccessController.doPrivileged(Native Method)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1367)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
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)
Caused by: java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class;
at org.springframework.core.convert.support.GenericConversionService.getRequiredTypeInfo(GenericConversionService.java:275)
at org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:93)
at org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:61)
at org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:53)
at org.springframework.core.convert.support.DefaultConversionService.<init>(DefaultConversionService.java:42)
at org.springframework.core.env.AbstractPropertyResolver.<init>(AbstractPropertyResolver.java:44)
at org.springframework.core.env.PropertySourcesPropertyResolver.<init>(PropertySourcesPropertyResolver.java:42)
at org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:101)
at org.springframework.core.env.StandardEnvironment.<init>(StandardEnvironment.java:54)
at org.springframework.web.context.support.StandardServletEnvironment.<init>(StandardServletEnvironment.java:43)
at org.springframework.web.servlet.HttpServletBean.<init>(HttpServletBean.java:90)
at org.springframework.web.servlet.FrameworkServlet.<init>(FrameworkServlet.java:211)
at org.springframework.web.servlet.DispatcherServlet.<init>(DispatcherServlet.java:323)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.xbean.recipe.ReflectionUtil$ConstructorFactory.create(ReflectionUtil.java:952)
... 96 more

Finally I found two possible solutions. One, more obvious, is to use Geronimo dedicated Spring library, for example Geronimo v2.1 used Spring 2.5.6. The other, more rational, is to create/edit geronimo-web.xml. For me I had to overwrite loading order, it means, WEB-INF/lib libraries have better priority to be loaded.
<sys:environment>
<sys:hidden-classes>
<sys:filter>org.springframework</sys:filter>
<sys:filter>org.hibernate</sys:filter>
<sys:filter>javax.persistence</sys:filter>
<sys:filter>org.apache.log4j</sys:filter>
<sys:filter>org.slf4j</sys:filter>
<sys:filter>org.apache.tiles</sys:filter>
<sys:filter>javassist</sys:filter>
<sys:filter>org.h2</sys:filter>
<sys:filter>org.dom4j</sys:filter>
<sys:filter>org.apache.commons</sys:filter>
<sys:filter>org.aopalliance</sys:filter>
</sys:hidden-classes>
</sys:environment>

This is the problem:
NoSuchMethodError: org.springframework.core.GenericTypeResolver.
resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class;
This method was introduced in Spring 3.0.0.RELEASE (compare with 3.0.0.M4). Also it is part of 3.1.1.RELEASE - which you believe you are using.
Double check you don't have any duplicated JARs, especially the spring-core*.jar.

Related

Exception in thread “main” java.util.zip.ZipException: error in opening zip file

I'm trying to create a web application in NetBeans 8.2, for this I try to use Apache Tomcat 8.0.27 which is integrated into this version. Previously I worked with Tomcat and Netbeans without any problem but in one occasion it failed.
I tried to modify environment variables in addition to reinstalling NetBeans with all its components but it did not work. I looked for information in other questions but I didn't find anything useful, possibly some file is corrupted but if it were the case, I would like to know how to solve it with a simple and understandable explanation, in some forums I read about how to find corrupted files and solve some things but they are not so clear to me.
Specs:
- Windows
- Netbeans 8.2
- Tomcat 8.0.27
- JDK & JDR 1.8.0.191
**Exception in thread "main" java.lang.InternalError:** java.util.zip.ZipException: error in opening zip file
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1052)
at sun.misc.URLClassPath.getResource(URLClassPath.java:249)
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.ResourceBundle$RBClassLoader.loadClass(ResourceBundle.java:512)
at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2649)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1510)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1474)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1370)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:782)
at sun.security.provider.AuthPolicyFile$1.run(AuthPolicyFile.java:74)
at sun.security.provider.AuthPolicyFile$1.run(AuthPolicyFile.java:71)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.provider.AuthPolicyFile.<clinit>(AuthPolicyFile.java:71)
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 java.lang.Class.newInstance(Class.java:442)
at javax.security.auth.Policy$2.run(Policy.java:236)
at javax.security.auth.Policy$2.run(Policy.java:228)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Policy.getPolicyNoCheck(Policy.java:227)
at javax.security.auth.Policy.getPolicy(Policy.java:197)
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.apache.catalina.core.JreMemoryLeakPreventionListener.lifecycleEvent(JreMemoryLeakPreventionListener.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:99)
at org.apache.catalina.startup.Catalina.load(Catalina.java:576)
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:498)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
**Caused by: java.util.zip.ZipException: error in opening zip file**
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:103)
at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:940)
at sun.misc.URLClassPath$JarLoader.access$800(URLClassPath.java:801)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:886)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:879)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:878)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1050)
... 44 more
I would expect Tomcat to deploy without any problem but instead it is simply not deployed, sending the error every time.
Update: I installed the same NetBeans but in other computer AND it worked. I copyied the files of Tomcat and NetBeans but the error still (So, theres no a problem related to corrupted .jars i think). The project that im using to test it's a basic HTML page... A default Java web project.
This problem in most part of times is a Exception of corrupted jars.
Are you trying to connect to any database? If yes, try to remove .jar file from lib folder on WebContent and copy the file from your computer directory to your folder on IDE and try again. If no, try to do this procedure to all of .jars that you're using on your project and replace them all again.

java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionContainer.initHome()

I use JBoss 5.0.1.
I try to deploy some EJB 3.0 beans.
This is my log during JBoss start:
23:19:15,955 ERROR [AbstractKernelController] Error installing to Create: name=jboss.j2ee:jndiName=MyServiceFacadeBean/remote,service=EJB state=Configured mode=Manual requiredState=Create
java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionContainer.initHome()
at java.lang.Class.getMethod(Class.java:1605)
at org.jboss.ejb.StatelessSessionContainer.setupHomeMapping(StatelessSessionContainer.java:132)
at org.jboss.ejb.SessionContainer.createService(SessionContainer.java:168)
at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:344)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:320)
at sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:189)
at $Proxy36.create(Unknown Source)
It seems Jboss has incorrect version of required Class or I use some old/new code for EJB deploy.
Please do not tell to use different JBoss version or change my ejb-jar.xml I just want to understand where can this class be found?
The problem is that you are not using one version of JBoss. If you were this would not happen. The problem is you are using two different and incompatible JBoss libraries and when one calls the other you get this error.
Just make sure you have one version of JBoss.

Starting Tomcat v6.0 Server at localhost fails

I am not able to start Tomcat v6.0 from Eclipse Helios.
I have my Java bin path set properly.
Moreover, I can start the server from outside of Eclipse manually. I could start it from Windows Services as well as using tomcat6.exe and see that it works correctly in my browser by typing localhost:8080 in the URL, but when I start from Eclipse a window appears saying that it encountered a problem while starting tomcat.
And my Console shows the following error:-
java.lang.reflect.InvocationTargetException
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:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1094)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
... 6 more
I also tried a solution here, but the problem still persists. However, the problem there is different from what I get.
How do I solve this?
Seems that you're building some web-app with spring support.
You have to export dependencies into tomcat.
project_properties -> Java build path -> Order and Export tab.
On this tab check all checkboxes which are relevant (you have to check spring at least).
Push OK.
Redeploy

java.lang.ClassNotFoundException: org.apache.catalina.core.ThreadLocalLeakPreventionListener

I'm trying to create a web service and deply it on Tomcat. I'm following this tutorial.
I'm using Eclipse Europa.
But when I try to start the server it returns this error:
java.lang.ClassNotFoundException: org.apache.catalina.core.ThreadLocalLeakPreventionListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
at org.apache.tomcat.util.digester.Rule.begin(Rule.java:153)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1356)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:504)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:741)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:262)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
The ThreadLocalLeakPreventionListener was added recently to tomcat. It is available in tomcat 7 as well as the latest version(s) of tomcat 6. Make sure you have the latest tomcat 6, with a clean installation (your installation might have the server.xml from the new version and the jars from the older one)
even i faced the same issue.What you need to do is, go to servers tab and left click on Apache server and click on properties. There you can see Location pointing to [workspace metadata]. Click on switch Location. It will switch to Apache location /Servers/Tomcat xxx.Apply the changes and save.
If you are using the class in server.xml you need to remove it to get rid of the error/Exception.
<Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
Your web.xml contains entry for a listener whose code was added in Tomcat 7.0.6 and onwards, but your tomcat is older than that -
org.apache.catalina.core.ThreadLocalLeakPreventionListener

JAXB Issue -- class ... nor any of its super class is known to this context

I've been trying to figure this problem out for the last 2 days already, but to no avail!
My webservice, as well as the client, are working fine on my machine (I'm testing the applicaiton on Weblogic 10.3.2, same as our DEV environment). But whenever I deploy the app to DEV, the below exception shows up.
My assumption is that the classloaders are loading "old" jar files, which don't support my current application code, but I have no way of figuring out how to solve this issue.
I've tried many things, from using the 'prefer-application-packages' in my ear file, to creating the "endorsed" directory and including that in my classpath, but nothing works. (I've included both the axis2 and jaxb jars in the 'endorsed' dir).
Does anybody out there have any possible solution to this? Which jar files should I "overwrite"? Where do you think this is failing?
Any help is appreciated!!!
DEV configuration:
Weblogic 10.3.2
java.version = 1.6.0_14
java.vm.info = compiled mode
java.vm.name = BEA JRockit(R)
java.home = /app/platform/jrockit/3.1.2/jre
java.class.path = /app/platform/jrockit/3.1.2/lib/endorsed/jaxb-impl-2.2.2.jar::/app/platform/wls/10.3.2/patch_wls1032/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/app/platform/jrockit/3.1.2/lib/tools.jar:/app/platform/wls/10.3.2/utils/config/10.3/config-launch.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/weblogic_sp.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/weblogic.jar:/app/platform/wls/10.3.2/modules/features/weblogic.server.modules_10.3.2.0.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/webservices.jar:/app/platform/wls/10.3.2/modules/org.apache.ant_1.7.0/lib/ant-all.jar:/app/platform/wls/10.3.2/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:/app/platform/wls/10.3.2/wlserver_10.3/common/eval/pointbase/lib/pbclient57.jar:/app/platform/wls/10.3.2/wlserver_10.3/server/lib/xqrl.jar
Caused By: javax.xml.bind.JAXBException: class com.comcast.cet.web.service.routing.lb.f5.impl.GetWipInfoForSpecificPoolMemberRequest nor any of its super class is known to this context.
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:605)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:486)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:320)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:249)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
at org.apache.axis2.datasource.jaxb.JAXBDSContext$1.run(JAXBDSContext.java:388)
at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshalByElement(JAXBDSContext.java:369)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshal(JAXBDSContext.java:339)
at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:189)
at org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:370)
at org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:294)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:557)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:554)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:118)
at org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:82)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:317)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:159)
at $Proxy84.getWipInfoForSpecificPoolMember(Unknown Source)
at com.comcast.cet.web.service.routing.lb.LoadBalancerMain.getWipInfoForPoolMember(LoadBalancerMain.java:73)
at com.comcast.cet.web.controllers.rpc.RoutingServiceImpl.getWipInfoForSpecificFarm(RoutingServiceImpl.java:157)
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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:544)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:504)
at com.comcast.cet.web.controllers.rpc.RoutingServiceRpcController.processCall(RoutingServiceRpcController.java:64)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at com.comcast.cet.web.controllers.rpc.RoutingServiceRpcController.handleRequest(RoutingServiceRpcController.java:41)
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.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Ok, the quick solution is simply to switch from Axis2 to Apache CXF if you're running your code on weblogic or websphere (I was using the former). The reason for that is that these application servers bundle axis into their RTE, so when you managed server starts up, the axis libraries that are bundled with weblogic are read in first, rather then your axis libraries. There are a lot of "hacks" you can use/do to make this work:
Migrating from a 'war' package to an 'ear' package and utilizing the 'prefer-application-packages' feature
Creating the 'endorsed' directory and uploading your jar files there
Other options are available, but too complex to clearly spell them out
In all of the above cases, the code still didn't function properly, so the only option that I saw fit was to switch from axis2 to cxf, which isn't bundled by weblogic, therefore no "interference"! If you are using weblogic, then you'll have to add the following to the server 'startup' options:
-Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
This is a known issue in weblogic.
Here are the cxf maven dependencies I had to include (I removed ALL of the axis and axiom dependencies)
org.apache.cxf
cxf-rt-frontend-jaxws
${cxf.version}
org.apache.cxf
cxf-rt-transports-http
${cxf.version}
org.apache.cxf
cxf-rt-transports-http-jetty
${cxf.version}

Categories

Resources