Tomcat Manager Deploying WAR file located on server - java

I have a linux server installed CentOS and Tomcat6. And i am trying to deploy my jsf application and i created a war file of my project. I am using Tomcat Manager using Deploy directory or WAR file located on server with parameters given below
My war file is located in wepapps directory as suggested. Than i am giving the Context Path to my app name like /myapp and giving the WAR or Directory URL the url of my application which is like /var/lib/tomcat6/webapps/myapp.war and last i am leaving empty the value of XML Configuration. And when i press the Deploy button Message says Failed to deploy application at context path /myapp
Since this is the first experience for me to deploy an app located on server im not sure if i am doing right. I've searched lots of documents already but still cant find a usefull explanation to start my application.
I am realy stucked with this and need your help?
Here is my catalina log file
Sep 5, 2013 1:38:37 p.m. org.apache.tomcat.util.digester.Digester startElement
SEVERE: Begin event threw error
java.lang.NoClassDefFoundError: org.apache.tomcat.util.modeler.ManagedBean
at java.lang.Class.initializeClass(libgcj.so.10)
at java.lang.Class.newInstance(libgcj.so.10)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
at gnu.xml.stream.SAXParser.parse(libgcj.so.10)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1556)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.execute(MbeansDescriptorsDigesterSource.java:238)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.loadDescriptors(MbeansDescriptorsDigesterSource.java:216)
at org.apache.tomcat.util.modeler.Registry.load(Registry.java:689)
at org.apache.tomcat.util.modeler.Registry.loadDescriptors(Registry.java:800)
at org.apache.tomcat.util.modeler.Registry.loadDescriptors(Registry.java:780)
at org.apache.catalina.mbeans.MBeanUtils.createRegistry(MBeanUtils.java:1066)
at org.apache.catalina.mbeans.MBeanUtils.<clinit>(MBeanUtils.java:95)
at java.lang.Class.initializeClass(libgcj.so.10)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.<clinit>(GlobalResourcesLifecycleListener.java:68)
at java.lang.Class.initializeClass(libgcj.so.10)
at java.lang.Class.newInstance(libgcj.so.10)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
at gnu.xml.stream.SAXParser.parse(libgcj.so.10)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.Catalina.load(Catalina.java:617)
at org.apache.catalina.startup.Catalina.load(Catalina.java:665)
at java.lang.reflect.Method.invoke(libgcj.so.10)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Sep 5, 2013 1:47:15 p.m. org.apache.tomcat.util.digester.Digester startElement
SEVERE: Begin event threw error
java.lang.NoClassDefFoundError: org.apache.tomcat.util.modeler.ManagedBean
at java.lang.Class.initializeClass(libgcj.so.10)
at java.lang.Class.newInstance(libgcj.so.10)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
at gnu.xml.stream.SAXParser.parse(libgcj.so.10)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1556)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.execute(MbeansDescriptorsDigesterSource.java:238)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.loadDescriptors(MbeansDescriptorsDigesterSource.java:216)
at org.apache.tomcat.util.modeler.Registry.load(Registry.java:689)
at org.apache.tomcat.util.modeler.Registry.loadDescriptors(Registry.java:800)
at org.apache.tomcat.util.modeler.Registry.loadDescriptors(Registry.java:780)
at org.apache.catalina.mbeans.MBeanUtils.createRegistry(MBeanUtils.java:1066)
at org.apache.catalina.mbeans.MBeanUtils.<clinit>(MBeanUtils.java:95)
at java.lang.Class.initializeClass(libgcj.so.10)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.<clinit>(GlobalResourcesLifecycleListener.java:68)
at java.lang.Class.initializeClass(libgcj.so.10)
at java.lang.Class.newInstance(libgcj.so.10)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
at gnu.xml.stream.SAXParser.parse(libgcj.so.10)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.Catalina.load(Catalina.java:617)
at org.apache.catalina.startup.Catalina.load(Catalina.java:665)
at java.lang.reflect.Method.invoke(libgcj.so.10)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: java.lang.ClassNotFoundException: javax.management.modelmbean.ModelMBeanNotificationBroadcaster not found in org.apache.catalina.loader.StandardClassLoader{urls=[file:/usr/share/apache-tomcat-7.0.42/lib/,file:/usr/share/apache-tomcat-7.0.42/lib/catalina-tribes.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-coyote.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-dbcp.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-util.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-jdbc.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-i18n-ja.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-i18n-fr.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-api.jar,file:/usr/share/apache-tomcat-7.0.42/lib/ecj-4.2.2.jar,file:/usr/share/apache-tomcat-7.0.42/lib/catalina-ha.jar,file:/usr/share/apache-tomcat-7.0.42/lib/catalina-ant.jar,file:/usr/share/apache-tomcat-7.0.42/lib/jsp-api.jar,file:/usr/share/apache-tomcat-7.0.42/lib/jasper.jar,file:/usr/share/apache-tomcat-7.0.42/lib/catalina.jar,file:/usr/share/apache-tomcat-7.0.42/lib/tomcat-i18n-es.jar,file:/usr/share/apache-tomcat-7.0.42/lib/annotations-api.jar,file:/usr/share/apache-tomcat-7.0.42/lib/el-api.jar,file:/usr/share/apache-tomcat-7.0.42/lib/jasper-el.jar,file:/usr/share/apache-tomcat-7.0.42/lib/servlet-api.jar], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/share/apache-tomcat-7.0.42/bin/bootstrap.jar,file:/usr/share/apache-tomcat-7.0.42/bin/tomcat-juli.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}
at java.net.URLClassLoader.findClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.VMClassLoader.defineClass(libgcj.so.10)
at java.lang.ClassLoader.defineClass(libgcj.so.10)
at java.security.SecureClassLoader.defineClass(libgcj.so.10)
at java.net.URLClassLoader.findClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.Class.forName(libgcj.so.10)
at java.lang.Class.initializeClass(libgcj.so.10)
...25 more
Thanks and Regards

