facebook

After Eclipse3.1/MyE4.0m2 install Tomcat can’t find NewClass

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #234381 Reply

    Chris.d
    Member

    Hey all,

    I’ve been using Eclipse 3.0 and MyEclipse.. um, don’t know, for a few months until this morning when I decided I would try updating to 3.1/4.0m2. Well, several things don’t work as I’m used to but the only thing really impeding my progress is that my new class isn’t being found on the server!

    Now the file itself and it’s inner classes were deployed to the exploded directory in Tomcat – I can see them in the file explorer. At least they were deployed after I manually stopped the server, redeployed, and restarted the server (a new workflow hinderance-before that I got a different Exception). And in the calling Java file there are no errors and the import statement exists. However I put breakpoints in the calling class and the new constructor, and when it gets to the constructor call it bails and returns this message to the web browser: java.lang.NoClassDefFoundError

    Huh? I don’t consider this an improvement, guys… Though whether it is MyEclipse or Eclipse I have no clue. I’ve also tried moving the new class to a different package, and again it is deployed in the correct place but the NoClassDefFoundError continues.

    Also, in the debugger after breaking in the JSP after the above error, I hit the “GO” button and it completely freezes my computer’s UI for the 5 seconds to run down and show the error page. Yuck.

    WinXP Pro SP2
    Eclipse 3.1.0 Build id: I20050627-1435
    MyEclipse 4.0 m2 Version: 3.9.210 Build id: 20050627-4.0-Milestone-2
    TomcatServer console in Eclipse gives no feedback at all about this. Neither do the log files.

    #234394 Reply

    Scott Anderson
    Participant

    Chris,

    This might be an issue related to your install. You didn’t say what you were updating from or how you did it, for example. Can you give some details there? Also, what was the behavior of the application before you updated, that is, did the exact same thing work? Are there errors in the log file? Did you try restarting with -clean (ie. eclipse.exe -clean) to see if rebuilding the plugin cache resolves the issue?

    #234430 Reply

    Chris.d
    Member

    I did say I was at Eclipse 3.0 and a MyEclipse from just a few months ago. I also said that there was nothing in the Tomcat logs nor in the Eclipse IDE’s Console view for Tomcat about this problem. My install procedure was what I expected: download Eclipse 3.1 and run the install, then download MyEclipse 4.0m2 and run its install, then run the program and point it to my original 3.0 workspace.

    I can’t exactly say whether or not my previous workspace would behave the same way:
    1. It would load new classes to Tomcat, and it would not complain about missing classes esp. if there were no compile errors in the IDE, even if there were inner classes.
    2. However it is a brand new class I worked on after the install, so I had not tried it in the old setting.
    3. ALSO: MyEclipse 4.0m2 seems to have corrupted my old desktop shortcut so that it too only does the new Eclipse/MyEclipse, instead of just adding a new, independant shortcut for the new program(s). When deleting the new shortcut, it actually deletes the old shortcut – then on a Desktop ‘Refresh’ the new one moved to the old one’s position. Odd stuff.
    4. LASTLY, when I try using Eclipse 3.0/MyEclipse (old?), it says the workspace is in use. Eventually it started up but doesn’t know anything about my working sets or anything. So I quit that and tried 3.1/4.0m2 again, and got the same problem – says the workspace is in use. Bad news, people.

    I haven’t tried anything about -clean as I hadn’t heard of it nor do I know what plugins are involved – is MyEclipse considered a plugin?

    Thanks for poking and proding where needed,

    -Chris

    #234443 Reply

    Riyad Kalla
    Member

    download Eclipse 3.1 and run the install

    There is no install to speak of, it is a matter of unzipping an archive. What Scott is trying to make sure of is that you didn’t unzip the new Eclipse SDK ontop of the old one, and instead you unzipped it to a new location. Did you do this?

    then run the program and point it to my original 3.0 workspace.

    In this case using -clean is absolutely in order, please see this tip for help: http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-30.html#343

    3. ALSO: MyEclipse 4.0m2 seems to have corrupted my old desktop shortcut so that it too only does the new Eclipse/MyEclipse, instead of just adding a new, independant shortcut for the new program(s). When deleting the new shortcut, it actually deletes the old shortcut – then on a Desktop ‘Refresh’ the new one moved to the old one’s position. Odd stuff.

    The installer we use will simply add a new shortcut to your desktop. The shortcuts (as you’ve seen) point to your eclipse.exe executable of the respective install you installed MyEclipse against. What makes me nervous here about what you said, is that your new install somehow effected your old one.

    Are you sure you didn’t accidentally unzip Eclipse 3.1 SDK ontop of your old Eclipse 3.0 directory or do anything funky like that? You didn’t install MyEclipse 4.0m2 to the same dir as your old install did you?

    4. LASTLY, when I try using Eclipse 3.0/MyEclipse (old?), it says the workspace is in use. Eventually it started up but doesn’t know anything about my working sets or anything. So I quit that and tried 3.1/4.0m2 again, and got the same problem – says the workspace is in use. Bad news, people.

    Your workspace is the storage location of all the plugin caches and plugin information for your Eclipse install. They are *not* a simple project directory like other IDEs. Because of this switching between completely different versions of the IDE using the same workspace is not a good idea. Your plugins between the two releases are totally different, the registry information for them is different, load order is different and trying to flip between the two is not going to yield usable results.

    I haven’t tried anything about -clean as I hadn’t heard of it nor do I know what plugins are involved – is MyEclipse considered a plugin?

    -clean tells Eclipse to rebuild it’s plugin cache stored in the workspace. This is a plugin agnostic operation and applies to all the known plugins to the eclipse install.

    MyEclipse is technically an eclipse extension consisting of 100s of plugins.

    #234452 Reply

    Chris.d
    Member

    Alright, after I wrote my e-mail I tried a couple things:
    1. I started a new workspace for 3.1, copied over a previous project into that directory, made a new project in the IDE (where is the “Import Workspace” command?), pointed it to the copy and got that all working, setup my Tomcat’s, deployed, started, etc. And had the same results.
    2. I also made a new shortcut and added the clean flag, eg.:
    “C:\Program Files\eclipse3.1\eclipse.exe” -clean -vmargs -Xmx512M
    Ran it, but am still getting the same problem. I believe I also redeployed again afterwards – I’ll try a couple more combos of that before I get your reply 🙂 I tend to agree with the plugin diagnosis as currently after starting Tomcat the first error I get (after several working pages) is: java.lang.ExceptionInInitializerError. Also, I’ve gutted the new class of most of it’s workings and still get the same error.

    As for overwriting or not, I unzipped Eclipse 3.1 into a separate directory C:\Program Files\eclipse3.1 (I have old versions in \eclipse3.0 and \eclipse), and the new MyEclipse is in C:\ProgramFiles\MyEclipse4.0m2, though I don’t see an obvious place where the previous install is located…

    The shortcut issue was very wierd, that there was a new one but the old one had exactly the same new settings as the new one.

    Thanks for your patience,

    -Chris

    #234462 Reply

    Riyad Kalla
    Member

    (where is the “Import Workspace” command?)

    There isn’t one, you can do: File > Import > Existing Project

    Also, I’ve gutted the new class of most of it’s workings and still get the same error.

    All of the symptoms sound like either an installation issue our a setup problem. I don’t think continually breaking down that class will help or is necessary.

    Please tell me:
    1) What kind of projects is this?
    2) If you open it and navigate to project properties,then MyEclipse-Web, what are all the values in all the boxes?
    3) If you switch to Build Path, what are your source (dirs) set to and what is your output dir set to?
    4) What JARs are listed in your Libraries tab?

    #234464 Reply

    Scott Anderson
    Participant

    java.lang.ExceptionInInitializerError.

    Errors of this type occur during class loading while running static initializers. Does your new class have any static fields? The issue is likely that it or one of its subclasses cannot initialize properly when the classloader tries to load it. Something like an NPE, or other runtime exception while initializing one of the static fields is the likely culprit.

    #234466 Reply

    Chris.d
    Member

    I’ve undeployed, redeployed, even shut down my laptop (it took a long time for javaw.exe to finally quit) and restarted and created and used a new empty class. I’ve also started with only -clean and immediately quit again, and tried some other related things. The symptoms are the same: whenever I step through and it needs to use a new class’s constructor, it gives the java.lang.ExceptionInInitializerError.

    To answer your questions:
    1) MyEclipse >> J2EE >> Web project, though under project Properties it only says Type: Project, but the icon in Package Explorer has the little world on the folder.
    2) Context Root is fine, Deployment is set to “Use workbench default settings” in both places.
    3) Source=/source, included(All) Excluded(None), and I’ve added a missing /jasper folder (wasn’t being used in my tests), with Default output folder: MyProject/WebContent/WEB-INF/classes
    4) J2EE 1.4 Library Container, JRE System library (I also changed this from j2re1.4.xxx to j2sdk1.4.2_02 with no effect), and all the JARs from my Web-INF/lib/

    #234469 Reply

    Riyad Kalla
    Member

    The symptoms are the same: whenever I step through and it needs to use a new class’s constructor, it gives the java.lang.ExceptionInInitializerError.

    Sanity check time.

    1) File > New > Web Project
    2) Create a new index.jsp file.
    3) Create a new package in your source tree named com.test
    4) Create 2 Classes under com.test, one called “Person” the other called “Place”.
    5) In your index.jsp file, add a new scriplet near the top, that looks like this:

    
    <%
    Person p = new Person();
    Place pl = new Place();
    %>
    

    6) Deploy and run the index.jsp page, did it load?

    If it did, then I agree with Scott, you are doing something in your constructor (loading a file, connecting to a DB, trying to create a resource) that is failing, this is what is causing the ExceptionInInitError, which means you had an exception during your class initialization, so something is funky with this class.

    Are there any more details you can provide? Are you building the project with a custom Ant script? Have you tried rebuilding the project by using the Project > Clean feature and making sure that (Project > Build automatically) is checked?

    #234537 Reply

    Chris.d
    Member

    I did 1-6, and it shows up fine. Also tried with some constructor calls and it still worked.

    How can it be something in the constructor if it is a new, blank, empty class? (not the original, but one of my later tries)

    I have only been using Eclipse’s innate ability to build and MyEclipse’s deployment.

    I just now tried rebuilding using Eclipse >> Project >> Clean, and after the half-hour of freezing my machine, I undeployed, redeployed, and have the same problem.

    Yesterday I tried turning off the debug mode for Tomcat – and now even though I’ve turned it back on, Eclipse won’t switch to debug mode. The browser just keeps showing the same error.

    ——–

    Okay, as it turns out you are correct: it was a problem in a static initialization method, that an object had not been instantiated before having a method called. However instead of throwing a NullPointerException it threw ExceptionInInitError. Even before it stopped going into Debug mode it never stopped at my breakpoints in the static initializer, so I thought it happened before/outside of that anyways. In 3.0 and 3.1. I’m not sure how I could have figured it out the way everything was behaving.

    In the end, what I did was:
    1. Undeploy the project from Tomcat in Eclipse 3.0.
    2. Undeploy the project from Tomcat in Eclipse 3.1.
    3. Delete the project in Eclipse 3.1
    4. Checkout the project from our CVS in Eclipse 3.1, go through all the setup and prep and deploy (it wouldn’t forget about an XML validation error even after I turned off validation for the project, and then for the workspace)…
    5. Re-insert my work, piecemeal
    6. Put the breakpoint in the static initializer after I copied part of it in, then deploy and test. The breakpoints work now.
    7. stop the server, copy more in, etc.

    But I can now develop in 3.1/4.0m2. I hope 🙂

    Thanks for the hints – once I can put aside the time for the extra effort, I eventually figure out what’s going on.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: After Eclipse3.1/MyE4.0m2 install Tomcat can’t find NewClass

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