Stubborn ClassNotFoundException for org.apache.commons.io.output.ByteArrayOutputStream - eclipse

I have been running the same web application from within eclipse for some time, and heavily using org.apache.commons.io.output.ByteArrayOutputStream.
Out of the blue, the project is now throwing ClassNotFoundException although commons-io-2.4.jar is included in the build path and marked as exported.
This very class has been used for some time, hence the puzzle
What can I do better to make sure the class is found?
Edit: I have two servers configured Tomcat 7.0.40 and Tomcat 6.0.33
The problem only shows on Tomcat 7.
Note: The following workarounds have been attempted:
Restarting Eclipse.
Cleanup project
Remove and add back commons-io-2.4.jar
Stack Trace:
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebApp]]
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
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$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebApp]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/output/ByteArrayOutputStream
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.output.ByteArrayOutputStream
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
... 21 more

The problem has been fixed by removing the Tomcat 7.0 instance from Eclipse and and add it back
I can only guess Servers configuration can get corrupted from time to time

Related

Tomcat v9.0 server at localhost has encountered a problem-- Caused by: java.io.FileNotFoundException

I'm trying to run Tomcat v9.0 server in Eclipse with 2 jar files:
taglibs-standard-impl-1.2.5.jar
taglibs-standard-spec-1.2.5.jar
But I kept running into this error message: "Server Tomcat v9.0 Server at localhost failed to start." And error log indicates that it caused by Caused by: java.io.FileNotFoundException:C:\Users\abdc\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PM4\WEB-INF\lib\taglibs-standard-impl-1.2.5.jar (The system cannot find the path specified)
I doubled check my jar file paths and they are in the right location with the rest of the project:
C:\Users\abdc\Desktop\WebContent\WEB-INF\lib\taglibs-standard-impl-1.2.5.jar
C:\Users\abdc\Desktop\WebContent\WEB-INF\lib\taglibs-standard-spec-1.2.5.jar
Any insight would be really appreciated. This is my error logs:
Jul 11, 2020 12:39:50 AM org.apache.catalina.core.StandardContext backgroundProcess
WARNING: Exception processing loader [WebappLoader[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PM4]]] background process
java.lang.IllegalStateException: java.io.FileNotFoundException: C:\Users\abdc\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PM4\WEB-INF\lib\taglibs-standard-impl-1.2.5.jar (The system cannot find the path specified)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:101)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:256)
at org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:281)
at org.apache.catalina.webresources.Cache.getResource(Cache.java:62)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:216)
at org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225)
at org.apache.catalina.loader.WebappClassLoaderBase.modified(WebappClassLoaderBase.java:740)
at org.apache.catalina.loader.WebappLoader.modified(WebappLoader.java:350)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:294)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5527)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\abdc\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PM4\WEB-INF\lib\taglibs-standard-impl-1.2.5.jar (The system cannot find the path specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:221)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:206)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.openJarFile(AbstractArchiveResourceSet.java:307)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)
... 21 more
Jul 11, 2020 12:40:00 AM org.apache.catalina.core.StandardContext backgroundProcess
WARNING: Exception processing loader [WebappLoader[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PM4]]] background process
java.lang.IllegalStateException: java.io.FileNotFoundException: C:\Users\abdc\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PM4\WEB-INF\lib\taglibs-standard-impl-1.2.5.jar (The system cannot find the path specified)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:101)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:256)
at org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:281)
at org.apache.catalina.webresources.Cache.getResource(Cache.java:62)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:216)
at org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225)
at org.apache.catalina.loader.WebappClassLoaderBase.modified(WebappClassLoaderBase.java:740)
at org.apache.catalina.loader.WebappLoader.modified(WebappLoader.java:350)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:294)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5527)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\abdc\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PM4\WEB-INF\lib\taglibs-standard-impl-1.2.5.jar (The system cannot find the path specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:221)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:206)
at org.apache.catalina.webresources.AbstractArchiveResourceSet.openJarFile(AbstractArchiveResourceSet.java:307)
at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)
... 21 more
This is my file directory:
File directory
Wrong path,
U must paste your jar file in this path :
C:\Users\abdc\eclipse-workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PM4\WEB-INF\lib\

Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, C:\Neo4jCommunity

