我曾尝试使用eclipse indigo开发Web服务但生成wsdl文件(java2ws)后出现错误,它在Test Service Explorere向导上显示错误,导致之前生成的wsdl文件被擦除。因此,我手动将wsdl文件复制到temp文件夹并复制回欲望文件夹,但是从浏览器调用时会显示以下错误。
错误:
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
javax.xml.ws.Service.<init>(Service.java:57)
javax.xml.ws.Service.create(Service.java:687)
com.peter.client.CreditCardServiceClient.createServiceClient(CreditCardServiceClient.java:43)
com.peter.controller.CreditCardController.doPost(CreditCardController.java:106)
javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
root cause
org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:94)
org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
javax.xml.ws.Service.<init>(Service.java:57)
javax.xml.ws.Service.create(Service.java:687)
com.peter.client.CreditCardServiceClient.createServiceClient(CreditCardServiceClient.java:43)
com.peter.controller.CreditCardController.doPost(CreditCardController.java:106)
javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
root cause
javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'localhost:8080/CreditCardService/CreditcardService?WSDL'.: java.io.FileNotFoundException: localhost:8080/CreditCardService/CreditcardService?WSDL
com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:239)
org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
javax.xml.ws.Service.<init>(Service.java:57)
javax.xml.ws.Service.create(Service.java:687)
com.peter.client.CreditCardServiceClient.createServiceClient(CreditCardServiceClient.java:43)
com.peter.controller.CreditCardController.doPost(CreditCardController.java:106)
javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
root cause
java.io.FileNotFoundException: localhost:8080/CreditCardService/CreditcardService?WSDL
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434)
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:986)
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:143)
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:802)
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)
com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:239)
org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:90)
javax.xml.ws.Service.<init>(Service.java:57)
javax.xml.ws.Service.create(Service.java:687)
com.peter.client.CreditCardServiceClient.createServiceClient(CreditCardServiceClient.java:43)
com.peter.controller.CreditCardController.doPost(CreditCardController.java:106)
javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
这是屏幕截图的例外。 eclipse.buildId = M20120208-0800 java.version = 1.7.0_05 java.vendor = Oracle Corporation BootLoader常量:OS = win32,ARCH = x86,WS = win32,NL = en_US 框架参数:-vm C:\ Program Files \ Java \ jdk1.6.0_26 \ jre \ bin \ client \ jvm.dll -product org.eclipse.epp.package.jee.product 命令行参数:-os win32 -ws win32 -arch x86 -vm C:\ Program Files \ Java \ jdk1.6.0_26 \ jre \ bin \ client \ jvm.dll -product org.eclipse.epp.package.jee。产品
Error
Wed Aug 22 19:29:09 SGT 2012
Unexpected exception (com.ibm.rational.ttt.common.ui.dialogs.wimport.WImportUtil)
java.lang.RuntimeException: Unable to access localhost:8080/CreditCardWebService/services/CreditCardServicePort?wsdl
at com.ibm.rational.ttt.common.ui.dialogs.wimport.WImportUtil.createFile(WImportUtil.java:402)
at com.ibm.rational.ttt.common.ui.dialogs.wimport.WImportUtil.importUri(WImportUtil.java:346)
at com.ibm.rational.ttt.common.ui.dialogs.wimport.WImportUtil.importSomethingRunnable(WImportUtil.java:218)
at com.ibm.rational.ttt.common.ui.dialogs.wimport.WImportUtil$1.run(WImportUtil.java:136)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at com.ibm.rational.ttt.common.ui.dialogs.wimport.WImportUtil.importSomething(WImportUtil.java:134)
at com.ibm.rational.ttt.ustc.api.GSC.importWSDL(GSC.java:108)
at com.ibm.rational.ttt.ustc.api.GSC.importWSDL(GSC.java:96)
at com.ibm.ast.ws.gsc.internal.GSCUtils.getWSDLFile(GSCUtils.java:156)
at com.ibm.ast.ws.gsc.internal.GSCDialog.loadWSDL(GSCDialog.java:69)
at com.ibm.ast.ws.gsc.internal.GSCDialog.createDialogArea(GSCDialog.java:59)
at org.eclipse.jface.dialogs.TitleAreaDialog.createContents(TitleAreaDialog.java:155)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
at com.ibm.ast.ws.gsc.internal.GSCLaunchCommand.launchExternally(GSCLaunchCommand.java:85)
at com.ibm.ast.ws.gsc.internal.GSCLaunchCommand.execute(GSCLaunchCommand.java:146)
at org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WSDLTestLaunchCommand.commandFactoryExecution(WSDLTestLaunchCommand.java:97)
at org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WSDLTestLaunchCommand.execute(WSDLTestLaunchCommand.java:72)
at org.eclipse.jst.ws.internal.creation.ui.widgets.test.ServiceTestWidget.handleLaunchButton(ServiceTestWidget.java:105)
at org.eclipse.jst.ws.internal.creation.ui.widgets.test.ServiceTestWidget.access$0(ServiceTestWidget.java:84)
at org.eclipse.jst.ws.internal.creation.ui.widgets.test.ServiceTestWidget$1.widgetSelected(ServiceTestWidget.java:68)
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:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
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(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:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
有没有办法手动生成wsdl?
我尝试输入java2s,但它说该命令无法识别 作为内部计划。
请帮忙。
感谢。
答案 0 :(得分:0)
通过删除RequestWrapper的生成和部署成功来解决问题。