Tomcat 9 Upgrade java.lang.NoClassDefFoundError: org/apache/tomcat/util/file/ConfigurationSource - noclassdeffounderror

I have a working Tomcat 8 environment under Eclipse 4.9 IDE 2018‑09 and am trying to add a Tomcat 9 server to Eclipse for testing but upon Tomcat startup I am getting the following No Class Found error. Previously a lib tomcat-util.jar was needed but that doesn't seem to exist with Tomcat 9. Any help would be appreciated.
java.lang.NoClassDefFoundError: org/apache/tomcat/util/file/ConfigurationSource
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:264)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:461)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.file.ConfigurationSource
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more

So it looks like I might have had a bad download from a Tomcat mirror. I re-downloaded version 9.0.14 from the tomcat archive and it works fine now. The ConfigurationSource class is in the tomcat-util.jar and the jar was missing from the download.
Tomcat 9.0.14 archive download

Related

Getting "Class Not Found" error while trying to set up a new JUNIT class in Eclipse

While setting up a JUNIT class for a uni project I keep getting the following error (working in Eclipse Oxygen):
Class not found UnitTest
java.lang.ClassNotFoundException: UnitTest
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)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:688)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Cant really figure out whats going on, already tried a few question-related answers like clean up the project and checking that the test is running from my project/bin folder.

Starting wso2 enterprise integrator server from EI Tool

I'm starting a new project with Enterprise Integrator 6.0 and so far I'm unable to start a server from within the eclipse distribution that comes with the EI Tool.
When I was working with ESB, I used to create a server and create a Runtime environment pointing the CARBON_HOME variable to <ESB_INTALLATION_DIR>/bin, but if I do the same with Enterprise Integrator I get the following error:
Configuration error
java.io.FileNotFoundException: C:\Users\...\wso2ei-6.0.0\repository\conf\etc\logging-bridge.properties (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:466)
at org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:311)
at java.util.logging.LogManager$3.run(Unknown Source)
at java.util.logging.LogManager$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(Unknown Source)
at java.util.logging.LogManager.access$800(Unknown Source)
at java.util.logging.LogManager$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.ensureLogManagerInitialized(Unknown Source)
at java.util.logging.LogManager.getLogManager(Unknown Source)
at java.util.logging.Logger.demandLogger(Unknown Source)
at java.util.logging.Logger.getLogger(Unknown Source)
at com.sun.jmx.remote.util.ClassLogger.<init>(Unknown Source)
at sun.management.jmxremote.ConnectorBootstrap.<clinit>(Unknown Source)
at sun.management.Agent.startLocalManagementAgent(Unknown Source)
at sun.management.Agent.startAgent(Unknown Source)
at sun.management.Agent.startAgent(Unknown Source)
java.lang.ClassNotFoundException: org.wso2.carbon.server.Main
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.wso2.carbon.bootstrap.Bootstrap.loadClass(Bootstrap.java:59)
at org.wso2.carbon.bootstrap.Bootstrap.main(Bootstrap.java:45)
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
I'm able to start the EI server from the console, but in the long run it would be way easier to work directly from eclipse. Can anyone shed a light on how to do this configuration?
I'm running on java jdk 1.8.0_25, windows 10.
So apparently the default arguments used by eclipse in the launch configuration was all wrong.It was using the file structure for ESB projects, and that's what caused the FileNotFoundException.For example, the default server configuration would have something like
-Dconf.location="<CARBON_HOME>/repository/conf"
When it should be:
-Dconf.location="<CARBON_HOME>\conf"
I found this after some digging with the integrator.bat script. Information about the configuration differences between ESB and EI can be found here.
-EDIT-
It seems these problems are going o be fixed in the next release

Could not find main class : Program will exit

I was messing with the JRE setup on Eclipse. Originally the project was set to 1.6 and when set to 1.7, my program started showing a lot of errors. So when i switched back to 1.6, all the compile time errors vanished but i have a new problem now.
This was shown on the console when i tried to run the started class containing the main function. The .class files all exist. Please advice.
java.lang.UnsupportedClassVersionError: Demo : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(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)
Exception in thread "main"
Version 51.0 means the are still class files compiled with Java 7. This files wont run with a JRE 6. You have to recompile them first (Rebuild project or clean compile using ant/maven).
Check if java versions match in your Java Build path and Java Compiler in Project properties. I think you compiled with 1.6 and is trying to run with java 1.7

Eclipse WAS V7.0 Dev Tools wsimport error

I'm trying to generate a "Top down EJB Web Service" implementation from a WSDL with WAS V7.0 Developer Tools. (Server runtime WAS 7.0, web service runtime IBM WebSphere JAX-WS.) After selecting my EJB and EAR projects and specifying further options, I always get the following error, regardless of my options:
Errors occurred during wsimport.
java.lang.NoClassDefFoundError: com/sun/tools/internal/ws/wscompile/WsimportTool
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(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 java.lang.ClassLoader.loadClass(Unknown Source)
at com.ibm.ast.ws.jaxws.emitter.jdk6.command.AbstractEmitterCommand.loadClass(AbstractEmitterCommand.java:166)
at com.ibm.ast.ws.jaxws.emitter.jdk6.command.WsImportCommand.execute(WsImportCommand.java:113)
at com.ibm.ast.ws.jaxws.emitter.command.WsImportCommand.execute(WsImportCommand.java:81)
at com.ibm.ast.ws.jaxws.creation.command.WsimportNonUIThreadCommand$RunCmdInNonUIThread.run(WsimportNonUIThreadCommand.java:284)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.internal.ws.wscompile.WsimportTool
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 java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
Going through the exact same steps in Rational Application Developer 7.5.1, I can successfully generate an EJB web service implementation with an HTTP router module for my WSDL. So I think this problem might be related to WAS Developer Tools.
Do you guys have any idea why I'm getting this error? Any help would be much appreciated.
Thank you,
Csaba
Make sure you are using the WAS 7.0 JVM when you run the wsimport. You may have several JVMs on your workstation. The JVM under <was install>/java is the one you want in your PATH ahead of all others when using the command.
It wasn't enough to configure Eclipse to use IBM's SDK for projects, I had to start Eclipse using IBM's JVM. I've edited eclipse's config file (eclipse.ini) and added IBM's JRE.
openFile
-vm
...\IBM\WebSphere7\AppServer\java\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
...
Reference

java.lang.NoClassDefFoundError while running JUnit

Hi i am getting this error please help me out, thanks
java.lang.NoClassDefFoundError: com/ge/energy/wp/core/exception/WPException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class`enter code here`.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at org.junit.internal.requests.ClassRequest.hasSuiteMethod(ClassRequest.java:62)
at org.junit.internal.requests.ClassRequest.getRunnerClass(ClassRequest.java:50)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:28)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: com.ge.energy.wp.core.exception.WPException
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 15 more
try adding source folder to your classpath. If you use eclipse, right click test file and select Run configuration under Junit test and select classpath and add your source folders to class path.
Check class WPException. Usually your IDE should show you if something is wrong with the java file but not with the class file - either it wasn't compiled or missing (the error is triggered when the JVM can't find the class) for some other reason, one of them could be, like bluelabel mentioned, a problem with the PATH.
I know this is old post...but may help someone else...
whenever I have faced this issue only problem have been the java version eclipse is defaulted to - which is the eclipse jre.
Fix - change to the proper jre installed on your machine !