2016-08-26 3 views
0

Я запрограммировал WebService. В пользовательском интерфейсе SOAP он работает нормально, и в приложении Java Client он сделал то, что я хочу. Таким образом, WebService работает нормально. С другой стороны, у меня есть модуль EJB с не имеющим аналогов EJB. Задача EJB - вызвать SOAP-Webservice. Аннотацию @WebServiceRef должно быть решением, описанным как here. Так что я попытался это:Использование JAX-WS WebService из безстоящего EJB

@Stateless 
@Remote(IRecomendationCaller.class) 
public class RecommendationCallerBean implements IRecomendationCaller { 

    @WebServiceRef(PrescriptiveKipService.class) 
    private PrescriptiveTool service; 

PrescriptiveKipService расширяет службы (я генерироваться его с NetBeans, как в Заявке Java-клиент). PrescriptiveTool - интерфейс порта. Всякий раз, когда я аннотировать @EJB IRecommendationCaller вводить его в другом Bean, например, я получаю следующее сообщение об ошибке:

Caused by: javax.naming.NamingException: WFLYNAM0062: Failed to lookup env/org.shitstorm.processapplicationejbs.RecommendationCallerBean/service [Root exception is org.jboss.wsf.spi.WSFException: JBWS024104: Service class org.shitstorm.wsclient.PrescriptiveKipService is missing required JAX-WS 2.2 additional constructors] at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:157) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:83) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189) at org.jboss.as.naming.deployment.ContextNames$BindInfo$1$1.getReference(ContextNames.java:316) ... 137 more Caused by: org.jboss.wsf.spi.WSFException: JBWS024104: Service class org.shitstorm.wsclient.PrescriptiveKipService is missing required JAX-WS 2.2 additional constructors at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceObjectFactoryJAXWS.instantiateService(CXFServiceObjectFactoryJAXWS.java:279) at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceObjectFactoryJAXWS.getObjectInstance(CXFServiceObjectFactoryJAXWS.java:86) at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceRefFactoryImpl.newServiceRef(CXFServiceRefFactoryImpl.java:35) at org.jboss.as.webservices.webserviceref.WebServiceManagedReferenceFactory.getReference(WebServiceManagedReferenceFactory.java:37) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:143) ... 142 more

Что я пропускаю? Буду признателен за вашу помощь!

