- This topic has 14 replies, 2 voices, and was last updated 20 years, 3 months ago by jjastrow.
-
AuthorPosts
-
jjastrowMemberWe’ve been running Tomcat 4 under Eclipse 2.1 for 18 months. I just downloaded your 30 day trial of MyEclipse and Eclipse 3.0. I’m still using Tomcat 4 (copied the Tomcat directory) and cannot seem to get Tomcat running correctly under or outside of Eclipse.
Can you help? I’ve searched your site and the internet but cannot find an answer. I also just newly installed JDK 1.4.2.
THANKS, JohnHere’s the errors I get…
2004-08-26 08:08:11 StandardWrapper[/peopleDb:log4j-init]: Marking servlet log4j-init as unavailable
2004-08-26 08:08:11 StandardContext[/peopleDb]: Servlet /peopleDb threw load() exception
javax.servlet.ServletException: Error instantiating servlet class peopleDb.Log4jInitServlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912)—– Root Cause —–
java.lang.Error: Unresolved compilation problems:
The import javax.servlet cannot be resolved
The import javax.servlet cannot be resolved
The import javax.servlet cannot be resolved
The import org.apache.log4j cannot be resolved
The import org.apache.log4j cannot be resolved
HttpServlet cannot be resolved or is not a valid superclass
The method getServletContext() is undefined for the type Log4jInitServlet
The method getInitParameter(String) is undefined for the type Log4jInitServlet
PropertyConfigurator cannot be resolved
BasicConfigurator cannot be resolved
HttpServletRequest cannot be resolved (or is not a valid type) for the
parameter req of the method doGet
HttpServletResponse cannot be resolved (or is not a valid type) for the parameter res of the method doGet at peopleDb.Log4jInitServlet.<init>(Log4jInitServlet.java:4)
Riyad KallaMemberYou should have a jsp-api.jar and servlet-api.jar file in your <tomcat>\common\lib folder, do you? Also is your app deployed correctly such that it includes the log4j JAR files? If you can’t start Tomcat outside of Eclipse then this really is a configuration problem. I am going to move this to Random thoughts as it is not directly tied to ME (this is for organization reasons, I will still help you).
jjastrowMemberYou’re right, I get the same errors when running outside of eclipse. But I did have this running just fine with Eclipse 2.1.
I did not find those two *-api.jar files but I do have these:
servlets-common.jar, servlets-default.jar, servlets-invoker.jar, servlets-manager.jar, and servlets-webdav.jar.We have always seen log4j warnings but ignored them and Tomcat seems to work fine. We have this running in 3 other Dev boxes and 2 Production boxes right now.
Here is the command I used to launch outside of Eclipse.
C:\MyEclipse\java\bin\java.exe -jar -Duser.dir=”C:\MyEclipse\tomcat” “C:\MyEclipse\tomcat\bin\bootstrap.jar” start
Anything else I can look for?
Riyad KallaMemberWhat happens when you try and run the startup.bat file from your tomcat\bin dir? Any errors? What does your Tomcat layout looklike?
When you said that this used to work with Eclipse 2.1, there must have been something that changed. From your directory structure it looks like you have everything installed under your MyEclipse directory, so maybe at some point during your upgrade something got deleted that was important?
Can you try redownloading the version of Tomcat that you need (4.1.x or 5.0.x) and unzipping it somewhere and hooking ME up to it and seeing if it works? Then slowly moving over your configs, webapps, etc. to the new install and using that?
Also if that user.dir variable is important for Tomcat to run (although its not running now, so this may not help) you can add it to the Optional VM Args in the Tomcat 4 connector under the JDK preferences.
jjastrowMemberI can run startup.bat but get those same errors. Not sure what you mean by “Tomcat layout”?
Yes, I did change the directory. Copied it over to a new base directory but have looked into almost all files in my project to change the directory name from “C:\javaEnv” to “C:\MyEclipse”. I don’t think anything was deleted as best as I can tell looking at saved directories from my PC and another developer’s PC.
I’ve downloaded the 4.1.30 version of Tomcat but will wait as a last resort to try that since that will take some time. I’m not sure if I can set it up so you can come in since we have lots of heavy-duty firewall and other security devices and software setup on our internal net. I’d have to run it past our IT manager but will do that if you think it will help me.
I think I should mention that Tomcat is running. I can get to the Manager screen and now I get to the Admin application okay. It is only my project application that I’m having such trouble. And, yes, I’m a relative newby to java and java web development. I’ve done Microsoft IIS and ASP and .NET but only java’d for a few months now. Don’t think I care much for Struts either but I’m open to discover a use for it. MyEclipse is very exciting to us because of all the features and I’m looking forward to getting this working.
This is the last error I’m getting in the browser when I goto my JSP but I still can’t tell if I’m making progress!
HTTP Status 500 –
type Exception report message
description The server encountered an internal error () that prevented it from fulfilling this request.exception
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)root cause
java.lang.ClassCastException
at org.apache.jsp.errorpage_jsp._jspService(errorpage_jsp.java:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
Riyad KallaMemberAh ha! It does look like you are making progress. You are getting a ClassCastException in your error_page.jsp file, you might want to open that up and look for any casts you do and then comment them out or change them and make sure the page works then.
Atleast we have Tomcat working now, that’s good news. Now its just some good old fashion elbow grease and debugging to get you the rest of the way.
jjastrowMemberActually, I get an two other errors in the log file at Tomcat startup before I hit my JSP pages. The second one below is probably the real problem I would guess, but I don’t understand it. We have always seen warnings for log4j and we don’t really use it.
2004-08-31 10:18:08 StandardWrapper[/peopleDb:log4j-init]: Marking servlet log4j-init as unavailable
2004-08-31 10:18:08 StandardContext[/peopleDb]: Servlet /peopleDb threw load() exception
javax.servlet.ServletException: Wrapper cannot find servlet class peopleDb.Log4jInitServlet or a class it depends on
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:891)
.
.
—– Root Cause —–
java.lang.ClassNotFoundException: peopleDb.Log4jInitServlet
.
.
2004-08-31 10:18:09 StandardWrapper[/peopleDb:peopleDb]: Marking servlet peopleDb as unavailable
2004-08-31 10:18:09 StandardContext[/peopleDb]: Servlet /peopleDb threw load() exception
javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912)
.
.
—– Root Cause —–
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)Let me know if you’d like to see more of this log file. THANKS
Riyad KallaMemberCan you grab the log4J files and drop them in the common\lib directory of Tomcat and see if that fixes the problem OR drop them in your WEB-INF/lib directory of yoru webapp? These errosr are fine, the servlets cannot initialize because they are trying to load Log4J, which isn’t there.
jjastrowMemberWell, instead I removed the log4j servlet tag in my web.xml so that’s not in the picture anymore. Same servlet class error as before:
2004-08-31 15:51:11 StandardContext[/peopleDb]: Servlet /peopleDb threw load() exception
javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912)
—– Root Cause —–
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)I’ve installed Tomcat 4.1 and have had a few people here look at this. We are stumped so now I’ll download Tomcat 5.0 and see what happens.
Riyad KallaMemberError instantiating servlet class org.apache.struts.action.ActionServlet
Do you have the struts libraries in your project’s WEB-INF/lib dir?
jjastrowMemberYes, I have that. Tried Tomcat 5. Tried everything until I realized that I can just start over with a copy of another’s directory image.
So, now I’m back successfully working in my app with Tomcat 4.1 started outside of eclipse. I have eclipse 3.0 installed and a fresh install of MyEclipse.
I think my problem was that I opened eclipse last time and did an import of my project. After that I could not get my app working in Tomcat in or out of eclipse. Unless you have something helpful I will look for instuctions to add an existing tomcat project to eclipse without the “import” if that is possible.
Riyad KallaMemberIts not possible that I’m aware of, that shouldn’t have effected the project’s health unless there was a configuration problem. While I’m glad everything is working, I’m convinced the problem was something simple, and without being there its really hard to tell what piece of the puzzle was missing.
I’m sorry this didn’t go smoother, I realize you spent a lot of time working with us on this.
jjastrowMember“…not configured as a MyEclipse Web-Struts Project…”
Still not there yet but thanks for the previous help. It was a configuration problem. I got past that and have Tomcat 4.1 running successfully within Eclipse with MyEclipse installed. Now I have this: after I did the File/Import “Existing Project”, I open struts-config.xml and it says:
“Cannot open default editor on struts-config.xml. Project ‘peopleDb’ is not configured as a MyEclipse Web-Struts Project. Therefore the MyEclipse Struts Editor may not be used with struts-config.xml. The default XML Editor has been used to open the file instead.”
So how do I configure my existing project (which we started in Eclipse 2.1 a year ago) to be a “MyEclipse Web-Struts Project”? The documentation says it is very outdated and to look on your support site. I searched and cannot find help on this.
I have the Java Build Path source pointing at my project root (excluding all but the src dir). And this is my project layout:
C:\javaEnv\tomcat\webapps\peopleDb\*.jsp
C:\javaEnv\tomcat\webapps\peopleDb\src\
C:\javaEnv\tomcat\webapps\peopleDb\WEB-INF\classes
C:\javaEnv\tomcat\webapps\peopleDb\WEB-INF\lib
Riyad KallaMemberIf you right click on your project and select “MyEclipse” then “Add web capabilities” and then do that again and “Add Struts capabilities”, that should get you in good shape.
Also if your project root IS your webroot (e.g. meaning peopleDb is your project root dir as well as your web root) then when you add web capabilities, be sure to leave the “Web root dir” empty.
jjastrowMember🙂 Looks like it’s all working! Thanks a bunch.
-
AuthorPosts