Unable To Create the file [META-INF/war-tracker] Tomcat 9 linux - java

Tomcat logs:
java.io.IOException: Unable to create the file [/usr/local/tomcat/webapps/mywebapp/META-INF/war-tracker]
at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:180)
at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:609)
at org.apache.catalina.startup.ContextConfig.beforeStart(ContextConfig.java:742)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:301)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:182)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1858)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:972)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:801)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:695)
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.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Suddenly the server does not work,
Not extracted The WAR file in webapps, can not work with API requests,
Context file :
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
I tried to deploye from the manager on TOMCAT's page and again it was not successful.
find in logs :
Unable to create the file [/usr/local/tomcat/webapps/mywebapp/META-INF/war-tracker]
I looked for solutions and did not find, anyone there that happened to him?
Tomcat : apache-tomcat-9.0.13
openjdk version "1.8.0_171"

The problem is the file "META-INF/war-tracker" in the deployment-war:
From the Tomcat-docs:
Note: If Tomcat expands the WAR file then it will add a file (/META-INF/war-tracking) to the unpacked directory structure which it uses to detect changes in the WAR file while Tomcat is not running. Any such change will trigger the deletion of the expanded directory and the deployment of the updated WAR file when Tomcat next starts.
It seems that you manually packed the war-file and included META-INF/war-tracker. During deployment, Tomcat (from version 8 onwards AFAIK) tries to create said file to detect the changes. However, if such a file exists, Tomcat is not able to create the file and will throw the exception you mentioned above.
Solution:
Remove the file "META-INF/war-tracker" from your war-file before deployment and you're all set.

We had exactly the same behaviour under Windows. In our case, the explanation was simple, whereas hard do find: there already was a file META-INF/war-tracker within the *.war we were deploying. Presumably, the war had been forged by hand based on an already unpacked directory tree instead of being created by the IDE.

Related

DSpace Repository: REST API shows 404 error

I set up a DSpace 6.3 instance for experimenting/development purposes on a Linux Mint 19.1 with a postgresql data base, running on localhost:8080.
XMLUI, SOLR and OAI seem to work fine, but I cannot get the REST API to work. (And also the ORCID integration but that may be connected to the REST problem so I consider that secondary.) I keep getting a 404 error, no matter if I try to access the REST webapp via browser or curl.
I did install the webapp for REST via mvn and ant and I copied the webapp folders to my tomcat9 instance (as explained in https://wiki.lyrasis.org/display/DSDOC6x/Installing+DSpace#InstallingDSpace-InstallationInstructions).
I also commented out the security-constraint part to deactivate SSL (as explained in https://wiki.lyrasis.org/display/DSDOC6x/REST+API).
The ownership and permission settings are the same as for .../webapps/xmlui, /solr and /oai.
I read that problems can occur with Java 7 (http://dspace.2283337.n4.nabble.com/deploying-the-rest-api-td4692801.html), but I did the installation with Java 8 first and also tried with Java 11, but both did not work.
I do not work with a proxy (as in https://groups.google.com/forum/#!searchin/dspace-tech/rest$20api$20404%7Csort:date/dspace-tech/mnG_tL3Ijrg/58xA20TXAgAJ).
I took a look at the catalina.log and localhost.log in tomcat.
The catalina.log tells me it has something to do with a failed start of listeners:
11-Apr-2020 12:23:56.101 INFORMATION [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/var/lib/tomcat9/webapps/rest]
11-Apr-2020 12:24:01.153 INFORMATION [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
11-Apr-2020 12:24:06.521 SCHWERWIEGEND [main] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
11-Apr-2020 12:24:06.522 SCHWERWIEGEND [main] org.apache.catalina.core.StandardContext.startInternal Context [/rest] startup failed due to previous errors
11-Apr-2020 12:24:06.853 WARNUNG [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [rest] appears to have started a thread named [net.sf.ehcache.CacheManager#5b5d1f9a] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base#11.0.6/java.lang.Object.wait(Native Method)
java.base#11.0.6/java.lang.Object.wait(Object.java:328)
java.base#11.0.6/java.util.TimerThread.mainLoop(Timer.java:527)
java.base#11.0.6/java.util.TimerThread.run(Timer.java:506)
I assume the relevant section of the localhost.log (which I think is the container log file) is:
11-Apr-2020 12:24:04.362 INFORMATION [main] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
11-Apr-2020 12:24:06.521 SCHWERWIEGEND [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.dspace.app.util.DSpaceWebappListener]
org.dspace.core.exception.DatabaseSchemaValidationException: The schema validator returned: Error activating Bean Validation integration
at org.dspace.core.Context.init(Context.java:170)
at org.dspace.core.Context.<init>(Context.java:126)
at org.dspace.app.util.AbstractDSpaceWebapp.register(AbstractDSpaceWebapp.java:74)
at org.dspace.app.util.DSpaceWebappListener.contextInitialized(DSpaceWebappListener.java:31)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4668)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5136)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1133)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1868)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1045)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:429)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1577)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:929)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:928)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:638)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:496)
11-Apr-2020 12:24:06.810 SCHWERWIEGEND [main] org.apache.catalina.core.StandardContext.listenerStop Exception sending context destroyed event to listener instance of class [org.dspace.app.util.DSpaceWebappListener]
org.dspace.core.exception.DatabaseSchemaValidationException: The schema validator returned: Error activating Bean Validation integration
at org.dspace.core.Context.init(Context.java:170)
at org.dspace.core.Context.<init>(Context.java:126)
at org.dspace.app.util.AbstractDSpaceWebapp.deregister(AbstractDSpaceWebapp.java:87)
at org.dspace.app.util.DSpaceWebappListener.contextDestroyed(DSpaceWebappListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4715)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5374)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1133)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1868)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1045)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:429)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1577)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:929)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:928)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:638)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:496)
The dspace, cocoon and solr logs don't seem to contain relevant information as far as I can tell but I can obviously also post them if needed.
Could someone help me understand what these errors mean and what I could do to resolve them - I am a little stuck... If I forgot to include any needed information I am happy to include it of course!
Thanks for even reading...
Anna
I faced the same problem today. I solved it like this: Tomсat should start under Java 8.
I use DSpace 6.3, Apache Tomcat/9.0.41, CentOS release 8.3.2011

javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created

Got below exceptions, when I tried to run my web application using tomcat(on server start up).[upgraded java 7 to java 8 and tomcat 7 to 8.5]
Jar used: xercesImpl-2.11.0.jar
SEVERE: Critical error during deployment:
javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created
at javax.xml.validation.SchemaFactoryFinder.findServiceProvider(SchemaFactoryFinder.java:414)
at javax.xml.validation.SchemaFactoryFinder._newFactory(SchemaFactoryFinder.java:218)
at javax.xml.validation.SchemaFactoryFinder.newFactory(SchemaFactoryFinder.java:145)
at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:213)
at com.sun.faces.util.Util.createSchemaFactory(Util.java:237)
at com.sun.faces.config.DbfFactory.initStatics(DbfFactory.java:247)
at com.sun.faces.config.DbfFactory.(DbfFactory.java:209)
at com.sun.faces.config.ConfigManager$ParseTask.(ConfigManager.java:892)
at config.ConfigManager.getConfigDocuments(ConfigManager.java:652)
at nfig.ConfigManager.initialize(ConfigManager.java:324)
at ConfigureListener.contextInitialized(ConfigureListener.java:223)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1842)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.ServiceConfigurationError: javax.xml.validation.SchemaFactory: jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat8.5/lib/wlfullclient.jar!/META-INF/services/javax.xml.validation.SchemaFactory:1: Illegal provider-class name: http://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.fail(ServiceLoader.java:245)
at java.util.ServiceLoader.parseLine(ServiceLoader.java:272)
at java.util.ServiceLoader.parse(ServiceLoader.java:307)
at java.util.ServiceLoader.access$200(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:357)
at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
at javax.xml.validation.SchemaFactoryFinder$2.run(SchemaFactoryFinder.java:403)
at javax.xml.validation.SchemaFactoryFinder$2.run(SchemaFactoryFinder.java:399)
at java.security.AccessController.doPrivileged(Native Method)
at
Took wlfullclient.jar from my QA server and placed same in local upgraded tomcat.
When I compared I found QA's wlfullclient.jar size was much bigger than what I had in my local tomcat. Then I thought lets try it out with this. and that worked.
Thanks

Error in tomcat in creation of web service