I solved the problem at last. The reason for error is simple actually. We configured our project and created war file using tomcat7. So when we try to deploy and run at server which has previous version of tomcat (tomcat6) it doesnt work. So we installed tomcat7 to that server and it works now. And probably its because tomcat6 doesnt support servlet3 and some of jsf feauters. Thanks again.

Well i have shorted Out that problem Just
Step 1:-
Install JDK 1.7.0
step 2:-
Just include Jre Directory when you are Making TOMCAT Server 7. just goto Installed Jre and Just select ADD in option in that and GOTO the Location of your JRE and add that Folder that.
Step3:-
after adding that finish server installation and run your server.
that way that will be working.

Related

Editing .java files in VSCODE causes error on Tomcat in Eclipse

I'm working on some legacy code in JAVA.
It's like "pure java" with JSP and servlets, no maven and no spring boot.
I usually use VSCODE but the "way it's always been done" is with ECLIPSE and TOMCAT with some special configurations and a keystore.
My problem is: after I modify a .java file on VSCODE the TOMCAT starts giving up the errors:
ago 28, 2020 11:42:13 AM org.apache.catalina.core.ContainerBase startInternal
GRAVE: A child container failed during start
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
ADVERTÊNCIA: The web application [header] appears to have started a thread named [Abandoned connecti
on cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(Unknown Source)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
ago 28, 2020 11:42:13 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
And I have no idea why or how to fix. I end up having to revert the changes, copy and paste the changes inside Eclipse. And then it works, even GIT says there's no changes...
No idea why, but excluding and then reading any file from buildpath seems to be the trick.
Maybe just touching the ".classpath" file should be enough.
That file doesn't appear in Eclipse by default, but does in VSCODE. Its located in the root folder of the project.
It appears you don't need to keep doing this every time.
I'm using git flow and only as I've changed to a new feature branch I had to do this again.

Would missing dependency cause servlet fails to initialize in Struts 1.x?

java.lang.NoClassDefFoundError: org/apache/commons/chain/config/ConfigParser
I deployed a Struts 1.x web application on Weblogic 9. Refer to this specific error line, it seem commons-chain-x.x.jar is missing from the build path. I tried with several different versions of commons-chain.jar (1.1 & 1.2) but not helpful. I googled about it for hours as well, can't find any solution. What's the actual issue here? Is the missing .jar actually caused the servlet to initialize properly?
p.s. I know...Struts is long outdated and no longer widely used, but for some reasons I have to. Any help over here would be appreciated.
Library:
Full error log:
Nov 9, 2018 4:00:25 PM org.apache.struts.action.ActionServlet init
SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.
java.lang.NoClassDefFoundError: org/apache/commons/chain/config/ConfigParser
at org.apache.struts.action.ActionServlet.initChain(ActionServlet.java:1680)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:350)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:278)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:507)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1723)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1700)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1620)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2761)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:889)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:333)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:566)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:104)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:815)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1222)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:433)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:161)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
<Nov 9, 2018 4:00:25 PM SGT> <Error> <HTTP> <BEA-101216> <Servlet: "action" failed to preload on startup in Web application: "StrutsExample".
javax.servlet.UnavailableException: org/apache/commons/chain/config/ConfigParser
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:278)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
Truncated. see log file for complete stacktrace
>
With reference to this article, clear up WebLogic server cache would helps. So it did according to my issue here. I simply deleted tmp folder and the error now disappeared.
Weblogic Cache exists in $MW_HOME/user_projects/domains/ccg/servers/AdminServer/tmp
I had named my domain ccg. You can replace that with your domain name in the above path.
p.s. Folders tmp,cache and logs under the path above are safe for deletion.

