I've been trying to get started on Java Web Development using Eclipse, Tomcat, and Struts for the past several weeks. Sometime last week I got both simple JSP's (no custom logic) and the same JSP's using Tiles working. I've been trying to work on my first custom tag. I'm developing on a Mac OS X 10.3 platform.
I had to fiddle a lot for the application wide class path and the project-specific class path to get the jsp-api.jar reachable. Once I got that fixed the base classes were resolve-able and my classes compiled. However, the default build from Eclipse, using the Tomcat project template from the Sysdeo plugin, did not appear to put class files into the correct location for Tomcat to use them (ie not in WEB-INF/classes/<package>/).
I looked at the Eclipse In Action book published by Manning to for how to invoke Ant from inside Eclipse and use the provided build.xml file included in the sample Struts application.
I had to add classpaths to the build.xml to locate servlet-api.jar and jsp-api.jar. Once that was done Ant could compile the files and the directory structure looked correct. I had a typo in the package for my tag handler in the .tld. After I fixed that I started getting:
javax.servlet.ServletExceptions with the root cause as java.lang.NoClassDefFoundError: javax/servlet/Servlet
At which point I started working backward, removing custom components from my JSP's, until it was only the Tiles and static template content, but I got the same errors. I had been restarting Tomcat several times throughout this process from the Sysdeo plugin for Eclipse and didn't see anything suspicious in the log.
I now tried the root web-application (default Tomcat install) and received:
javax.servlet.ServletException: Error allocating a servlet instance org.apache.catalina.values.ErrorReportValue.invoke(ErrorReportValue.java : 105)
At this point I tried stopping and restarting Tomcat from the command-line instead of from within Eclipse. The root application started working.
My development application however now shows 1 of 2 behaviors:
1) Blank page, no content in view source: direct request for a simple complete jsp (only template text, valid HTML) or for the basic template with an <p>Hi</p> as the body. These pages only use the /tags/tiles taglib.
2)
org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.logic.IterateTei
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHand ler.java:50)
on any page that includes the /tags/struts-logic taglib.
I'm afraid I've corrupted by install of Tomcat or Struts somehow. I haven't done that much actual development, so re-installing everything is doable, but the amount of cross application configuration is daunting even with the help on-line tutorials and both the Eclipse in Action and Struts in Action books. None of the tutorials indicated either of the problems with adding the jsp-api.jar to the eclipse and/or Ant classpaths nor the configuration required for .classes to end up in /WEB-INF/class. Does anyone know if Mac OS X has serious issues with the "normal" configurations that would be causing those problems? Does anyone know what I did that cased the ServletExceptions near the end of my story or why it can't find struts-logic anymore while it can still find tiles? Any other advice?
Thank you.
Eric
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]