Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 117930

Summary: AddModuleDependenciesCommand needs to add Java/Utility project to EAR
Product: [WebTools] WTP Webservices Reporter: Rupam Kuehner <rsinha>
Component: jst.wsAssignee: Gilbert Andrews <gilberta>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: kathy
Version: 1.0   
Target Milestone: 1.0.1 M101   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 125705    
Bug Blocks:    
Attachments:
Description Flags
this implements the adding of a java project to an ear
none
There were some class cast exceptions in axis
none
Code that adds the java utility jar to the webproject
none
This adds a new line to the .component file none

Description Rupam Kuehner CLA 2005-11-24 12:18:32 EST
In the course of working on bug 105473, I came across a TODO in AddModuleDependenciesCommand (line 85). The code that add the Java project as a Utility Jar to an EAR is commented out. This TODO needs to be completed for proper sample gen with Web service clients in Java projects.
Comment 1 Rupam Kuehner CLA 2005-11-24 12:20:25 EST
Chris/Kathy,

Gil is probably the right person to look at this but I'll let you decide who should get this. I'm trying to clear my other M10 bugs. I may be able to look at this late next week if I make good progress on the rest.

Thanks.
Comment 2 Chris Brealey CLA 2005-11-24 15:19:55 EST
Gil, please investigate. Thanks - CB.
Comment 3 Gilbert Andrews CLA 2005-12-07 15:31:21 EST
Created attachment 31342 [details]
this implements the adding of a java project to an ear
Comment 4 Gilbert Andrews CLA 2005-12-07 15:37:34 EST
The code originally in this method was provided by Chucks'team. It had been depracated due to a new method using the datamodel technology. I talked with Jason Sholl and got the code used to add the java project as a jar to an EAR.

I have tested all the scenarios related to creating a jsp and they all work fine. I couldnt specifically test generating a client to a jsp in the wtp code so it will be left to test in the ast driver.
Comment 5 Gilbert Andrews CLA 2005-12-07 16:44:32 EST
So currently we can generate axis java client objects to a java project, this functionality is great. I am however not aware of anyway to add a java project to a web project in tomcat. 

Presently the code is specific to j2ee capable servers. So this can only be tested in ast. 
Comment 6 Kathy Chan CLA 2005-12-07 17:25:02 EST
Patch reviewed and committed.  Released as v2005_12071720.

Please try testing this with an AST driver.
Comment 7 Rupam Kuehner CLA 2005-12-09 11:49:09 EST
I was looking at the added code and saw a problem that will keep this code from functioning. Line 107 sets the SOURCE_COMPONENT property to an IProject instead of an IVirtualComponent.

refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earProject);

The correction would be to add a line before setting this property that gets the IVirtualComponent for the EAR project and then set the property to that. i.e.

IVirtualComponent earComponent = ComponentCore.createComponent(earProject);
refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent);

Reopening since this is guaranteed to fail.

There is a workaround, however, so I don't think this is critical for 1.0.  The user would just have to create the EAR and Java projects before-hand and add the Java project as a Utility JAR manually.
Comment 8 Chris Brealey CLA 2005-12-09 11:51:16 EST
Not critical for 1.0, but worthy of fixing in 1.0.1.
Comment 9 Gilbert Andrews CLA 2006-01-19 11:36:41 EST
Thanks Rupam im glad you noticed that I will correct that. There is unfortunately another problem as well. I dont think its related. We are currently getting a null value whe we try and access the manifest file in the project to merge the class paths. I have talked with Jason Sholl and he has tested the method from his end using the project and there wasnt a problem. I have asked him to run through our wizard and see if he find the problem but he is very busy and hasnt had a chance. 

I am going to try and create a stand alone case of this and assign a bug to him if indeed there is a problem with that method.

Comment 10 Gilbert Andrews CLA 2006-01-23 13:11:52 EST
Created attachment 33471 [details]
There were some class cast exceptions in axis

Fixes class cast exceptions.
Comment 11 Gilbert Andrews CLA 2006-01-23 13:14:06 EST
Created attachment 33472 [details]
Code that adds the java utility jar to the webproject

Code that adds the java utility jar to the webproject.
Comment 12 Gilbert Andrews CLA 2006-01-23 13:16:43 EST
I have fixed a couple problems. There were some issues in axis where we were casting classes inaproppriately and we were getting exceptions related to java projects.

I have changed the code to add the java utility jar to the appropriate ear and the appropriate webproject. This has been tested on axis and tomcat.
Comment 13 Kathy Chan CLA 2006-01-27 13:35:01 EST
Tried the patch (after removing the unused methods and imports) on M101 0124_0256 driver.  I found that I did not run into the ClassCastException when generating client into Java project (even running multiple times) without using the patch for axis.consumption.ui.  Also, I found that even with the patch for jst.consumption.ui, if I generate client into Java project and specify "test", the sample JSP has compile error (service bean not resolved).  The Java project JAR is copied into the server's temporary publish area in .metadata but not in the workspace.  When I tried invoking the Web service using the JSP, it did not work.

I also found that if I repeat the test, I got publish failed because it's unable to delete the Java project zip file from the temporary publish area.  I've opened bug 125524 for that problem.

I'm holding off committing the patch awaiting for more test result from Gil.
Comment 14 Gilbert Andrews CLA 2006-01-27 22:11:00 EST
Rupam and I saw this work in 0119 so i am a little surprised by the results to say the least. Great work in finding that Kathy, I have downloaded the driver and I am looking at the problem. I will let you when Ive got a reason for this. I dont forsee it being to complicated, perhaps there was a change in something beneath us.
Comment 15 Gilbert Andrews CLA 2006-01-30 08:07:09 EST
ok so I have downloaded the 0125 and there is definitely some changes that have occurred underneath us. The class cast exceptions occured when doing a second generation of the jsps using the same javaproject as the client. 

Now when I do this im getting the publish error that Kathy reported so Im not sure why that has changed. 

I will be talking to someone on j2ee tools to find out why the java utility jars are not being added properly. 
Comment 16 Gilbert Andrews CLA 2006-01-30 10:22:34 EST
I have talked to Jason Sholl of the j2ee team and apparently there is some
additional code required. I was recommended to Neeraj Agrawal to get
information on mapping the web lib project dependecy to a jar in the
WEB-INF/libs directory. I will talk to him this morning as soon as he gets in. 
Comment 17 Gilbert Andrews CLA 2006-01-30 10:49:53 EST
I have talked with Neeraj and we have determined there is a bug in the .component file not being reflected in the ui. The bug number is 125705 opened against j2ee. There is a work around, you can add the project manually. Then clean the project to see the error in the jsp disappear.

As for the class cast exceptions, im not sure why they are no longer occurring so I will remove them for this peice of code for now. 
Comment 18 Gilbert Andrews CLA 2006-01-30 10:50:48 EST
Created attachment 33788 [details]
This adds a new line to the .component file
Comment 19 Gilbert Andrews CLA 2006-01-30 12:59:34 EST
After all these problems are corrected and you try the workaround, you get a publishing error on tomcat 5.0. The jsps have no errors in the workspace, however there is still a problem with the result jsp when running it. Tim Deboer said this was probably a problem in j2ee. I remember Rupam saying there is a problem with j2ee and there is a bug currently open. I will confirm this and add the bug.
Comment 20 Kathy Chan CLA 2006-01-30 14:18:02 EST
I've tested with M0124_0254.  I did run into problem with the UI not reflecting the module dependency even though the module dependency had been added to the .component file and the Java project JAR had been added to the server's temporary publish directory (bug 125705) and got a compile error in the result.jsp complaining about javax/rpc/ServiceException (bug 117924).  After manually adding the Axis JARs to the Web project's WEB-INF/lib directory, I am able to run the sample JSP using Axis runtime generating into Java project.

Patch committed after removing unused method and unused imports.  

This fix will be released to M101 and HEAD later on today.
Comment 21 Kathy Chan CLA 2006-01-30 14:34:13 EST
Released to HEAD and M101 as v20060130_1930.
Comment 22 Rupam Kuehner CLA 2006-02-17 09:42:08 EST
Verified
Comment 23 Gilbert Andrews CLA 2006-02-21 17:06:36 EST
Thanks for verifying this Rupam