Community
Participate
Working Groups
I'm using Eclipse 3.1 M5a and I'm seeing difference behaviors when a plug-in is in the workbench environment vs. in the plugins directory. Here's my scenario: I have two plug-ins, one call org.apache.axis, the other call org.uddi4j. The org.apache.axis plug-in is nothing more than a place holder for a few jars. It has no code in it. It provides the following jars: <runtime> <library name="lib/axis.jar"> <export name="*"/> </library> <library name="lib/axis-ant.jar"> <export name="*"/> </library> <library name="lib/jaxrpc.jar"> </library> </runtime> Inside jaxrpc.jar, there's a class call javax.xml.rpc.Call. This class is indirectly referenced by another class in the org.uddi4j plug-in (btw, the org.uddi4j plug-in imports the org.apache.axis plug-in. Here's the code in org.uddi4j: org.apache.axis.client.Service service = new org.apache.axis.client.Service(); call = (org.apache.axis.client.Call) service.createCall(); service.createCall() returns javax.xml.rpc.Call and I'm down casting it to org.apache.axis.client.Call. Now, the problem... when both org.apache.axis and org.uddi4j exists in my workspace, the above code will not compile. There are two errors: 1. The project was not built since its build path is incomplete. Cannot find the class file for javax.xml.rpc.Call. Fix the build path then try building this project 2. The type javax.xml.rpc.Call cannot be resolved. It is indirectly referenced from required .class files If I remove org.apache.axis from my workspace and put it directly into the plugins directory, everything compiles. Also, everything works at run time.
Does org.uddi4j plugin require org.apache.axis plugin?
Yes. Here's a snippet of code from org.uddi4j's plugin.xml: <runtime> <library name="lib/uddi4j.jar"> <export name="*"/> </library> </runtime> <requires> <import plugin="org.apache.axis"/> </requires> Classes from org.uddi4j directly use classes from axis.jar and axis-ant.jar. And in turn, classes from axis.jar and axis-ant.jar use classes from jaxrpc.jar.
Issue likely resides in PDE land (container resolution?)
Short version: The issue comes from the fact that lib/jaxrpc.jar is not exported. If you mark it as exported, then everything will be fine whether the plugin is in the workspace or in the target platform. Long version: PDE is certainly more lenient when it comes to plugins in the target platform. If org.apache.axis is not in the workspace, even if jaxrpc is not exported, we still put it on your org.uddi4j's classpath, as if it were exported. this keeps JDT happy and is able to resolve all classes. When you import org.apache.axis into your workspace, PDE respects the (lack of) the exported flag in the plugin.xml and does not make jaxrpc.jar to clients. In this case, JDT is unable to resolve certain calls properly and hence the compilation errors. This inconsistency in the treatment will very shortly be addressed by PDE when we start supporting access restrictions. If the library is not exported, we will not make it directly available to clients, no matter if the plugin is in the workspace or not. However, fixing this inconsistency would leave us in a state where your plugin will not compile whether org.apache.axis is in the workspace or not. This defect then becomes a duplicate of bug 73957. *** This bug has been marked as a duplicate of 73957 ***
Thanks for the explaination. I have a follow up question... So at build time, org.uddi4j will not compile. Let's for the moment, assume I added jaxrpc.jar to org.uddi4j's build time classpath (right click on project -> properties - > ...), then things should compile again. Next, I dumped both org.apache.axis and org.uddi4j to another Eclipse instance's plugins directory and launched it (assume this Eclipse instance is a completely different install). What's the run time behavior of org.uddi4j. Will I get a ClassNotFoundException at run time? Even though service.createCall(); returns a javax.xml.rpc.Call object that org.uddi4j does not have access to. It's really the org.apache.axis's classloader that needs to construct this object. I thought because I'm down-casting the returned object to org.apache.axis.client.Call immediately, org.uddi4j's classloader does not need to know about javax.xml.rpc.Call at run time... Is this how things work at run time? This is still a learning process for me, can you shed some light on this. Your help is really appreciated. Thanks!