facebook

Bad class file – revisited

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #235130 Reply

    anneliu
    Member

    I am getting the same errors as Franck did in the following post (http://myeclipseide.com/PNphpBB2+file-viewtopic-t-4681.html)

    I am getting a mixure of the following errors in my JSPs
    – cannot access javax.servlet.Servlet: file javax\servlet\Servlet.class not found. NOTE: No JSP line number was avaliable so line 1 was used for the marker. index.jsp
    – cannot resolve symbol: symbol : class HttpServletResponse. NOTE: No JSP line number was avaliable so line 1 was used for the marker. index.jsp
    – package javax.servlet.http does not exist: import javax.servlet.http.*;. NOTE: No JSP line number was avaliable so line 1 was used for the marker. index.jsp

    I know my classpath is correct since my Struts Action classes compile correctly, and when I run my application in Tomcat the JSP pages display fine and are recompiled correctly.

    I have tried using a variety of JVMs to start eclipse (1.4.2_06, jre 1.4.2_06, 1.5.0_02, IBM J2RE 1.4.1), but each time I get the same errors.

    Any help would be much appreciated!

    >>What operating system and version are you running?
    Windows 2000 5.00.2195 SP4

    >>What Eclipse version and build id are you using? (Help > About Eclipse Platform)
    Version: 3.1.0
    Build id: I20050627-1435

    Was Eclipse freshly installed for MyEclipse?
    >> Yes

    Are any other external plugins installed?
    >> Only one, Nitrox JSP

    How many plugins in the <eclipse>/plugins directory are like org.eclipse.pde.*
    >> 4

    What MyEclipse version are you using? (Help > About Eclipse Platform > Features)
    >> Version: 3.9.210

    What JDK version are you using to run Eclipse? (java -version)
    >> 1.4.2_06

    What JDK version are you using to launch your application server?
    >> tried 1.4.2_06, jre 1.4.2_06, 1.5.0_02, IBM J2RE 1.4.1

    What steps did you take that resulted in the issue?
    >> tried the different JVMs listed above

    What application server are you using?
    >> Tomcat 5.0.28

    Are there any exceptions in the Eclipse log file? (<workspace>/.metadata/.log)
    >> nope

    System properties

    *** Date: Wed Aug 17 11:26:43 CDT 2005
    
    *** Platform Details:
    
    *** System properties:
    awt.toolkit=sun.awt.windows.WToolkit
    eclipse.application=org.eclipse.ui.ide.workbench
    eclipse.buildId=I20050627-1435
    eclipse.commands=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    880_3c4
    -vm
    C:\j2sdk1.4.2_06\bin\javaw.exe
    eclipse.product=org.eclipse.sdk.ide
    eclipse.startTime=1124295676496
    eclipse.vm=C:\j2sdk1.4.2_06\bin\javaw.exe
    eclipse.vmargs=-Xms40m
    -Xmx256m
    -jar
    C:\eclipse\startup.jar
    eof=eof
    file.encoding=Cp1252
    file.encoding.pkg=sun.io
    file.separator=\
    java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
    java.awt.printerjob=sun.awt.windows.WPrinterJob
    java.class.path=C:\eclipse\startup.jar
    java.class.version=48.0
    java.endorsed.dirs=C:\j2sdk1.4.2_06\jre\lib\endorsed
    java.ext.dirs=C:\j2sdk1.4.2_06\jre\lib\ext
    java.home=C:\j2sdk1.4.2_06\jre
    java.io.tmpdir=c:\temp\
    java.library.path=C:\j2sdk1.4.2_06\bin;.;C:\WINNT\system32;C:\WINNT;C:\j2re1.4.2_06\bin;c:\PROGRA~1\COMPUW~1\DEVPAR~1\bin\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\DevTools\CVS;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;c:\Program Files\Common Files\Compuware\;c:\Program Files\Compuware\DevPartner Java Edition\bin;C:\workspace\TWC-BUILD\lib\ant\bin;C:\DevTools\jwsdp-1.3\jwsdp-shared\bin;C:\devtools\tomcat\jwsdp-1.3\jwsdp-shared\bin;C:\devtools\jwsdp-1.3\jwsdp-shared\bin;C:\Program Files\ESTsoft\ALZip\
    java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
    java.runtime.version=1.4.2_06-b03
    java.specification.name=Java Platform API Specification
    java.specification.vendor=Sun Microsystems Inc.
    java.specification.version=1.4
    java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory
    java.vendor=Sun Microsystems Inc.
    java.vendor.url=http://java.sun.com/
    java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
    java.version=1.4.2_06
    java.vm.info=mixed mode
    java.vm.name=Java HotSpot(TM) Client VM
    java.vm.specification.name=Java Virtual Machine Specification
    java.vm.specification.vendor=Sun Microsystems Inc.
    java.vm.specification.version=1.0
    java.vm.vendor=Sun Microsystems Inc.
    java.vm.version=1.4.2_06-b03
    line.separator=
    #235156

    Riyad Kalla
    Member

    I know my classpath is correct since my Struts Action classes compile correctly, and when I run my application in Tomcat the JSP pages display fine and are recompiled correctly.

    Actually the missing class exceptions you are getting aren’t needed to compile Struts classes and your App server ships the required libs so you wouldn’t notice the problem there either. Your build path is the problem. Check your Project Properties > Java Build Path > Libraries settings, do you have a J2EE library in your build path? If you expand it are there any error markers?

    Try and add servlet-api.jar and jsp-api.jar from your <Tomcat>\common\lib directory.

    #235215

    anneliu
    Member

    Thanks for your quick response; however I’m still getting the same errors.

    I oringally had the JBoss libraries that shipped with MyEclipse, “J2EE 1.4 Library Set”, in my classpath (with no errors reported when I expanded it). I have now removed those and added the Tomcat jsp-api.jar and servlet-api.jar. I still get the same problems being reported.

    Anything else I can try? Or, is there a way to supress these errors?

    #235226

    Riyad Kalla
    Member

    1) Are you sure your using our JSP editor? (Right click on your JSP files, Open With > MyEclipse JSP Editor)

    2) What kind of project is this? If you open your project properties and go to MyEclipse-Web, what values do you ahve typed in here?

    3) Please list every JAR in your Library build path. Including the JARs that are part of the Libraries that are added to your build path. This error is very straight forward, it’s confusing me why it’s being so elusive, this has got to be somethign simple.

    4) Try and restart MyEclipse with the -clean option.

    #235245

    anneliu
    Member

    I finally fixed it after adding a j2ee.jar file into my classpath. I don’t understand why, since all the files it was complaining about was found in the servlet-api.jar. I just removed it and it’s still working.

    Thanks for all our help! It was much appreciated!

    #235248

    Riyad Kalla
    Member

    I agree with you that is strange, but I am glad you got it working.

    #237237

    jakegage
    Member

    Perhaps this is of interest. I was able to compile one of my projects by including the relevant JARs in the Java Build Path when I was compiling projects under Java 1.4.x for deployment into a Tomcat 4.x server; but I’ve recently tried to compile the project (same release of MyEclipse and Eclipse as above) into Tomcat 5.5 (again, referencing the servlet-api.jar), and now get exactly the errors described in the original post.

    I’m really leary to include the j2ee.jar. Is there someplace I should start tracing this down?

    Thanks much,
    Jake

    #237238

    Riyad Kalla
    Member

    Jake,
    Try this:
    Remove the J2EE library set from your build path, instead go add the servlet-api.jar and jsp-api.jar files from your Tomcat install under the common/lib dir, now rebuild your project. Did that work?

    #237239

    jakegage
    Member

    Sorry to follow up again, but perhaps the most remarkable thing about the above errors (and perhaps Franck can say whether this was the case for him, as well): the .java source classes make many references to the javax.servlet packages, and the act of adding servlet-api.jar to the “Java Build Path” does make these errors disappear from the “Problems” list… it just doesn’t make the JSP errors go away.

    Jake

    #237243

    Riyad Kalla
    Member

    Jake please be specific, what are the errors exactly you are getting? (copy paste the text i fyou can)

    #237244

    jakegage
    Member

    Hey guys,

    Wow. Thanks for the quick response, by the way: I didn’t even see it before I posted my little follow-up message.

    I didn’t add the j2ee library to my build path, as per the instructions above: I actually had the servlet-api.jar added from Tomcat (notably not the jsp-api.jar, though… should that be there, as well?).

    I was, however, able to make the errors in the Problem list go away by “Removing all Validation Markers” under the MyEclipse menu for the project, and a when I re-ran validation, the only error I get is one I’ve had before (File not found: “/home/jake/workspace/Pillar/etc/log4j.dtd (No such file or directory)”: I haven’t been able to find a satisfactory solution to referencing log4j DTDs).

    …which is interesting. I wonder if there’s a little glitch in the validation code. Anyhow, if anybody else sees this problem, I’d suggest this workaround.

    Does anybody know if there’s an open thread about referencing log4j DTDs, by the way?

    Jake

    #237245

    jakegage
    Member

    The errors I was getting were exactly those mentioned in the original post:

    – cannot access javax.servlet.Servlet: file javax\servlet\Servlet.class not found. NOTE: No JSP line number was avaliable so line 1 was used for the marker. index.jsp
    – cannot resolve symbol: symbol : class HttpServletResponse. NOTE: No JSP line number was avaliable so line 1 was used for the marker. index.jsp
    – package javax.servlet.http does not exist: import javax.servlet.http.*;. NOTE: No JSP line number was avaliable so line 1 was used for the marker. index.jsp

    Jake

    #237247

    Riyad Kalla
    Member

    Can you open up your Project Properties, go to Java Build Path, and then read everything you have listed under Projects as well as Libraries tab? (full JAR and Library names please, you don’t need to list the items in Libraries just yet, just give the name of the library). Thank you for your help in this matter, it looks to be a simple classpath issue, that’s why I want to get to the bottom of it fast so you can get back to work without issues.

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Bad class file – revisited

You must be logged in to post in the forum log in