• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NoClassDefFoundError: javax/el/ValueExpression

 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on spring 3 application.

JSP code in one of my jsp is given below

code in include.jsp is given below


When above given code is getting invoked, I am getting below given error


I have jstl-1.2.jar in the lib directory of my appliction.

need suggestion to resolve this error
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with the JSTL. The EL is built right into JSP.

You are using a JSP 2.1 container?
 
Stefan Evans
Bartender
Posts: 1784
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What else do you have in your WEB-INF/lib directory?

You wouldn't have a jsp-api or servlet-api there would you?
Any libraries that declare the base servlet classes included in the WEB-INF directory can seriously mess with your running application.
Those classes are always meant to be provided by the server.
This sort of error occurs when someone puts a newer/upgraded API in their WEB-INF/lib that doesn't match with the rest of the server.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Evans wrote:Any libraries that declare the base servlet classes included in the WEB-INF directory can seriously mess with your running application.

Quoted for emphasis.

This can cause no end of weird and hard-to-debug problems.
 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:This has nothing to do with the JSTL. The EL is built right into JSP.

You are using a JSP 2.1 container?


Yes, I now have jsp-api-2.1.jar file in the lib directory of my application. But still I am facing the same problem.

Thanks for your reply. Please let me know if I am missing something.

Regards,
Brij
 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Evans wrote:What else do you have in your WEB-INF/lib directory?

You wouldn't have a jsp-api or servlet-api there would you?
Any libraries that declare the base servlet classes included in the WEB-INF directory can seriously mess with your running application.
Those classes are always meant to be provided by the server.
This sort of error occurs when someone puts a newer/upgraded API in their WEB-INF/lib that doesn't match with the rest of the server.

Thanks for replying Evans.

I am having servlet-api.jar and jsp-api-2.1.jar files in the lib directory of my application.

Regards,
Brij
 
Stefan Evans
Bartender
Posts: 1784
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to make it abundantly clear. Delete those files from your WEB-INF/lib directory.
They do not belong there.

Deleting these files should resolve your problem.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Evans wrote:Just to make it abundantly clear. Delete those files from your WEB-INF/lib directory.
They do not belong there.

Deleting these files should resolve your problem.


Quoting again for emphasis. REMOVE those jar files form the WEB-INF/lib and never ever ever put them there. Ever!
 
mohana krishna
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May i know the reason why these jar files should not be keep inside WEB-INF/lib folder.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because they are automatically provided by the container (Tomcat, resin, Weblogic, etc).
 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If I remove servlet-api.jar from the lib directory of my appliation, then my controller class is not getting compiled.

Error which I am getting is

I think, this implies that container is not providing this jar file.
Can you please put some light to it.

Regards,
Brij
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is this message from?
Are you compiling on the command line?
In an IDE? Which?
Running a JSP page to get this error?


If you take a look in your server's lib directory you will see jsp-api and servlet-api there.
These are the libraries you need to include in your classpath when you compile your web application.

If doing it from the command line, you need to add those libraries into your classpath.
If doing it in an IDE, you can
- add the jar file from the server's lib directory to your project dependencies (not your WEB-INF/lib folder)
- most IDEs allows specifying of the server, and automatically import the required libraries.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container has nothing at all to do with compiling. I've moved this to the IDEs forum as it's clear this is an IDE setup issue and not a true JSP question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic