Error Adding external jar to a Dynamic Web Project [message #1739695] |
Wed, 03 August 2016 22:48  |
Eclipse User |
|
|
|
Hello folks!
It would be so good if a kind soul helped me.
I am stuck in this: when trying to deploy a small Test Servlet to Tomcat (inside Eclipse), the console shows this message and the deployment fails:
...
03/08/2016 23:04:11 org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(D:\Dev\JavaEEProjects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\TestWeb\WEB-INF\lib\MyUtils.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Followed by:
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestWeb]]
...
Caused by: java.lang.NoClassDefFoundError: Lcom/erich/myUtils/RandomSeedGenerator;
...
Then deployment is halted.
This RandomSeedGenerator Class is actually part of the jar I am trying to include in the Project - MyUtils.jar.
Before anyone asks, this Jar is working flawlessly as I already use it in other Projects (Swing/Awt and others).
I just cannot make it work with Servlets (Dynamic Web Project) for Tomcat 7.
What I have tried so far:
- Project -> Properties -> Deployment Assembly -> Add... -> Archives from Filesystem -> Add... (select Jar file) ---- this leads to the same error as above;
- Copying the jar into the Tomcat/lib folder --- This works ok in Windows. The Servlet deploys and works, but I fail to make it work in Tomcat for Ubuntu (same error as above) and afterall what I want is a single file (the WAR) containing all the classes required by my Project in a single file;
- Dragging the jar file from File Explorer and Dropping into WebContent/WEB-INF/lib folder in Eclipse ---- this leads to the very same error as above. Actually the error I captured above was from this last attempt.
Of course, for it to be able to compile, this Jar is already added to the Build Path (Project -> Java Build Path -> Add External Jar), but this only enables to compile.
If it helps, I am using Eclipse Java EE IDE for Web Developers. Version: Luna Service Release 2 (4.4.2) Build id: 20150219-0600. The JDK I am working with is 1.6, Tomcat is version 7.
Thanks in advance...
|
|
|
Re: Error Adding external jar to a Dynamic Web Project [message #1739741 is a reply to message #1739695] |
Thu, 04 August 2016 09:20   |
Eclipse User |
|
|
|
It's best to ask on the Web Tools forum.
On 04.08.2016 14:38, Erich Lima wrote:
> Hello folks!
>
> It would be so good if a kind soul helped me.
>
> I am stuck in this: when trying to deploy a small Test Servlet to
> Tomcat (inside Eclipse), the console shows this message and the
> deployment fails:
> ..
> 03/08/2016 23:04:11 org.apache.catalina.loader.WebappClassLoaderBase
> validateJarFile
> INFO:
> validateJarFile(D:\Dev\JavaEEProjects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\TestWeb\WEB-INF\lib\MyUtils.jar)
> - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending
> class: javax/servlet/Servlet.class
>
> Followed by:
> java.util.concurrent.ExecutionException:
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/TestWeb]]
>
> ..
> Caused by: java.lang.NoClassDefFoundError:
> Lcom/erich/myUtils/RandomSeedGenerator;
> ..
> Then deployment is halted.
>
>
> This RandomSeedGenerator Class is actually part of the jar I am trying
> to include in the Project - MyUtils.jar.
>
> Before anyone asks, this Jar is working flawlessly as I already use it
> in other Projects (Swing/Awt and others).
> I just cannot make it work with Servlets (Dynamic Web Project) for
> Tomcat 7.
>
> What I have tried so far:
> - Project -> Properties -> Deployment Assembly -> Add... -> Archives
> from Filesystem -> Add... (select Jar file) ---- this leads to the
> same error as above;
> - Copying the jar into the Tomcat/lib folder --- This works ok in
> Windows. The Servlet deploys and works, but I fail to make it work in
> Tomcat for Ubuntu (same error as above) and afterall what I want is a
> single file (the WAR) containing all the classes required by my
> Project in a single file;
> - Dragging the jar file from File Explorer and Dropping into
> WebContent/WEB-INF/lib folder in Eclipse ---- this leads to the very
> same error as above. Actually the error I captured above was from this
> last attempt.
>
>
> Of course, for it to be able to compile, this Jar is already added to
> the Build Path (Project -> Java Build Path -> Add External Jar), but
> this only enables to compile.
>
> If it helps, I am using Eclipse Java EE IDE for Web Developers.
> Version: Luna Service Release 2 (4.4.2) Build id: 20150219-0600. The
> JDK I am working with is 1.6, Tomcat is version 7.
>
>
> Thanks in advance...
|
|
|
|
Powered by
FUDForum. Page generated in 0.09312 seconds