Bug 117924 - Tomcat server not detecting Web project's dependency on Java project.
Summary: Tomcat server not detecting Web project's dependency on Java project.
Status: CLOSED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: jst.ws (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P3 major with 2 votes (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Trung CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 148876 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-11-24 11:55 EST by Rupam Kuehner CLA
Modified: 2008-04-28 20:59 EDT (History)
1 user (show)

See Also:


Attachments
AddressBook.wsdl (4.15 KB, text/xml)
2005-11-24 11:57 EST, Rupam Kuehner CLA
no flags Details
Fixes the problem, now the Test JSP can run nicely. (2.93 KB, patch)
2008-02-12 01:30 EST, Trung CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rupam Kuehner CLA 2005-11-24 11:55:23 EST
Some background about the usage scenario:
This bug was found in the course of trying to get Axis Web service client generation enabled to Java projects and Utiltiy projects. When the Web service client code in generated into a Java project, the Web service client wizard still gives the user the option of creating a sample JSP to exercise that client code. The wizard creates a Web project to house the JSP and then adds the Java/Utility project as a dependency on the Web project. The tomcat server does not seem to see this dependency, so the JSP is not loading. 

Here's how to reproduce:

1. Create a Web project (web 2.4) with the tomcat 5.0 runtime
2. Copy AddressBook.wsdl into the Web project's WebContent folder
3. Select AddressBook.wsdl and launch the Web service client wizard
   File > New > Other, Web Services > Web service client
4. Page 1: Check "Test the Web service"
5. Page 2: Accept defaults
6. Page 3: In the Client project field, type in a new project name (ujp)
           In the Client Project type field, choose Utility Project
7. Click Finish.
Once the wizard is finished (about a 1 min), the Web Services Test Client will
launch in browser, but one of the frames will have an HTTP Status 500. 

--------------------------------------------------------------------------------

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: /sampleAddressBookProxy/Result.jsp(8,0) The value for the 

useBean class attribute webservice.addressbook.AddressBookProxy is invalid.
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
	org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227)
	org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Generator.generate(Generator.java:3272)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.

--------------------------------------------------------------------------------

The error is occurring because, even though the Web project that was created by the wizard (ujpSample) to contain the JSP application depends on the utility project (ujp), the dependency is not being "seen" at runtime.
If I select ujpSample, Right click > Properties and then expand J2EE Module Dependencies and select Web Libraries, ujp is checked.


If I go through the following steps, the dependency seems to get noticed by the server:

1. Use ujpSample's Properties pane to manually remove the dependency on ujp. Be sure to remove it from the module dependencies and the Java build path.
2. Manually clean the projects (ujp and ujpSample). You should see compile errors in ujpSample.
3. Use ujpSample's properties pane to manually add the dependency on ujp.
4. Manually clean the projects (ujp and ujpSample). You should see compile errors go away.
5. Restart the server.
6. Select ujpSample/WebContent/sampleAddressBookProxy/TestClient.jsp and "Run on server"

There's still an HTTP status 500 but with a different error, for which I'm opening a different bug. This bug is meant to cover the problem of the dependency on ujp not being seen at all.

--------------------------------------------------------------------------------

HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this 

request.

exception 

javax.servlet.ServletException: javax/xml/rpc/ServiceException
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:244)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceException
	java.lang.Class.getDeclaredConstructors0(Native Method)
	java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
	java.lang.Class.getConstructor0(Class.java:1930)
	java.lang.Class.getConstructor(Class.java:1027)
	org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1222)
	org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Generator.generate(Generator.java:3272)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Comment 1 Rupam Kuehner CLA 2005-11-24 11:57:28 EST
Created attachment 30561 [details]
AddressBook.wsdl

