JWSDP naming conflict with wscompile
I got an obscure error message and stack trace from Sun’s
Java Web Service Developer Pack 1.6‘s wscompile
tool.
I tried to generate the server-side artifacts for a JSE web service
using the following wscompile
configuration file:
<configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <service name="MyService" targetNamespace="http://ws.mcqueeney.com" typeNamespace="http://type.mcqueeney.com" packageName="com.mcqueeney.ws" > <interface name="com.mcqueeney.ws.MyService" servantName="com.mcqueeney.ws.MyServiceWS" /> </service> </configuration>
Running wscompile
from Ant with -verbose and -Xprintstacktrace would display the methods of the
endpoint interface,
then come up with an exception and stack trace.
[wscompile] command line: wscompile C:\apps\j2sdk1.4.2_08\jre\bin\java.exe -classpath ... com.sun.xml.rpc.tools.wscompile.Main -d generated\wscompile -features:rpcliteral -gen:server -keep -model generated\wscompile\model.xml.gz -mapping generated\wscompile\event-mapping.xml -s generated\wscompile -verbose -Xprintstacktrace wscompile-config.xml [wscompile] [creating model: MyService] [wscompile] [creating service: MyService] [wscompile] [creating port: com.mcqueeney.ws.MyService] [wscompile] [creating operation: method1] [wscompile] [creating operation: method2] [wscompile] [creating operation: method3] [wscompile] [creating operation: method4] [wscompile] Naming conflict occurred: [com.mcqueeney.ws.MyService] [wscompile] at com.sun.xml.rpc.processor.generator.nodes.TypeVisitor.preVisit(TypeVisitor.java:115) [wscompile] at com.sun.xml.rpc.processor.model.ExtendedModelVisitor.visit(ExtendedModelVisitor.java:25) [wscompile] at com.sun.xml.rpc.processor.generator.nodes.JavaWsdlMappingNode.write(JavaWsdlMappingNode.java:73) [wscompile] at com.sun.xml.rpc.processor.generator.JaxRpcMappingGenerator.buildMapping(JaxRpcMappingGenerator.java:57) [wscompile] at com.sun.xml.rpc.processor.generator.JaxRpcMappingGenerator.perform(JaxRpcMappingGenerator.java:48) [wscompile] at com.sun.xml.rpc.processor.Processor.runActions(Processor.java:88) [wscompile] at com.sun.xml.rpc.tools.wscompile.CompileTool.run(CompileTool.java:739) [wscompile] at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:43) [wscompile] at com.sun.xml.rpc.tools.wscompile.Main.main(Main.java:22) [wscompile] java.lang.RuntimeException: Naming conflict occurred: [com.mcqueeney.ws.MyService] [wscompile] at com.sun.xml.rpc.processor.generator.JaxRpcMappingGenerator.buildMapping(JaxRpcMappingGenerator.java:65) [wscompile] at com.sun.xml.rpc.processor.generator.JaxRpcMappingGenerator.perform(JaxRpcMappingGenerator.java:48) [wscompile] at com.sun.xml.rpc.processor.Processor.runActions(Processor.java:88) [wscompile] at com.sun.xml.rpc.tools.wscompile.CompileTool.run(CompileTool.java:739) [wscompile] at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:43) [wscompile] at com.sun.xml.rpc.tools.wscompile.Main.main(Main.java:22) [wscompile] error: java.lang.RuntimeException: Naming conflict occurred: [com.mcqueeney.ws.MyService]
The only mention of this error I could find was a June 14th posting on a JBoss forum. The posted solution from Thomas Diesler of JBoss was to rename the service endpoint interface. That solution, inexplicably, worked.
After playing around for a few minutes,
I found a better solution,
at least for the above problem:
The naming conflict seems to be between the service name given in the wscompile
configuration file
and the class name of the SEI.
They were both named MyService
.
My easier solution was to give the service a different name in the config file,
for example:
<service name=”MyService_Service” … >
I still don’t know what causes the name conflict.
I’m guessing
the wscompile
tool writes some artifacts using the service name,
probably using a package name derived from the packageName
or targetNamespace
.
I could find no documentation on wscompile
on what it generates
based on the service name from the configuration file.
In looking at the classes wscompile
generated,
none seemed to conflict based on the service name.
Is it generating an implementation of
javax.xml.rpc.Service
using the name
attribute to the
Please leave a comment if you have knowledge of what artifact wscompile
produces
that cause the name conflict with the SEI.
I figure I’ll post this problem in case anyone else hits this “naming conflict” error.