• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Running struts examples

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I downloaded and installed struts 1.2.9 into my computer, then copied struts webapps WAR files into tomcat_home/webapps folder, and they were deployed by the server, but when I run struts-blank and struts-mailreader, I got the following exception:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagExtraInfo
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
java.net.URLClassLoader$1.run(URLClassLoader.java:195)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
java.lang.ClassLoader.loadClass(ClassLoader.java:299)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
java.lang.ClassLoader.loadClass(ClassLoader.java:251)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1267)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:419)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:248)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:162)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

and here is my classpath:
CLASSPATH = C:\Tomcat\bin;C:\Program Files\Java\jdk1.5.0_06\bin; C:\Tomcat\common\lib\servlet-api.jar; C:\mysql-connector-java-3.1.12\mysql-connector-java-3.1.12-bin.jar;C:\struts\lib\struts.jar

and all struts jar files are in the WEB-INF/lib folder of each webapps. Any jar files I should add to the classpath? Tnank you in advance for any advises.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class identified in the error message is in jsp-api.jar, so this needs to be in your classpath. If you're using the default Tomcat configuration, this should already be in the classpath while you're running Tomcat.

Also, it's not a good idea to have struts.jar in your CLASSPATH variable. It's much better to have it in the /lib directory of the application. This is explained in this link.
 
Phoebe Song
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added C:\Tomcat\common\lib\jsp-api.jar to the class path, but got the same result.

then I cross this thread,
https://coderanch.com/t/47161/Struts/java-lang-NoClassDefFoundError-javax-servlet

don't know if I should add j2ee.jar in class path or not. If so, I didn't find it in jdk1.5, where can I get it?
 
Phoebe Song
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, I deleted struts.jar in class path, and I'm using Tomcat 5.5.16 and struts 1.2.9, and port number is 8000.
[ April 27, 2006: Message edited by: Phoebe Song ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While you're running Tomcat, your classpath is determined by what's in the conf/catalina.properties file.

You should have a line that looks like this:

common.loader=${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar

You will notice the last entry loads all jar files in the common/lib directory. By default, this directory contains both the servlet-api.jar file and the jsp-api.jar file.

Make sure that your catalina.properties file has similar entries.
 
Phoebe Song
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same entries like yours. Here are the jar files in common/lib folder:
commons-el,japer-compiler,jsper-compiler-jdt,jsper-runtime,jsp-api,naming-factory,naming-factory-dbcp,naming-resources, servlet-api.

However, when I start Tomcat server, I got a "Tomcat Native library not found in java.library.path" error message, don't know have anything to do with the exception problem or not.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic