This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java lang NoClassDefFoundError : javax/ servlet/ jsp/ tagext/ TagExtraInfo

 
Sudha Joish
Greenhorn
Posts: 12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi pple
i have an application written using JSPs and Servlets. my next step is to use Struts and modify it.
this is my first try at struts and tied to run my first sample application from:
http://www.javaranch.com/newsletter/Mar2002/newslettermar2002.jsp#struts
am using struts 1.0.2, Tomcat 5.0.12
this is what i did:
i placed:
-- struts.jar in the C:\Tomcat_5.0\webapps\struts\WEB-INF\lib folder
-- all .tld files in the C:\Tomcat_5.0\webapps\struts\WEB-INF folder
-- servlet-api.jar and struts.jar in C:\j2sdk1.4.2\jre\lib\ext folder
i have a LoginBean.java, LoginAction.java and LoginForm.java from the URL. i have merely compiled them and placed them along with the
MessageResources.properties file in the:
C:\Tomcat_5.0\webapps\struts\WEB-INF\classes\test\struts folder.
i have placed LoginView.jsp and MainMenu.jsp in:
C:\Tomcat_5.0\webapps\struts\jsp folder.
i have reallly followed all the instructions!!
i started Tomcat 5.0 server and when i request for:
http://127.0.0.1:8080/struts/jsp/LoginView.jsp in my browser, i get the
following error message:


And i tried out another sample frm:
http://www.reumann.net/do/struts/lesson1
its the same error again.
so, what am i missing here?
i cant start my own stuff when i cant get a sample tutorial version working!
please help.
thanks
-- $uDhA
 
Loren Rosen
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts needs a number of other non-struts java classes when it runs. You'll need most if not all of the jar files that are in your struts distribution's lib directory.
 
Sudha Joish
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply.
i shall try placing all the other jar files in the lib directory.
but the .war file that i downloaded frm the 2nd link DID indeed have all the files - when i extracted it. i wonder why even that gave me the same error!
any thoughts on that?
thanks
-- $uDhA
 
Loren Rosen
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TagExtra info is in j2ee.jar, which is part of the J2EE SDK which you can get from java.sun.com. You'll need to put it in the lib directory as well. My guess is that whoever wrote the tutorial you're trying used an appserver that already had this installed.
 
Sudha Joish
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response.
I removed the copy of struts.jar from java_home/jre/lib/ext directory.
After I did that, I get a new error now:

for the sample at
JavaRanch Tutorial
But after I did that, I could get the other sample at
Other Tutorial
working like a champ.
Thats crazy!! Any clues on that?
Thanks
-- $uDhA
 
Sudha Joish
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Missed out mentioning in the previous post:
Both tutorials are supposed to be working samples.
And the only difference I see is that the JavaRanch tutorial uses Struts 1.0.2 and the other tutorial uses Struts 1.1.
Thanks
-- $uDhA
 
Loren Rosen
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens depends on precisely how your classpath is set up. This may or may not be a simple question of what your CLASSPATH variable is set to. You're probably starting tomcat (or whatever servlet container you're using) via some startup script which may set its own classpath. Also, many containers do special things with classloaders, which can complicate matters.
Anyway, as you can see here, putting extra stuff into your java home is something to be careful about. On the whole its better to to have a jar file not be in the class path (so you get a simple error about not finding something) than to have multiple versions of it in the class path (and have confusion about which one is actually being used).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic