facebook

Debug a Servlet with Tomcat or Websphere

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #206188 Reply

    I run Eclipse 2.1.2 , and My Eclipse. I want to Debug my Application
    with Tomcat 4.
    I have a configuration File (xml) for Tomcat with several mappings ( tomcatHome/Conf/server.xml). I didn’t find where in the preferences -> myEclipse -> Tomcat 4 I can define this configuration file.
    Because without such a definition the connection to the servlet is not possible, the following error is displayed: java.io.fileNotFoundException: http://localhost:8080/eReconciliation_server.

    I need to do the same thing under Websphere 5.

    thanks for your Help

    #206191

    Riyad Kalla
    Member

    MartineGeiller,
    For Tomcat to make use of this conf file, all you need to do is make sure its in the correct Tomcat\conf directory. Our server connectors launch the application servers by performing almost exactly the same steps that the batch files or startup scripts do. So running Tomcat 4 from the command line, system service or from MyEclipse are all pretty much the same.

    #206193

    It finds the servlet now. The problem was the JdK Version. I tried it with 1.3.1_04 from sun (before I had a Jdk from IBM).

    But I have a new Problem: java.lang.ClassNotFoundException

    2004-04-20 14:05:55 StandardWrapper[/eReconciliation_server:eReconciliation_server]: Marking servlet eReconciliation_server as unavailable
    2004-04-20 14:05:55 StandardWrapperValve[eReconciliation_server]: Allocate exception for servlet eReconciliation_server
    javax.servlet.ServletException: Error instantiating servlet class com.systor.erecon.service.persistence.EReconServlet
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:912)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:479)
    —– Root Cause —–
    java.lang.ClassNotFoundException: com.systor.erecon.cash.service.persistence.JDBCHomeCash
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1443)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:115)
    at com.systor.erecon.service.persistence.EReconServlet.<init>(EReconServlet.java:33)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:232)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:903)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:479)

    2004-04-20 14:08:50 StandardContext[/eReconciliation_server]: Mapping contextPath=’/eReconciliation_server’ with requestURI=’/eReconciliation_server’ and relativeURI=”
    2004-04-20 14:08:50 StandardContext[/eReconciliation_server]: Trying exact match
    2004-04-20 14:08:50 StandardContext[/eReconciliation_server]: Trying prefix match
    2004-04-20 14:08:50 StandardContext[/eReconciliation_server]: Mapped to servlet ‘eReconciliation_server’ with servlet path ” and path info ‘null’ and update=true
    2004-04-20 14:08:50 StandardWrapperValve[eReconciliation_server]: Servlet eReconciliation_server is currently unavailable

    #206194

    Riyad Kalla
    Member

    Where is the com.systor.erecon.cash.service.persistence.JDBCHomeCash class? Is it in a JAR? If it is, is the JAR in your apps WEB-INF/lib directory? If its part of the project, can you double check that it is infact in the WEB-INF/classes/com/systor/erecon/cash/service/persistence directory of your webapp?

    Where is this class during development? Is it part of a JAR that is in your build path, or is it in your source tree that gets compiled to WEB-INF/classes while you are developing?

    Are you building/deploying your project with MyEclipse or are you using an Ant script?

    #206201

    – JDBCHomeCash is in a jar: WEB-INF/classes/lib/eReconEnvCash.jar
    – the Directory
    WEB-INF/classes/com/systor/erecon/cash/service/persistence does not exists. we have directly /classes/com/systor/erecon/cash/service/persistence and it is there.

    JDBCHomeCash is in HEAD\eReconEnvCash\classes\com\systor\erecon\cash\service\persistence during development.

    We are building project using Ant Script

    #206204

    Riyad Kalla
    Member

    MartineGeiller,
    All of your JAR files must be in WEB-INF/lib, not WEB-INF/classes. WEB-INF/classes is meant for compiled class files in their uncompressed format, the /lib directory is intended for all supporting libs (utilities, framework jars, support libraries, etc.)

    Just so you know this isn’t a MyEclipse thing, it’s part of the spec.

    #206208

    Hallo Riyad,
    sorry for my error in the Text, all our Jars are in WEB-INF/lib

    #206210

    Riyad Kalla
    Member

    sorry for my error in the Text, all our Jars are in WEB-INF/lib

    Damn, I was hoping this would be an easy one 😉

    When you deploy your app to Tomcat, do you see all the libs in their appropriate place? <Tomcat Home>\webapps\appName\WEB-INF\lib\<HERE>

    If not, then I would double check your Ant script. When troubleshooting a ClassNotFoundException, I always try and walk backwards from the server to my dev environment and see where things get messed up along the way.

    #206213

    Yes I see all the libs in the Appropriate place:

    characterConverter002e_9_0_1_4.jar
    classes12_9_0_1_4.jar
    eReconCore.jar
    eReconEnvCash.jar
    eReconEnvCommon.jar
    eReconEnvSec.jar
    etc…

    in the ClassLoader of the Servlet I see for example classes out of classes12_9_0_1_4.jar but none from eReconEnvCash.jar

    In the servlet the following instruction failes:

    Class lClass = Class.forName(lEnvCashJDBCHomeName)
    where the value of lEnvCashJDBCHomeName = com.systor.erecon.cash.service.persistence.JDBCHomeCash

    #206214

    I just want to complete that the Application normaly works. I just have these problemes if I try to debug in MyEclipse

    #206216

    Riyad Kalla
    Member

    Do me a favor and try and add that eReconEnvCash.jar file to your classpath within MYEclipse and see if it helps. Go here: Window > Preferences > MyEclipse > App Servers > Tomcat (ver) > Paths, and click “Add JAR/ZIP” to the “Append to Classpath” section and add that JAR, then try and debug again.

    #206218

    I already tried this and it didn’t work.
    But I resolved the problem:
    I modified the docBase defining the servlet in the server.xml.
    Before it pointed on the Development Directory. And now it points to the tomcat Application Directory and I Works.

    Thank You for your rapid answers.

    Now I have to try the same with Websphere.

    #206220

    Riyad Kalla
    Member

    I modified the docBase defining the servlet in the server.xml.
    Before it pointed on the Development Directory.

    <smacks self in forhead> I didn’t think to ask, I will from now on.

    Now I have to try the same with Websphere.

    Let us know if that works so others possibly with the same problems can learn from this thread.

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Debug a Servlet with Tomcat or Websphere

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