ОБНОВЛЕНИЕ: Это проект Maven. Может быть, это связано с проблемой this. Это мой pom.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>org.shitstorm</groupId> 
    <artifactId>ProcessApplicationEJBs</artifactId> 
    <version>1.0</version> 
    <packaging>ejb</packaging> 

    <name>ProcessApplicationEJBs</name> 

    <properties> 
     <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 
    <!-- import Camunda BOM to ensure correct versions of Camunda projects --> 
    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.camunda.bpm</groupId> 
       <artifactId>camunda-bom</artifactId> 
       <version>7.5.0</version> 
       <scope>import</scope> 
       <type>pom</type> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <dependencies> 
     <!-- Camunda engine dependency --> 
     <dependency> 
      <groupId>org.camunda.bpm</groupId> 
      <artifactId>camunda-engine</artifactId> 
      <scope>provided</scope> 
     </dependency> 

     <!-- Camunda cdi beans --> 
     <dependency> 
      <groupId>org.camunda.bpm</groupId> 
      <artifactId>camunda-engine-cdi</artifactId> 
     </dependency> 

     <!-- provides a default EjbProcessApplication --> 
     <dependency> 
      <groupId>org.camunda.bpm.javaee</groupId> 
      <artifactId>camunda-ejb-client</artifactId> 
     </dependency>  
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-api</artifactId> 
      <version>7.0</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- Java EE 7 Specification --> 
     <dependency> 
      <groupId>org.jboss.spec</groupId> 
      <artifactId>jboss-javaee-7.0</artifactId> 
      <version>1.0.3.Final</version> 
      <type>pom</type> 
      <scope>provided</scope> 
      <exclusions> 
       <exclusion> 
        <artifactId>xalan</artifactId> 
        <groupId>xalan</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
    </dependencies> 

    <build> 
     <resources> 
      <resource> 
       <targetPath>META-INF</targetPath> 
       <directory>src</directory> 
       <includes> 
        <include>jax-ws-catalog.xml</include> 
        <include>wsdl/**</include> 
       </includes> 
      </resource> 
      <resource> 
       <directory>src/main/resources</directory> 
      </resource> 
     </resources> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
        <compilerArguments> 
         <endorseddirs>${endorsed.dir}</endorseddirs> 
        </compilerArguments> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-ejb-plugin</artifactId> 
       <version>2.5.1</version> 
       <configuration> 
        <ejbVersion>3.1</ejbVersion> 
        <generateClient>true</generateClient> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.6</version> 
       <executions> 
        <execution> 
         <phase>validate</phase> 
         <goals> 
          <goal>copy</goal> 
         </goals> 
         <configuration> 
          <outputDirectory>${endorsed.dir}</outputDirectory> 
          <silent>true</silent> 
          <artifactItems> 
           <artifactItem> 
            <groupId>javax</groupId> 
            <artifactId>javaee-endorsed-api</artifactId> 
            <version>7.0</version> 
            <type>jar</type> 
           </artifactItem> 
          </artifactItems> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.jvnet.jax-ws-commons</groupId> 
       <artifactId>jaxws-maven-plugin</artifactId> 
       <version>2.3</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>wsimport</goal> 
         </goals> 
         <configuration> 
          <wsdlFiles> 
           <wsdlFile>localhost_8080/ShitstormRecommenderEJB/PrescriptiveKipService/PrescriptiveBean.wsdl</wsdlFile> 
          </wsdlFiles> 
          <packageName>org.shitstorm.wsclient</packageName> 
          <vmArgs> 
           <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> 
          </vmArgs> 
          <wsdlLocation>http://localhost:8080/ShitstormRecommenderEJB/PrescriptiveKipService/PrescriptiveBean?wsdl</wsdlLocation> 
          <staleFile>${project.build.directory}/jaxws/stale/PrescriptiveBean.stale</staleFile> 
         </configuration> 
         <id>wsimport-generate-PrescriptiveBean</id> 
         <phase>generate-sources</phase> 
        </execution> 
       </executions> 
       <dependencies> 
        <dependency> 
         <groupId>javax.xml</groupId> 
         <artifactId>webservices-api</artifactId> 
         <version>2.0</version> 
        </dependency> 
       </dependencies> 
       <configuration> 
        <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir> 
        <xnocompile>true</xnocompile> 
        <verbose>true</verbose> 
        <extension>true</extension> 
        <catalog>${basedir}/src/jax-ws-catalog.xml</catalog> 
        <target>2.0</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

</project> 

UPDATE 2: Я сравнил сгенерированные источники от Netbeans. Я мог видеть, что «нормальное» Java-приложение имеет гораздо больше конструкторов. Кажется, это проблема с версией поколения. Сформированные источники прокомментированы следующим образом:

сгенерированных классов в обычном Java-приложений (в Netbeans):

/** 
* This class was generated by the JAX-WS RI. 
* JAX-WS RI 2.2.6-1b01 
* Generated source version: 2.2 
* 
*/ 

сгенерированных классов в не работает Maven EJB-проекта:

/** 
* This class was generated by the JAX-WS RI. 
* JAX-WS RI 2.2.8 
* Generated source version: 2.0 
* 
*/ 

Надежда это помогает ... Я не знаю, что делать.

ответ

1

У вашего pom.xml есть много проблем, которые я могу видеть, но одна из ваших ближайших проблем - ваша конфигурация jaws-maven-plugin.

Удалите <artifactId>webservices-api</artifactId> зависимость и изменение целевой конфигурации в:

<target>2.2</target>