facebook

Using Tomcat 5 with JBoss 3.2.x [Closed]

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

    Sean Dynan
    Member

    Hi again

    I running through the Web Project tutorial in the MyEclipse User Guide, though I’m deploying to JBoss not Tomcat.

    The deployment goes okay; JBoss starts and the HelloWorld WAR is deployed as expected.

    However when I refresh http://localhost/HelloWorld/helloWorld.jsp my Eclipse JSP debugger presents me with this error:

    Source not found for helloWorld_jsp._jspService(HttpServletRequest, HttpServletResponse) line: 29

    The precompiled JSP is created here jboss\server\default\work\MainEngine\localhost\HelloWorld\helloWorld_jsp.java, and the _jspService() method is in there all right.

    Any ideas why the Eclipse debugger can’t find it in my JBoss?

    My config:

      Windows XP Pro SP1
      JBoss 3.2.2
      JDK 1.4.2_02
      Eclipse 2.1.2
      MyEclipse 2.6.4


    Sean

    #200449 Reply

    support-michael
    Keymaster

    Hi Sean,

    If you’re setting breakpoints in JSPs then note that MyEclipse requires the server support the JSR045 spec which defines a standard interface to debugging info for JSP-like languages. Presently the servers that we know support JSP debugging are Tomcat5, BEJY, and Weblogic 7 & 8, although Weblogic is not JSR045 compliant we adapted to its mechanisms. Jetty and Resin are supposed to support this capability very soon. If you can find a Tomcat5-JBoss integration you’ll be golden.

    Regards,

    Michael
    MyEclipse Support

    #200450 Reply

    support-michael
    Keymaster

    I reread your post info and the issue is that the source code for the compiled JSP can not be located. This makes sense since the compiled JSP code resides outside of the project’s source path and thus the debugger can not locate it.

    Some developers actually import the compiled JSP code into a separate source folder. Doing this will enable Java src level debugging.

    Michael

    #200451 Reply

    Sean Dynan
    Member

    Thanks Michael. I re-ran the tutorial against a standalone Tomcat 5 and, unsurprisingly, everything went by the numbers. I could also step into the servlet’s source on JBoss/Tomcat 4, but not the compiled JSP (just like you said).

    It seems I have two options if I wish to deploy/debug my JSPs on JBoss:
    (1) Download JBoss 3.2.3RC1 and perform the hack documented here (see the JBossWeb section) to integrate Tomcat 5.

    (2) Compile my JSPs to sources and locate them somewhere in my project’s source path.

    Advice sought
    (1) Whilst the hack mentioned above might work for a standalone JBoss instance, how do I make the MyEclipse JBoss connector launch the necessary run.sh -c tomcat5 command?

    (2) Alternatively, whereabouts in my project’s source path should I place the compiled JSPs? Or is there a neat way of getting Eclipse to do that for me?

    Many thanks for all your help guys.

    Sean

    #200471 Reply

    Scott Anderson
    Participant

    Sean,

    (1) You really can’t make the JBoss connector launch a shell script. However, you might be able to decouple Tomcat and JBoss with this technique and use the script once to start Tomcat and then use the connector to start and stop JBoss. I don’t know how well this will work, since I’ve never tried it however. Alternatively, I think I remember someone mentioning that on the JBoss 4 source tree that a Tomcat 5 integration exists.

    (2) Yes, there is a neat way. 🙂 Use File > New > Folder (NOT Souce folder) and click the advanced button. Set the ‘use linked folder’ option and point to the temp directory that Tomcat uses to store the JSP’s temporary .java files. Give it a name and click OK to create it. Now go to the project properties and select Source Build Folders and add the new linked folder you just created. That should do it.

    –Scott
    MyEclipse Support

    #200479 Reply

    Sean Dynan
    Member

    Hi Scott

    you might be able to decouple Tomcat and JBoss with this technique and use the script once to start Tomcat and then use the connector to start and stop JBoss

    Tomcat is integrated as a JBoss service. The last time I tried this I crashed and burned. I might try again if I can summon up the gumption.

    And yes, a Tomcat5/JBoss3 integation does exist. But, as documented here you have to start JBoss with that -c tomcat5 switch to activate it. Thus my original enquiry about the MyEclipse JBoss connector.

    Use File > New > Folder (NOT Souce folder) and click the advanced button. Set the ‘use linked folder’ option and point to the temp directory that Tomcat uses to store the JSP’s temporary .java files. Give it a name and click OK to create it. Now go to the project properties and select Source Build Folders and add the new linked folder you just created. That should do it.

    Okay, I tried this but I couldn’t get it to work. Eclipse sees the auto-generated helloWorld_jsp.java file and compiles an additonal .class. JBoss’ Tomcat then throws

    java.lang.ClassNotFoundException: org.apache.jsp.helloWorld_jsp

    If I add a “*.java” exclusion filter to the Eclipse linked source folder I observe the orginal debugger problem, namely

    Source not found for helloWorld_jsp._jspService(HttpServletRequest, HttpServletResponse) line: 29


    Sean

    #200482 Reply

    support-michael
    Keymaster

    If I add a “*.java” exclusion filter to the Eclipse linked source folder I observe the orginal debugger problem, namely Quote:
    Source not found for helloWorld_jsp._jspService(HttpServletRequest, HttpServletResponse) line: 29

    The issue is that Tomcat4 and Tomcat5 manage their JSP compilation areas differently. Specifically the servlet file that Tomcat4/Jasper creates is not in the proper file structure for its declared package. For example a helloWorld project with a top-level helloWorld.jsp will have a corresponding Tomcat4 servlet with a packaged name of org.apache.jsp located in the directory <Tomat4 install>/work/Standalone/localhost/helloWorld. Tomcat4 uses a custom classloader to deal with the fact that there is no org/apache/jsp directory hierarchy for the org.apache.jsp package name of the servlet. Tomcat5 generates JSP servlets into the proper directory structure. Thus the procedure provided earlier is Tomcat5 specific.

    The Tomcat4 procedure requires you to create the org/apache/jsp dir hierarchy and copy all contents in the Tomcat4 work area for your project under into this new dir structure. An alternative to this is for you to post an enhancement request on the “Features” forum since our management give user request a lot of attention.

    Regards,

    Michael
    MyEclipse Support

    #200496 Reply

    Sean Dynan
    Member

    Michael

    Firstly let me thank you for the effort you’ve put in debugging what is really a JBoss3/Tomcat4 issue. I don’t want to tie you up any longer supporting a problem that isn’t related to MyEclipse.

    I might drop an enhancement request like you suggested, though JBoss will probably have shipped Tomcat5 by the time you guys have provided a fix 😉 Actually, that raises another question.

    Time for a new Topic…

    Sean

    #200894 Reply

    arghhh
    Member

    This thread prompted an experiment. I got JBoss3.2.3 to work with the integrated tomcat5.

    1) Do what the jboss instructions say, “ant -buildfile build-tc5-config.xml”

    2) Under Windows->Preferences->MyEclipse->Application Servers->JBoss 3
    a) change “Server Name” to “tomcat5”
    b) change “Optional Program Arguments” to “-c tomcat5”

    Then you get debugging of jsp! Yeah!

    #200907 Reply

    Sean Dynan
    Member

    Hi arghhh!

    Great advice! It works well now.

    One more thing worth mentioning in case anyone else gets tripped up by this: you have to enable mapped files in the JBossweb config otherwise the JSP source files don’t sync with their corresponding servlet code as you step through the JSPs in the debugger.

    Add the following init param to the jsp servlet entry in jboss/server/tomcat5/deploy/jbossweb-tomcat50.sar/web.xml:

    <servlet>
      <servlet-name>jsp</servlet-name>
      ...
        <init-param>
          <param-name>mappedfile</param-name>
          <param-value>true</param-value>
        </init-param>
      ...
    </servlet>


    Sean

    #206508 Reply

    Aby Abraham
    Member

    After a lot of searching in the net, I integrated tomcat 5 with JBoss 3.2.3, and it is working fine. The steps are given below.

    1. go to the JBOSS_HOME/docs/examples/tomcat folder in command
    prompt. There should be a file called build-tc5-config.xml

    2. Using ant, build this file. ( ant -buildpath build-tc5-config.xml )

    3. It should show Copying 130 files, and then copying 30 files… and
    finally a BUILD SUCCESS message.

    4. Now you have built the tomcat 5 service for JBoss, and a directory
    called tomcat5 should be under JBOSS_HOME/server. The JBoss –
    Tomcat5 integration is done.

    5. To tell JBoss to start the tomcat5 service instead of the default one,
    we have to give arguments to run.bat. To execute it manually, give
    the command “run -c tomcat5

    6. Now, Eclipse integration. I used Eclipse 3.0 M8. You can download
    the JBoss IDE plugin for Eclipse. Then install it in the plugin directory
    of eclipse. (just unzip it).

    7. We have to configure it. Open the eclipse. Rightclick on the top tool
    bar, and select Customize Perspective. In the Commands tab, select
    Default Server. Click OK. Now a new menu and some buttons should
    appear.

    8. Go to Run > Debug, and on the left side, you can see a list of JBoss
    servers, select JBoss 3.2.x. If you want to change the perspective,
    change it. Next, click New to create a new configuration.

    9. Select the new configuration, and select the JBoss installation
    directory on the Home tab. On the Start tab in the Program
    arguments textbox, type “-c tomcat5”. Remember, we started the
    JBoss server manually using this option with run.bat!

    10. Press Close.

    11. Go to Window > Perspective, and select JBoss IDE > Launcher, and
    in the Default Server, select our new configuration. Click OK.

    Congratulations! You can now use the new buttons in your toolbar. Click the Start Server. You can see the output in the console window. Make sure that in the output, it shows ……/servers/tomcat5…. , and not
    ……/servers/default…..! Thats it. Pretty cool, eh?

    #206512 Reply

    Riyad Kalla
    Member

    aby.abraham,
    We really appreciate you taking the time to post the steps for other users, thank you.

    #206516 Reply

    Scott Anderson
    Participant

    And, just for completeness, JBoss 3.2.4 will include Tomcat 5 natively. However, at the time of this post it has not been officially released yet. But, if you’d like to download the source and build it yourself (very easy) you can find out how in this post:
    https://www.genuitec.com/forums/topic/tomcat-5-jboss-3-2-4-jsp-debugging-support-closed/

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Using Tomcat 5 with JBoss 3.2.x [Closed]

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