I created simple addition of two number web services by using bottom up approach by using Axis 2 in eclipse juno.Web services working correctly and properly tested by soa client mozilla extension but there is error in tomcat.Please go through below error
he Calculator service, which is not valid, caused
java.lang.NoClassDefFoundError: javax/ws/rs/Produces
at org.apache.axis2.jaxrs.JAXRSUtils.getClassModel(JAXRSUtils.java:53)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:272)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:468)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:388)
at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:101)
at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:178)
at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:82)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:142)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:283)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:744)
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.Produces
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
... 30 more
[INFO] org.apache.axis2.deployment.DeploymentException: java.lang.NoClassDefFoundError: javax/ws/rs/Produces
[INFO] Deploying Web service: version.aar - file:/M:/mahesh/work/javaws1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Calc/WEB-INF/services/version.aar
[WARN] No transportReceiver for org.apache.axis2.transport.http.AxisServletListener found. An instance for HTTP will be configured automatically. Please update your axis2.xml file!
Tomcat is just a servlet container and AFAIK, it does not support any kind of webservices by default.
You have to have the required libraries in your WEB-INF/lib or add it to tomcat lib folder and make use of it.
you are getting ClassNotFoundException as javax/ws/rs/Produces is not found in the classpath.
Deploy the REST implementation (Ex: Jersey) to server lib and restart your server.
Try removing annotations in your Axis2 service class. In our case, removing #Deprecated solved the error.

How to use catalina.jar

I'm using websocket function of tomcat 7.0.39, so I have to include catalina.jar into my classpath. But when I deploy my project, if I deploy the jar files into WEB-INF/lib, I get the following exception:
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
and when catalina.jar is not deployed, I get ClassNotFoundException:
java.lang.ClassNotFoundException: org.apache.catalina.websocket.MessageInbound
Someone please help me.
StackTrace:
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:802)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1057)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:604)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1759)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2915)
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:819)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
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:1543)
at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1694)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1197)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:882)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:317)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5081)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
The web socket support in 7.0.x is experiemental (and will soon be deprecated and replaced with a port of the JSR 356 implementation from Tomcat 8).
A side-effect of this is that the API can and does change between point releases. Therefore, you must compile your code againt the Tomcat JARs from the Tomcat version you intend to deploy on. There errors you are seeing are an indication of a version mis-match.
There is no need to package any Tomcat JARs in your web application.
Do you really need to put the catalina.jar in your classpath. Catalina.jar should already be present in tomcat/lib directory. Tomcat class loader will load the jar from its own lib directory and hence it is the parent class loader so your classpath or application catalina.jar will not picked. Hope you will be able to resolve your problem with this information.
You are getting NoSuchMethodDefinition error, which means the jar which you are using for compiling has that method but the jar, which is loaded for execution does not have that method definition. Check with replacing the catalina.jar in tomcat/lib with the jar that you are using for compiling your code.

Tomcat Restart automatically Web Application on startup, after error

I've a big trouble on tomcat.
Before explaine, let me tell is the first time I see something like this...
I'm building an application using JPA on Hibernate, Spring 3.0 and Jersey REST Framework.
When using glassfish, everything works fine, but deployng the same application on tomcat, I registered the following error code:
GRAVE: Error deploying configuration descriptor java-zero.xml
java.lang.NoClassDefFoundError: com/sun/jersey/spi/container/servlet/ServletContainer
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2527)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4496)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
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:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
... 34 more
Then tomcat restarts the application and again, the same error. In an infinite loop.
Looks like a library conflict, but I really don't have any ideas on how to solve it...
Any suggestion is appreciated!
Ciao, Davide.
java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer suggests that you either don't have the Jersey JAR file or you've put it in the wrong place.
If it's the former, download it here and add it to Tomcat.
If it's the latter, put it and all its dependencies in either your WEB-INF/lib, server/lib for Tomcat 5.x or lib for Tomcat 6.x. (Just one, not all.)
It works with Glassfish because they've bundled it for you. Tomcat has not.
Remove all Jersey JAR from /WEB_INF/lib folder, refresh project and again paste all JARs of Jersey library into /WEB_INF/lib. Refresh project, stop server again, deploy and run.
It looks like either jersey.jar and/or jsr311-api.jar are missing from your webapp. You might check they are in the WEB-INF/lib folder.

Categories