0

我尝试使用 cxf maven 插件从 java first 策略生成 wsdl,它编译、构建良好但只生成 wsdl 而不是应该使用包 *.jaxws 创建的包装器 bean。因此,当使用 weblogic ( 10.0 ) 进行部署时,它会抛出:

class: com.edf.ftn.ws.jaxws.GetIban could not be found
    at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:272)
    at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:566)
    at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:513)
    at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:358)
    at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:245)
    at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:229)
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:161)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:291)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:315)
    at weblogic.wsee.jaxws.JAXWSServlet.registerEndpoint(JAXWSServlet.java:125)
    at weblogic.wsee.jaxws.JAXWSServlet.init(JAXWSServlet.java:64)
    at javax.servlet.GenericServlet.init(GenericServlet.java:241)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:282)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:63)
    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:507)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1853)
    at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1830)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1750)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2918)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:973)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:361)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:566)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:104)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:816)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1223)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:434)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:161)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:464)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)

这是我的 pom.xml 配置:

        <plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-java2ws-plugin</artifactId>
    <version>2.6.2</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-simple</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
    </dependency>
        <!-- Jetty is needed if you're are not using the CXFServlet -->
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http-jetty</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    </dependencies>

    <executions>
        <execution>
            <id>process-classes</id>
            <phase>package</phase>
            <configuration>
                <className>com.edf.ftn.ws.InfosRibProducteurImpl</className>
                <genWrapperbean>true</genWrapperbean>
                <genServer>true</genServer>
            <outputFile>com.edf.ftn.ws.jaxws</outputFile>
            <classpath>com.edf.ftn.ws.jaxws</classpath>
                <genWsdl>true</genWsdl>
                <verbose>true</verbose>
            </configuration>
            <goals>
                <goal>java2ws</goal>
            </goals>
        </execution>
    </executions>
</plugin>

这是我的网络服务接口类:

@WebService(name="InfosRibProducteurService")
@SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL,parameterStyle=ParameterStyle.WRAPPED)
@Policies({ @Policy( uri ="META-INF/policy/usernametoken.xml", placement=Policy.Placement.BINDING) } )
public interface InfosRibProducteur {

    @WebMethod 
    @WebResult(name = "responsegetIban")String getIban(@XmlElement(nillable = false, required = true) @WebParam(name = "fournisseur") final String pNumeroFournisseur);

    @WebMethod  
    @WebResult(name = "responseEditIban") ResponseRibDTO editIban(@XmlElement(nillable = false, required = true) @WebParam(name = "Fournisseur")final String pNumeroFournisseur, @XmlElement(nillable = false, required=true) @WebParam(name = "iban") final String pRib);

}

任何帮助都将受到欢迎,谢谢。

4

2 回答 2

0

尝试删除 outputFile 和 classpath 条目。在这种情况下可能不需要这些,并且可能会导致问题。它们也是错误的,因为 outputFile 应该是生成的 wsdl 文件的完整路径。喜欢:${basedir}/target/generated/wsdl/MyWsdl.wsdl

于 2012-11-30T16:48:07.300 回答
0

这对我有用。

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-java2ws-plugin</artifactId>
    <version>${cxf.version}</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-simple</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
            <type>jar</type>
        </dependency>
    </dependencies>

    <executions>
        <execution>
            <id>generate-wsdl</id>
            <phase>process-classes</phase>                              
            <goals>
                <goal>java2ws</goal>
            </goals>
            <configuration>
                <className>com.demo.helloworld</className>
                <outputFile>./WebContent/wsdl/helloworld.wsdl</outputFile>
                <argline>-createxsdimports</argline>
                <verbose>true</verbose>
                <frontend>jaxws</frontend>
                <databinding>jaxb</databinding>
                <genWsdl>true</genWsdl>
                <genWrapperbean>true</genWrapperbean>
                <soap12>false</soap12>
                <attachWsdl>true</attachWsdl>
            </configuration>                        
        </execution>
    </executions>
</plugin>
<plugin>
  <artifactId>maven-resources-plugin</artifactId>
  <version>3.0.2</version>
  <executions>
    <execution>
      <id>copy-resources</id>
      <phase>process-classes</phase>
      <goals>
        <goal>copy-resources</goal>
      </goals>
      <configuration>
        <outputDirectory>./target/classes/com/demo/jaxws</outputDirectory>
        <resources>
          <resource>
            <directory>./com/demo/jaxws</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            <filtering>false</filtering>
          </resource>
        </resources>
      </configuration>
    </execution>
  </executions>
</plugin>
于 2018-08-22T06:38:15.010 回答