jars shipped in war conflicting with jetty [duplicate] - java

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.runtime.ELContextImpl
I export a web service project (contains jsp pages) from Eclipse in a war file and deploy it in Jetty 8.1.5. It works fine on my machine. But after deploying the same war file on Jetty 8.1.3 on another machine (windows server 2003) it gives HTTP Error 500 and the following exception when I go to the index.jsp page:
org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.runtime.ELContextImpl
the full trace and more details in this question which I posted two days ago. while all the jars that I have in WEB_INF/lib are provided in these two screenshots:
two days of looking around the internet for a solution resulted in knowing that the problem is caused by conflicts between the jars shipped in the war file and other jars (I guess the jetty jars).
The question is: how can I find out which jar is causing the problem? I tried browsing the contents of these jars looking for the class ElContextImpl but did not find anything ?
Any thoughts?
EDIT:
I tried copying my local whole Jetty 8.1.5 into the server and statrted jetty from there.. but still no success.

Your WAR file contains some unnecessary JARs like servlet-api-2.4.jar which should be part of the Jetty installation (maybe in another version).
At first sight you should remove all jetty-*.jar, servlet-api-2.4.jar, javax.servlet.*.jar. If you have taken these from your 8.1.5 Jetty installation then it could cause conflicts with your 8.1.3 installation.

Related

Exception java.lang.NoClassDefFoundError JavaMail Tomcat v8.5 [duplicate]

This question already has answers here:
How do I resolve ClassNotFoundException?
(28 answers)
Closed 2 years ago.
I'am trying to send an automatic email with JavaMail on Oracle. I added external JARs on Java Build Path (mail.jar and activation.jar). I don't know what I'm doing wrong because I get this error message:
java.lang.ClassNotFoundException: javax.mail.internet.AddressException
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
I'm using Tomcat v8.5.
You should add Javax mail dependency to make it work.
You need to add the JavaMail library Jars either to the Tomcat lib folder, or it has to be part of your WAR file when you deploy your WebApp. Adding it to the Build Path makes it only available during compile time. Although, depending on the configuration for the Deployment, it could be deployed, too – but obviously, not in your case.

Deploying multiple release .jar on Oracle WebLogic Server

We are trying to deploy a web service (a .war file) onto an Oracle WebLogic 12.2.1.0.0 Server.
The .war contains some third party .jars, for example log4j-api-2.12.0.jar, that are multiple release .jars (per JEP 238, having Multi-Release: true in MANIFEST.MF).
As such, it includes some Java 9 compiled classes in the META-INF/versions/9 directory. WebLogic 12.2 uses Java 8 only (confirmed version as Java 1.8.0_92 via WebLogic Admin Console).
As I understand it, Java 8 servers are supposed to not see / ignore any classes under the META-INF/versions directory, but this does not seem to be happening. It appears as though Oracle WLS is just scanning the whole .war.
As a result, when we try to deploy the .war, we get errors like this one:
BEA-160248 Unable to parse class file:... (then a long path name into the META-INF/versions/9 directory)
Is there something special we need to do to make this work? I'll accept anything along the lines of:
Configure WLS somehow to ignore the META-INF/versions/9 classes
Configure Maven to somehow build the .war without the META-INF/versions/9 classes that are present in the third-party .jars.
I'm not interested in answers involving manually deleting anything from the .war every time it is built. Also, I'm not sure I can downgrade to earlier versions of the 3rd party .jars at this point. Log4j2, probably could... but there are others.
Thanks!
JEP 238 is from Java 9 and WebLogic Server does not run with Java 9.
After looking into it further, the
BEA-160248 Unable to parse class file...
messages were a red herring. After solving other, unrelated problems, the application does deploy and work as needed, in spite of these error messages appearing in the log.
I would like to add that according to Doc ID 2629550.1:
This message is harmless and can be ignored.

How to correct eclipse tomcat server error [duplicate]

This question already has answers here:
Multiple contexts with the same path error running web service in Eclipse using Tomcat
(24 answers)
Closed 4 years ago.
I got following error when I tried to run a project on eclipse. Can someone please explain what can be done to resolve it.
Could not publish server configuration for Tomcat v7.0 Server at localhost.
Multiple Contexts have a path of "/CityHotel".
Multiple Contexts have a path of "/OOPEmployeeWebApp".
Possibly you have a context configured in Eclipse and a WAR file deployed in the Tomcat webapps directory, both with the same name.
check your tomcat folder and /conf and server.xml, and remove the duplicated contexts
It should be a configuration problem, might be you need some server specific configs you didnt set, thus it is throwing the error.
It could also be an actual duplication error, in which case check all class paths for duplications.

ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer

I downloaded Eclipse Luna and Tomcat 8.0.24 some months ago but I started using it. I've been creating a web app without Maven. I downloaded manually Jersey 2.23, Jersey media moxy 2.23, java-son 1.0 , jdbc mysql 5.x and sql2o 1.5.4. I'm starting to learn Angular and I successfully created one page without any issue.
I remember have added my jars manually in the Build Path of my project and I was forced to add them in the Deployment Assemblies also. Fine.
Since 2 weeks I didn't shutdown my laptop, just in sleep mode. But yesterday I did shutdown. Since then I suffered to make it work again. I use postman chrome to test my restful services and I received after the shutting down the 404 error.
I realized that I started to see the exception in the console:
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
I deleted my folders of tomcat and eclipse to start again from scratch desperately. However, I got the same issue. The last thing that I remember I was playing with, were these modified options.
Double click in server from servers tab
Change from Use workspace metadata to Use Tomcat installation
Properties in Server
Switch Location from metadata to localhost.server
It was thanks to these questions that I solved my issue:
org.glassfish.jersey.servlet.ServletContainer ClassNotFoundException
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
Now, after "reinstalling" eclipse and tomcat, when I add the jars in the library tab, they are now added in deployment assemblies automatically. (Surprised)
According to the previous attached questions, I added all the jars in WEB-INF/lib from my workspace as also in the tomcat/wtpwebapps/myproject/WEB-INF/lib. If I don't do this, I won't be able to make it work. Postman finally gives me the desired output.
Nevertheless, I realized when I copy the jars manually through windows explorer, the console in Eclipse displays the tomcat restarting again. BUT I still see the exception: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer. At least I can run my project in the browser or in postman without any issue. Very strange.
I want to add a new User Library in Windows > Preferences > Java > Build Path > User Libraries, but my list is EMPTY!!! So...
Finally, my questions:
What's going on with Eclipse?
Why am I not able to see my user libraries previously added?
Why do I still see the exception of glassfish.jersey in the console if I added the jars in the web-inf folder which makes it work apparently.
Why do I need to add the jars in web-inf, if when I see all the jars included in the Tomcat library all my jars are there because I forgot to mention that I added a folder called External in lib of my Tomcat folder.
For all these changes, I restarted Eclipse
Instead of adding jars manually, use maven and let the maven manage dependency of jars.
ClassNotFoundException occurs when you don't have a jar in the classpath. Maybe the package you are deploying on the server is not bundled correctly. Make sure you have jar bundled in your package or present in the classpath.
Another reason could be you have duplicate class files in two jars and the class your programme picking is not suitable.

Hot deploy fails on JBoss - "Delete method not implemented"

When I'm changing some Java source code and my server is running, hot deploy fails, giving the following error message:
"Delete method not implemented"
How can I find out the root of this evil? My project has been recently deployed, so the sources on the server should be up to date.
The project uses JSF 1.2, if that's of any use for you.
I deploy the project as an exploded war.
Won't work with a zipped war either.
It's strange that the sources of dependencies are also not resolved in the debug mode. They're correctly read from the jar in the Eclipse Java view.
if you 'touch' the file (war/ear) in the deploy directory, this should trigger the deployment cycle, is this happening?
I've already asked a similar question more than one year ago. And my answer to it solved this problem too.
Uninstall all JDKs
Install only on JDK
Configure every program (Eclipse and JBoss) to use this JDK.

Categories