I'm trying to work with Muse 2.2.0 from inside an existing Eclipse
project. I've been trying to write an ant target that will run the
WSDL-2-Java tool on our WSDL files. Right now the target is extremely
primitive, with some parts hard coded to point to a specific WSDL file
just to see if I can get it to work. So far, I haven't had much
success. Here's what the target looks like:
<property name="muse_lib" value="${lib_dir}/muse"/>
<path id="muse.class.path">
<fileset dir="${muse_lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="wsdl-to-java">
<java dir="${build_dir}"
classname="org.apache.muse.tools.generator.Wsdl2Java"
classpathref="muse.class.path">
<sysproperty key="MUSE_HOME"
value="C:/apache/muse-2.2.0-bin/"/>
<arg value="-osgi"/>
<arg value="mini"/>
<arg value="-wsdl"/>
<arg
value="${project_src}/com/xerox/disco/ws/math/wsdl/Math.wsdl"/>
</java>
</target>
I have copied all of the Muse required libraries into subdirectories of
"${lib_dir}/muse". As you can see from the target I'm running the
Wsdl2Java target with the JVM argument to set "MUSE_HOME" to my Muse
install location, and the program arguments "-osgi mini -wsdl <WSDL
file>". Executing this same command from the command line using the
.bat files included with Muse works just fine; there are no errors
(there is one warning about a missing schema), and all of the expected
files and directories are generated.
However, when I run the target, I get this error:
Buildfile: C:\eclipse\workspace\3.3.2\Disco\scripts\build.xml
wsdl-to-java:
[java] Working directory ignored when same JVM is used.
[java] java.lang.NullPointerException
[java] at
org.apache.muse.tools.inspector.ResourceInspector.getPortType(ResourceIn
spector.java:666)
[java] at
org.apache.muse.tools.inspector.ResourceInspector.run(ResourceInspector.
java:876)
[java] at
org.apache.muse.tools.generator.analyzer.SimpleAnalyzer.inspect(SimpleAn
alyzer.java:409)
[java] at
org.apache.muse.tools.generator.analyzer.SimpleAnalyzer.analyze(SimpleAn
alyzer.java:348)
[java] at
org.apache.muse.tools.generator.Wsdl2Java.run(Wsdl2Java.java:178)
[java] at
org.apache.muse.tools.generator.Wsdl2Java.main(Wsdl2Java.java:270)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at
org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at
org.apache.tools.ant.taskdefs.Java.run(Java.java:747)
[java] at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:201)
[java] at
org.apache.tools.ant.taskdefs.Java.execute(Java.java:104)
[java] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[java] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown
Source)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:1
05)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at
org.apache.tools.ant.Target.execute(Target.java:357)
[java] at
org.apache.tools.ant.Target.performTasks(Target.java:385)
[java] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[java] at
org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[java] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:41)
[java] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)
[java] at
org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[java] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)
[java] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)
[java] SEVERE: [ID = 'CodeGenFailed'] Code generation failed, see
the exception information below.
[java] An exception was caught: null
[java] Java Result: 1
I did a quick Google search for similar errors and found only one match,
and no solution. I also grabbed the source for the ResourceInspector
from the Muse SVN repository and found the line generating the error
(the first line of the method below):
private QName getPortType(Definition wsdl)
{
Map services = wsdl.getServices(); <--<--<--
if (services.size() != 1)
throw new
RuntimeException(_MESSAGES.get("OneServicePerWSDL"));
Service service = (Service)services.values().iterator().next();
Map ports = service.getPorts();
if (ports.size() != 1)
throw new RuntimeException(_MESSAGES.get("OnePortPerWSDL"));
Port port = (Port)ports.values().iterator().next();
PortType portType = port.getBinding().getPortType();
return portType.getQName();
}
It looks as though the Definition argument is null, but I have no idea
what would cause that. I'm going to start tracing it farther up the
stack, but I was hoping that someone on the user list might have run
into this problem before, and might be able to help.
Thanks,
Bob