Attaching AddressBook.wsdl
Comment 2 Tim deBoer CLA 2005-11-24 15:11:39 EST
I can't follow the instructions - at step 6 'Utility Project' is not an option. If I explicitly type it in the field, it says that Axis doesn't support it. Any idea what I could be doing wrong?
Comment 3 Rupam Kuehner CLA 2005-11-24 15:53:55 EST
Sorry Tim, got a little ahead of myself. You won't see the Utility Project option and so won't be able to reproduce the problem until Kathy/Chris commit and release my patches for bug 105473. I'll add you the CC list for that bug so you'll get notified once the changes are in.
Comment 4 Tim deBoer CLA 2005-11-24 15:54:54 EST
Tried with a regular Java utility project. I found a J2EE problem that will cause an issue when there are resource duplicated in the src and bin dirs (e.g. a manifest), but otherwise publishing and running went fine.
Will wait for web services testcase.
Comment 5 Tim deBoer CLA 2006-01-04 14:39:05 EST
Found the problem once I moved to a build with the new option - although the build path is updated as well as the J2EE Dependancy property page (can't find where these values are stored), the .component file does not include the dependancy. As a result, the J2EE team "correctly" tells server tools that the sample project does not have any child/dependant projects. Once I add the dependancy to .components by hand, everything works fine.

I don't know how you are creating the sample project and why some things are updated but no physical dependancy is created. If you are using J2EE tools API to create this dependancy then you'll need to pass this bug on to them. Otherwise, you'll need to fix the web services code that tries to create the dependancy.
Comment 6 Tim deBoer CLA 2006-01-05 11:35:23 EST
*** Bug 117927 has been marked as a duplicate of this bug. ***
Comment 7 Rupam Kuehner CLA 2006-01-05 13:37:10 EST
We need to change the way we create the module dependency in AddModuleDependenciesCommand. Specifically, these two lines
in the execute method

        addJAROrModuleDependency(sampleIProject, uri);        
        addBuildPath(sampleIProject, clientIProject);

should be replaced with this:
        addJavaProjectAsUtilityJar(clientIProject, sampleIProject, uri, monitor);

When I do this, the .component file in the sample Web project shows the module dependency and it seems to be recognized at runtime (though not at compile time which looks like a separate J2EE bug that can be opened once this bug is fixed.
Comment 8 Rupam Kuehner CLA 2006-01-05 15:07:26 EST
Opened bug 122799 for the compile time problem mentioned in comment #7.
Comment 9 Rupam Kuehner CLA 2006-01-18 15:38:22 EST
After a discussion with Kathy Chan and Chris Brealey, there are a couple of options we need to investigate further. Given that Java utility projects don't have a way of specifying to the server which additonal JARs on their build path need to be deployed with the WAR, we'll need to somehow reckon with the missing Axis JARs. Options are:

1. Prevent the Sample JSP Test facility from appearing as an option when Axis clients are generated into Java projects. This would require a couple of additional attributes on the org.eclipse.jst.ws.consumption.ui.tester extension point: runtime and projectType. 

2. Have the Sample JSP Test facility copy the Axis JARs to the Web project's lib folder. This would require one additional attribute on the org.eclipse.jst.ws.consumption.ui.tester extension point: runtime
Only the test extension for the Axis runtime would then add the Axis JARs.
Comment 10 Chris Brealey CLA 2006-06-27 20:46:07 EDT
*** Bug 148876 has been marked as a duplicate of this bug. ***
Comment 11 Kathy Chan CLA 2007-10-25 09:47:50 EDT
Hi Gil,

Please follow the RFE bug 116856 (which bug 138648 is dup on) for enhancements to Java classpath and J2EE dependency issue which may solve this problem of letting Tomcat server know to add the JARs of a dependent Java Utility project.  Please follow the wiki page for requirements and progress on this RFE:

http://wiki.eclipse.org/Web_Tools_Platform_Release_3.0_Requirements/JavaCPvsJavaEEModDeps

I've added your name to the CC list of bug 116856.

Comment 12 Kathy Chan CLA 2007-10-25 10:32:59 EDT
According to Rob Frost, there's currently a way to specify which JAR in the dependent Java Utility project should be deployed to a server.  That can be accomplished now (i.e. in 2.0) by adding the publish/export
classpath attribute to the library cp entries in the utility project that are
associated with the JARs you want deployed. 

Adding the attribute programmatically can be accomplished via API in the
org.eclipse.jst.j2ee.classpathdep package (see
UpdateClasspathAttributeUtil.addDependencyAttribute()).

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=185176 for more details on
how this all works currently.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=116856#c11 for details on Rob's comment.

Please give it a try for WTP 3.0 M3.  If the current mechanism does not achieve what we need, we would need to follow up with RFE bug 116856.
Comment 13 Kathy Chan CLA 2007-11-08 11:37:38 EST
Let's try to address this early in M4.
Comment 14 Kathy Chan CLA 2007-12-21 16:13:02 EST
Deferring to M5.
Comment 15 Kathy Chan CLA 2008-01-28 15:34:26 EST
Trung, 

Please take a look at this for WTP 3.0 M5.
Comment 16 Trung CLA 2008-02-12 01:30:10 EST
Created attachment 89478 [details]
Fixes the problem, now the Test JSP can run nicely.

First: please ignore all comments of Rupam. They make no sense, and in fact they led me into the wrong direction.

Second: Name of the bug is misleading as well. it should be something like: Dependencies of a Java utility project are not bundled along with the project when the project is exported.

Third: Found another bug during working on this one. Luckily, sever tooling bug not our web service :D

Forth: My Patch for this, please review.
Comment 17 Kathy Chan CLA 2008-02-13 00:46:16 EST
Patch reviewed, tested and committed.  Released to WTP 3.0 as v200802130444.
Comment 18 Kathy Chan CLA 2008-02-28 14:12:54 EST
Please verify the defect you originated with a recent WTP driver which could be found in:

http://download.eclipse.org/webtools/downloads/

If defects in resolved state is not verified within a couple of weeks, the development team might verify and close the defect on the originator's behalf.  Thank you for your attention!

Comment 19 David Williams CLA 2008-04-24 00:45:17 EDT
mass change to add 'contributed' keyword based on bugzilla query, please correct if that's not accurate (by marking patches as obsolete and removing the 'contributed' keyword. 
Comment 20 Kathy Chan CLA 2008-04-28 20:59:43 EDT
Closing on behalf of Rupam.