Not able to start app in Apache Tomcat - java

Just to let you know, I'm not a programmer at all so I'm kind of lost in my problem. I'm trying to migrate an app from a Windows Server 2003 server on Apache Tomcat 4.1 and Java 1.4.2 (App is working fine on that server). I'm tried migrating it on a Windows Server 2008 R2 with any version of Apache Tomcat and Java compatible with W2KR2 but I'm always getting the same error when I try to start the app from the web interface:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/GestClientsAS2]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3780)
at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1307)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1290)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1474)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:280)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1141)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1365)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1369)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1345)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/mail/internet/MimeBodyPart
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127)
at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:275)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:138)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:331)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:770)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5083)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
I believe there is a class missing? How would I fix this?
Thanks.

Since you told me you application was running in a java 1.4 version, and this class is only default in Java 5+ version (See documentation: http://docs.oracle.com/javaee/5/api/javax/mail/internet/MimeBodyPart.html), you will have to import it to your project.
Download it: http://www.java2s.com/Code/Jar/j/Downloadjavamailmailapi14jar.htm
Since it is a web application, put this jar file inside, WEB-INF/libs, so, the classloader will load it, restart the server.
if its not a web project you can right click on the library and go to "Build Path" -> "Add to Build Path".

Related

Java-FX failed to load resource exception

I am running my Java-FX application via webstart by tomcat server.
After signing and versioning of jars I having this problem when am accessing it through web browser.
I am using jnlp and version protocol to start the application through tomcat server.
ExitException[ 3]com.sun.deploy.net.FailedDownloadException: Unable to load resource:
(httP://127.0.0.1:8080/gyms/lib/commons-collections-3.2.1.jar?version-id=1.0.1, 1.0.1)
at sun.plugin2.applet.JNLP2Manager.downloadResources(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
It seems you are using a jnlp-file with a line like this:
<jar href="commons-collections-3.2.1.jar" version="1.0.1" />
So you are using the version-based download protocol. This will result in the server looking for a file called commons-collections-3.2.1__V1.0.1.jar which apparently is not there.
Bottom line: do not specify two conflicting version-numbers in your jnlp. Decide wether you want to use versioned download and omit the version-number in the href-attribute or use simple download and omit the version-attribute.
Problem is solved because I am using Java 1.7.51 update and also i am usin third api which is not supported in java 8 which is also installed in my desktop.
The program(x86) should not have any version of java greater than java 7 as the application is taking java/bin from x86 only.
that is why that failed download exception is coming at run time.

Is there any dependency between Spring and Apache Tomcat Jar

Following is the timeline of how i got error in my application
Used Spring 2.5.3 and tomcat 7.0.27 - No Error
Upgraded to Spring 3.1.1 with same tomcat (7.0.27) - No Error
Upgraded tomcat to 7.0.42, used with Spring 3.1.1 - VerifyError
When i stop my application, i get 1000 verifyerrors (seperate error for every destroyBean) when i upgraded to tomcat 7.0.42.
Following is the Stack Trace:
java.lang.VerifyError: (class: org/springframework/orm/jpa/EntityManagerFactoryUtils, method: convertJpaAccessExceptionIfPossible signature: (Ljava/lang/RuntimeException;)Lorg/springframework/dao/DataAccessException;) Wrong return type in function
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessBeforeDestruction(PersistenceAnnotationBeanPostProcessor.java:357)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:193)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:498)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:509)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:442)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1066)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1040)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Possible Cause:
fixed EntityManagerFactoryUtils's "convertJpaAccessException" to always return rather than throw DataAccessExceptions
This line is in ChangeLog of Spring 2.5.6
But my application works fine with Spring 3.1.1 and tomcat 7.0.27 but throws this error when upgraded to tomcat 7.0.42
AFAIK, Tomcat doesn't depend on Spring, and Spring doesn't depend on Tomcat. Not in any version of either.
I suspect that in the intermediate version of your application after "upgrade to Spring 3.1.1 with same tomcat (7.0.27)", you either didn't trigger that code to be run. Note that it is happening in code that is run when a webapp is shut. If you never attempted a clean shutdown in the intermediate version of your application, that postProcessBeanBeforeDestruction method wouldn't be called on that bean, and the problem wouldn't arise.
My guess is that the real problem is caused by mixing versions of Spring JAR files.

ClassNotFoundException of NIO using Tomcat 7 and Java 7

I build a web project in Eclipse Kepler with Apache Tomcat 7.0.47.
While running on server, it causes java.lang.ClassNotFoundException: java.nio.file.Paths as below.
java.lang.NoClassDefFoundError: java/nio/file/Paths
at ...
Caused by: java.lang.ClassNotFoundException: java.nio.file.Paths
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
... 12 more
It worked well before I invite this new feature of Java 7. Could anyone give me some suggest to figure out what's going on here please?
Uninstalling older version is not required.
But it is obvious that your Tomcat 7.0 still uses the jdk 6. There are two paths system path and user path. Check both of them.

Getting issue in tomcat 7 but worked on tomcat 5. (Failed to start component )

My application was running fine on tomcat 5.5 but now i want to use tomcat 7.I am getting issue if i use tomcat 7.
I found on net and saw that people getting this issue. But i am facing this issue on tomcat 7 but on tomcat 5 my application was working fine.
Any clue ?
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEng
ine[Catalina].StandardHost[localhost].StandardContext[/ServiceDefinitionApp]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
ADDITON after comments :
Caused by: java.lang.ClassNotFoundException: com.alc.alcml.jaxb.xjc.Attributetype
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at com.container.AppClassLoader.findClass(AppClassLoader.java:98)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
As a solution i added the jar which contains this file in my application WEB-INF/lib and all worked fine.
NOW Question :
when i was running on tomcat 5.5, same application was running fine without having a jar in WEB-INF/lib.Why ?
Please make a note that JAR is available in class-path from some other directory but this is applicable same for tomcat5.5 and tomcat 7.
I can't give you a definite answer, but one possible explanation is that the JAR file was in the "shared libraries" directory of your Tomcat 5.5 installation.

Exception while re-deploying my webapp on tomcat 6

All,
I am having problems redeploying my java webapp packaged as war using maven 3.0 (mvn package) on tomcat 6.0
However if I restart my server completely i donot get this exception and the whole app runs perfectly fine.
Here is the details of catalina log:
WARNING: Error while removing context []
java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable
at org.apache.struts2.dispatcher.Dispatcher.cleanup(Dispatcher.java:263)
at org.apache.struts2.dispatcher.FilterDispatcher.destroy(FilterDispatcher.java:238)
at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:332)
at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:3731)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4493)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1035)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1203)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(Containe rBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.util.ObjectFactoryDestroyable
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 15 more
Pls help..!

Categories