I'm facing a problem which blocks me. I work on a project with Neo4j Database Graphs.
My problem is when i run java application, it displays me in console :
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, C:\Neo4jCommunity
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:358)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:59)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:90)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:199)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:70)
at HelloWorld.createDataBase(HelloWorld.java:35)
at HelloWorld.main(HelloWorld.java:28)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions#1304421' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:489)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:72)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:106)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:335)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/store/Directory
at org.neo4j.kernel.api.impl.index.DirectoryFactory.<clinit>(DirectoryFactory.java:53)
at org.neo4j.kernel.api.impl.index.LuceneKernelExtensions.directoryFactory(LuceneKernelExtensions.java:36)
at org.neo4j.kernel.api.impl.index.LuceneLabelScanStoreExtension.newKernelExtension(LuceneLabelScanStoreExtension.java:71)
at org.neo4j.kernel.api.impl.index.LuceneLabelScanStoreExtension.newKernelExtension(LuceneLabelScanStoreExtension.java:39)
at org.neo4j.kernel.extension.KernelExtensions.init(KernelExtensions.java:104)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:483)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.store.Directory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
I don't know where the problem comes from, knowing that I install all NEO4j jars needed.
enter code here
Thank you all

IllegalArgumentException: The servlets named [AdminController] and [muShag.Private.controller.AdminController] are both mapped to the url-pattern [duplicate]

This question already has answers here:
java.lang.IllegalArgumentException: The servlets named [X] and [Y] are both mapped to the url-pattern [/url] which is not permitted
(7 answers)
Closed 7 years ago.
I created an application in JAVA 7 with Tomcat 7 in Eclipse Juno.It was running perfectly at that time but after some days it stopped working. now whenever i am trying to run that application it shows error as:
SEVERE: A child container failed during start java.util.concurrent.ExecutionException:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MuShag]]
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source) at
java.util.concurrent.FutureTask.get(Unknown Source) at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
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$Sync.innerRun(Unknown Source) at
java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source) Caused by:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/MuShag]]
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more Caused by: java.lang.IllegalArgumentException: The
servlets named [AdminController] and
[muShag.Private.controller.AdminController] are both mapped to the
url-pattern [/AdminController] which is not permitted at
org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
at
org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2412)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2125)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2080)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)
at
org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)
at
org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1300)
at
org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more 26 Jul, 2013 9:36:50 PM
Now how can handle these errors. after surfing too much at some place i got a way by adding commons-looging.jar, but it doesnot worked.
The error message says it all:
The servlets named [AdminController] and [muShag.Private.controller.AdminController] are both mapped to the url-pattern [/AdminController] which is not permitted.
Fix your web.xml or your annotations so that those two servlets are not mapped to the same url-pattern, or so that only one of those servlets is defined.

error while using smtp in servlets

i am getting error and even my server is not starting in eclipse.But if i remove smtp servlet from eclipse project then server starts otherwise it give exceptions and even dont start.The exceptions are:
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RobotProject]]
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
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$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)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RobotProject]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:87)
You need to export your jars with the war file that you deploy, having them during compilation does not mean that they will be available on the server. Simply copy the required jars to WEB-INF/lib folder and it should work

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

I am using jdk 1.6.31 and when i add a server (WSO2 Carbon 3.0.1 based server) in eclipse and try to start the server it gives me the following error in the console:
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.wso2.carbon.server.Main.<clinit>(Main.java:38)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
Exception in thread "main"
WSO2 Carbon 3.2 based server gets started but with this in the console:
No properties path set - looking for transactions.properties in classpath...
Using init file: /D:/naveenraj/wso2/Training%20Workouts/wso2esb-4.0.3/lib/transactions.properties
Is this a vital error?
I am new to WSO2 ESB.
I'm not sure if this could help but make sure you defined JAVA_HOME and CARBON_HOME before starting the server
Good luck
Christophe