Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.runtime.ELContextImpl

One situation for *some* jetty jars in the WEB-INF/lib is for jetty-servlets (some useful generic servlet utils and filters) and jetty-websockets (for enabling WebSocketServlet support in jetty).

I have personally come across this exact exception in my travels.
The most common scenario was from from bad linux packaging of jetty.
Make sure you are using the standard distribution of jetty.

The second scenario was from bad/duplicate dependencies.
Looking at your list of jars, i see the following problems (and that's just by the filenames of the jars.  many of those jars I do not know the contents of, so the following critique is not to be viewed as complete)

(Conflict) you have two different servlet-api class versions.
javax.servlet-3.0.0.v201112011016.jar
servlet-api-2.4.jar

(Conflict) you have two different log4j class versions.
log4j-1.2.16.jar
log4j-1.2.17.jar

(Conflict) you have 3 different stax-api class versions.
geronimo-stax-api_1.0_spec-1.0.1.jar
stax-api-1.0-2.jar
stax-api-1.0.1.jar

(Conflict) you have mismatched jetty versions.
If you are going to use jetty-servlets or jetty-websockets, be sure that all of your
jetty classes are at the same version as each other.
If you are using jetty-websocket, then ensure you have the same version as the container you are deployed into.

(Conflict) you have 2 different versions of mysql-connector
mysql-connector-java-5.1.13.jar
mysql-connector-java-5.1.16-bin.jar

(Conflict) you have 2 ssj jars
ssj-2.5.jar
ssj.jar

(Conflict) you have 2 activation jars
activation-1.1.jar
geronimo-activation_1.0.2_spec-1.1.jar

(Redundant) you are using JDK 1.6+ and have xercesImpl.jar
There is no reason to have that jar in your WEB-INF/lib, xerces is built into the JVM.

I would recommend that you solve your dependencies issues in /WEB-INF/lib/ first.
Be sure you have no conflicts with the classes present in all of the jars (not just the jars / jar filenames themselves).
The size of many of those jars (like ssj-2.5.jar, ssj.jar, jersey-bundle) can indicate that you have big aggregate jars that include many overlapping classes (and resources) that are being handled by other jars in your WEB-INF/lib.

And then fix your logging setup, you have 3 active logging frameworks, consolidate, use slf4j to route them all to slf4j, and pick one to write/append to.  Right now you have commons-logging, java.util.logging (jackson, mail, jersey, geronimo jars use it), log4j, and slf4j all active, and your use of slf4j is slf4j-simple (which has no such routing)

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
www.webtide.com
Developer advice, services and support
from the Jetty & CometD experts.



On Fri, Sep 14, 2012 at 5:47 AM, Alajrami, Sami <sami.alajrami@xxxxxx> wrote:

Hi ,

I have a web service application (WTP project) on eclipse and it contains JSP pages. I deploy this application by exporting WAR file into /webapp/ directory and run the jetty server normally on my machine and everything works fine. When I deploy the same WAR on another machine (server) I get the following exception whenever I go to a JSP page (e.g. index.jsp):

 

org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.runtime.ELContextImpl

 

org.apache.jasper.runtime.ElContextImpl is found in /lib/jsp/ in the jetty directory, but I have no idea where the other class is coming from. I found tomcat jars in the build path of the project as I was deploying on tomcat before and removed them but still getting the same exception.

 

Full exception trace can be found in this question on StackOverflow

http://stackoverflow.com/questions/12384779/org-apache-jasper-el-elcontextimpl-cannot-be-cast-to-org-apache-jasper-runtime-e

 

and all libraries in the /lib/WEB-INF/ folder can be found in another question

http://stackoverflow.com/questions/12407105/jars-shipped-in-war-conflicting-with-jetty/12409781#comment16679501_12409781

 

I copied the contents of the /lib/ WEB_INF folder from a previous maven project. These jars were put there by maven, and I created a new WTP project to get rid of maven and just copied all jars.

 

I also don’t understand why jetty-*.jar files are the lib/WEB_INF/ directory as these jars are in the jetty /lib folder, if I remove them and deploy locally on my machine I get exceptions about missing classes from these jars.

 

On my local machine I have jetty 8.1.5 and jdk 1.7, while on the server jetty 8.1.3 and jdk 1.7.

 

Any thoughts about this problem?

 

Kind Regards,

Sami


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top