FileNotFoundException in Eclipse when creating a webservice

I am using SpringSource Tool Suite Version: 2.8.1.RELEASE

Some time whenever I am stuck up at creating a simple web service:

I created a test project called WebService (File > New > Dynamic Project)
Following one online tutorial to create a web service, I created a class as:
package com.dineshonjava.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

/**
 * @author Dinesh Rajput
 * Service Endpoint Interface
 */

@WebService
@SOAPBinding(style = Style.RPC)
public interface HelloWorld {
 @WebMethod 
 String sayHelloWorld(String name);
}


Next, I right Clicked WebServiceProject- > Web services > Create Web service
Type: Bottom up Java bean web service
Service implementation: com.dineshonjava.HelloWorldImpl

Upon clicking finish, i get the error:
IWAB0506E Error when copying Axis jar files to web project  
        java.io.FileNotFoundException: /lib/saaj.jar  
        at org.eclipse.osgi.framework.internal.protocol.bundleentry.Handler.findBundleEntry(Handler.java:44)  
        at org.eclipse.osgi.framework.internal.core.BundleResourceHandler.openConnection(BundleResourceHandler.java:168)  
        at java.net.URL.openConnection(Unknown Source)  
        at java.net.URL.openStream(Unknown Source)  
        at org.eclipse.jst.ws.internal.axis.consumption.ui.task.CopyAxisJarCommand.copyIFile(CopyAxisJarCommand.java:187)  
        at org.eclipse.jst.ws.internal.axis.consumption.ui.task.CopyAxisJarCommand.copyAxisJarsToProject(CopyAxisJarCommand.java:156)  
        at org.eclipse.jst.ws.internal.axis.consumption.ui.task.CopyAxisJarCommand.execute(CopyAxisJarCommand.java:109)  
        at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation$BottomUpWSModifyOperation.execute(BUCodeGenOperation.java:108)  
        at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation.execute(BUCodeGenOperation.java:80)  
        at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419)  
        at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359)  
        at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254)  
        at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$6.run(SimpleCommandEngineManager.java:294)  
        at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:458)  
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:366)  
        at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)  
        at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264)  
        at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91)  
        at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.getNextPage(WizardPageManager.java:154)  
        at org.eclipse.wst.command.internal.env.ui.widgets.SimpleWizardPage.getNextPage(SimpleWizardPage.java:136)  
        at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:813)  
        at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:369)  
        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:3823)  
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)  
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)  
        at org.eclipse.jface.window.Window.open(Window.java:801)  
        at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:253)  
        at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:273)  
        at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:281)  
        at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)  
        at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)  
        at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)  
        at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:247)  
        at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)  
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)  
        at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)  
        at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)  
        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:3823)  
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)  
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)  
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)  
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)  
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)  
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)  
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)  
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)  
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)  
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)  
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)  
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)  
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)  
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)  
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
        at java.lang.reflect.Method.invoke(Unknown Source)  
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)  
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)  
        at org.eclipse.equinox.launcher.Main.run(Main.java:1236)  

IWAB0398E Error in generating WSDL from Java:  java.lang.ClassNotFoundException: com.dineshonjava.ws.HelloWorldImpl
    java.lang.ClassNotFoundException: com.dineshonjava.ws.HelloWorldImpl
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1383)
    at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1076)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:187)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
    at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
    at org.apache.axis.wsdl.fromJava.Emitter.setCls(Emitter.java:2079)
    at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:188)
    at org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand.executeAntTask(Java2WSDLCommand.java:180)
    at org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand.execute(Java2WSDLCommand.java:95)
    at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation$BottomUpWSModifyOperation.execute(BUCodeGenOperation.java:122)
    at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation.execute(BUCodeGenOperation.java:86)
    at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419)
    at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359)
    at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254)
    at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$6.run(SimpleCommandEngineManager.java:294)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
    at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1029)
    at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264)
    at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91)
    at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.getNextPage(WizardPageManager.java:154)
    at org.eclipse.wst.command.internal.env.ui.widgets.SimpleWizardPage.getNextPage(SimpleWizardPage.java:136)
    at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:908)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:428)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
    at org.eclipse.jface.window.Window.open(Window.java:801)
    at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:257)
    at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:277)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
    at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
    at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)






For resolving this issue you have to follow the following steps:
1. downloading the file saaj.jar and copying it to the location: 

C:\Program Files (x86)\springsource\sts-2.8.1.RELEASE\plugins\org.apache.axis_1.4.0.v201005080400\lib


2. Eclipse points to the axis installation directory:

Window > Preferences > Web Services > Axis2 Preferences > Axis2 runtime location

3. Stop server and close all applications which uses java including eclipse(STS).
Open eclipse installation folder
Go to Plugins folder.
Search javax.xml.soap_1.3.0.*
Delete the javax.xml.soap_1.3.0.*****.jar file
Now open eclipse (STS) and try with your webservice.




References
Wikipedia for Web Service

 



<<Previous <<   || Index ||   >>Next >>

No comments:

Post a Comment