Tomcat not running for a JAR file

I am using Postman alongside a JAR file that runs a REST service that holds some contacts. However when I try to run the JAR file by using: java -jar ContactListRESTService.jar in Powershell, I am seeing a bunch of errors that Apache Tomcat could not run. Postman also doesn't recognize the localhost.
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:159)
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletCntainer.java:159) ~[spring-boot 1.3.7.RELEASE.jar!/:1.3.7.RELEASE]
I have tried uninstalling and reinstalling JAVA SE per some guidance from a mentor with no results.
If anyone can point me in the right direction please.

Solr on Websphere 8.5.5 : Linkage Error with org.slf4j.LoggerFactory

I am installing solr ( 4.10.2 ) on WAS 8.5.5 with IBM jdk 7. <br>
I deployed the `solr` as a `war` and added `solr.data.dir` and `solr.solr.home` to the application custom properties.
<br>
Upon accessing the url: http://localhost:9080/solr, <br>
I see the 'Linkage Error' in the logs.
4/03/15 06:50:58:277 GMT] 000000ae webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor]: java.lang.NoClassDefFoundError: org.apache.solr.servlet.SolrDispatchFilter (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:176)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1600)
..........................<br>
...........................<br>
used by: **java.lang.LinkageError: org.slf4j.LoggerFactory**
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:295)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
I modified the lib of the downloaded solr.war. On the top of the jars already present in the solr.war/WEB-INF/lib, I added an additional set of jars from the downloaded solr package
All the jars from \solr-4.10.2\solr-4.10.2\dist
All the jars from \solr-4.10.2\solr-4.10.2\dist\solrj-lib
All the jars from \solr-4.10.2\solr-4.10.2\example\lib\ext
Modified the application Class Loading to 'PARENT_LAST'.
Have been scratching my head for over 16 hours.
Even tried removing the all the slf4j*.jars from the solr.war\WEB-INF\lib but the same error persists.
Some help is highly solicited.
Finally was able to make SOLR up and running on Websphere 8.5.5
I have enumerated the different steps on my blog.
Solr 4.10.2 Deployment on WebSphere855

Tomcat 7 - java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation

I'm facing the following Exception:
Mar 26, 2012 1:20:34 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.
Could not load org.apache.log4j.spi.ThrowableInformation.
The eventual following stack trace is caused by an error thrown for debugging purposes
as well as to attempt to terminate the thread which caused the illegal access, and has
no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1562)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:165)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.error(Category.java:322)
at com.abc.supervisionmanager.Monitoring.run(Monitoring.java:205)
at java.lang.Thread.run(Thread.java:662)
Exception in thread "Thread_Monitoring" java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation
at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:165)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.error(Category.java:322)
at com.abc.supervisionmanager.Monitoring.run(Monitoring.java:205)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.spi.ThrowableInformation
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
... 5 more
I googled about this exception and found that most answers points that it is bug in tomcat 5.5 and it will be solved in version 5.5.28.
However I'm currently using tomcat 7.11 with log4j-1.2.16.jar I'm still facing the same issue.
For me, the solution for this issue (tested with Openbravo 3.0MP11 and Tomcat 7.0.21) was:
Remove the log4j-1.2.16.jar from WEB-INF/lib.
Put the log4j jar inside Tomcat's lib directory. In Ubuntu 11.10 this would be /usr/share/tomcat7/lib
Note for my specific use case of Openbravo: This does solve the log4j issue, but then I ran into other issues.
Sounds like it is a problem with your libraries. Are you sure that you have the Log4J jar-file in the WEB-INF/lib folder of your webapp?
How to solve it . For me:
try {} catch() log4j exception throw.
run tomcat again to find the real problem
solve the real problem and delete try{} catch()
It is not problem for log4j and tomcat. It will throw exception because some of your code run error in webapp init. Maybe xml or config is error.
I had this problem with a portlet (liferay 6.2 Tomcat bundle). I fixed it by deleting the deployment that caused the exception (in the tomcat webapps folder), cleaning and redeploying (with maven -- liferay:deploy) the portlet.

Categories

Resources