-1

I am working on eclipse plugin which will have a wizard. This wizard will be available form example from context menu while mouse right click on Java editor.

The wizard will be responsible for collecting such information as:

  • location of WSDL file
  • Package name

When the wizard finishes, I would like to have stub of a webservice described in WSDL generated into package provided earlier.

THE QUESTION IS: How can I generate webservice stub dymanically and from source code (not from command line) and add it to the current project?

Until now, I came across WSDL2Java (Axis), Apache CXF and wsimport. I try to use Apache CXF and wsimport but I'm always getting ClassNotFoundException even though all jars are included into buildpath. I think I might have used them incorrectly.

Please help me folks! Time for that task is running out :-(

Little example:

Let's say the code is (Apache CXF):

String[] args = {"-client", "-d", "D:\\test", "D:\test.wsdl" };
WSDLToJava w = new WSDLToJava(args);
ToolContext t = new ToolContext();
w.run(t);

The first few lines of exception are:

java.lang.NoClassDefFoundError: org/apache/cxf/tools/wsdlto/WSDLToJava
    at plugin.wsreplication.ui.wizard.component.AddComponentWizard.performFinish(AddComponentWizard.java:160)
    at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:752)
    at plugin.wsreplication.ui.wizard.component.AddComponentWizardDialog.finishPressed(AddComponentWizardDialog.java:39)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
    at org.eclipse.jface.window.Window.open(Window.java:801)
    at plugin.wsreplication.ui.action.AddComponentAction.run(AddComponentAction.java:35)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
MarcinK
  • 1
  • 1
  • 2
  • "I'm always getting ClassNotFoundException even though all jars are included into buildpath. I think I might have used them incorrectly." can you post the exact exception, steps you took to use them, etc? – matt b Jun 28 '10 at 20:32
  • As I recall, wsimport requires the Java SDK to be installed, not just the JRE. – Powerlord Jun 28 '10 at 20:34
  • Does buildpath imply they are on the classpath when you run it? You still need to specify the classpath when you run your program after it has been built. – NG. Jun 28 '10 at 20:35
  • Go into details: what should be done accodring to the context I described? Details please, which files shoud be included into build path in order to be correct? – MarcinK Jun 28 '10 at 20:39

3 Answers3

0

I had the same issue. stumbled across this question in stack overflow. The issue got resolved as soon I restarted the eclipse.

The issue was due to Apache CXF jars not set in eclipse. Once the home path of CXF is set in eclipse. Eclipse needs to be restarted to pick up the jars.Hope this is helpful for someone who is facing the same issue

Allwin
  • 41
  • 7
0

Sounds to me like cxf-tools is not on your Classpath.

I'm not sure how it works with Eclipse plugins and OSGi, and exactly how to specify a classpath for your plugin, but you need to be able to specify where the CXF JARs are on the classpath.

matt b
  • 138,234
  • 66
  • 282
  • 345
  • I think that the problem could be in a classpath during runtime. While developing plugin, I set up all environment and it works. When I install plugin in Eclipse (different one, let's say with default settings) cxf is not present. Is it possible? Should I add some dependencies to the plugin? – MarcinK Jun 28 '10 at 21:20
  • Got it done. Tools were on developing environment's classpath whereas at runtime the package were not included. The solution was to add tools to runtime environment's classpath – MarcinK Jun 30 '10 at 14:10
0

It seems like you have done an error while setting up an environment for the plugin. Check this list for details. If the error will not disappear, try to figure out an actual class path with System.getProperty("java.class.path"). If jar is really on a classpath, the problem may be in an Eclipse itself.

ffriend
  • 27,562
  • 13
  • 91
  • 132