Hi, Thats really confusing as I explicitly set the working directory and use very different directories for my wsdl etc.
perhaps its an osgi option thing hopefully someone else can shed some light on this cheers, Chris -----Original Message----- From: St Jacques, Robert [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2008 5:32 PM To: [email protected] Subject: RE: WSDL 2 Java Exception Chris et al, Thanks for the fast response. Since Friday I've done some experimenting with limited success. I think I've narrowed the problem down to the location of the WSDL file, which is just confusing me. But first, let me detail what I've done. The first thing I tried was to fork the Java process; you were correct that this made the "ignoring working directory" warning go away, but I got the same result; a null pointer exception on the same line. Next I tried your exec task; I copied exactly what you suggested and changed the paths to point to my local resources. Same result: a null pointer exception again. So, on a hunch, I decided to try to run the Java command from inside the Muse bin directory. Again, the same result: a null pointer. This really confused me, because I had earlier success running the "wsdl2java.bat". The only difference was that I'd copied the Math.wsdl file into the Muse bin directory. So I ran the same exact command again, but this time I copied the Math.wsdl file into the local directory first (instead of referencing it from another directory) and it worked. On another hunch, I ran the wsdl2java.bat in two different ways. This first one (with the .wsdl file in the working directory) works: C:\apache\muse-2.2.0-bin\bin>wsdl2java -verbose -osgi mini -wsdl Math.wsdl -output c:\temp\trash WARNING: [ID = 'NoWSRPSchema'] No WS-RP schema found. I get the warning above, but the files are all generated in the 'c:\temp\trash' folder as expected, and everything seems hunky dory. But if I change it to this: C:\apache\muse-2.2.0-bin\bin>wsdl2java -verbose -osgi mini -wsdl c:\eclipse\workspace\3.3.2\Disco\src\com\xerox\disco\ws\math\wsdl\Math.w sdl -output c:\temp\trash I don't get a warning about "NoWSRPSchema," but I do get the null pointer! Upon further experimentation I found that as long as I run the wsdl2java command from the same directory as the WSDL, it works fine. The WSDL does not need to be collocated with the wsdl2java.bat file. So why does this matter? Is there any way to fix it? In the short term I can just modify my ant target to copy the WSDL file into the working directory before I run the command. This should fix the problem. But I would rather be able to just reference the WSDL files from where they are in my source tree. Thanks, Bob -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2008 2:39 AM To: [email protected] Subject: RE: WSDL 2 Java Exception Hi Robert, I have found similar issues before, and found it simpler to just use: <target name="buildJvmRuntimeServer" description=""> <!-- build the thing --> <exec dir="." executable="cmd"> <arg line="/c C:\Dev32\muse-2.2.0-bin\bin\wsdl2java -j2ee mini -wsdl C:\Dev32\workspaceWSDM\Swisscom_SIF_ESB_Management\etc\management\wsdl\j vmRuntime.wsdl -output C:\Dev32\workspaceWSDM\Swisscom_SIF_ESB_Management\tmpSrc"/> </exec> </target> directly. The problem, I think, is [java] Working directory ignored when same JVM is used. ie. try with fork. But this is one code area I haven't searched through too thoroughly. Obviously the paths and options can use normal ant property syntax for easier reuse. cheers, Chris -----Original Message----- From: St Jacques, Robert [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2008 9:27 PM To: [email protected] Subject: WSDL 2 Java Exception 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
