0
votes

I have programmed a WebService. In SOAP UI it is working fine and in a Java Client Application it did, what i want. So the WebService is working fine. On the other side i have an EJB Module with a stateless EJB. The EJB's job is to call the SOAP-Webservice. The Annotation @WebServiceRef should be the solution as here described. So i have tried it out:

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

    @WebServiceRef(PrescriptiveKipService.class)
    private PrescriptiveTool service;

PrescriptiveKipService is extending Service (I have generated it with netbeans as in the Java-Client Application). PrescriptiveTool is the port's interface. Whenever i annotate @EJB IRecommendationCaller to inject it in another Bean for example, i get the following error:

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

What i'm missing? I would be grateful for your help!

UPDATE: It is a Maven project. Maybe it has to do with this kind of problem. This is my 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: I have compared the generated sources by Netbeans. I could see, that the "normal" Java Application has much more constructors. It seems to be a generation- version problem. The generated sources are commented as follows:

Generated classes in normal Java-Application (in Netbeans):

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

Generated classes in the not working Maven EJB-Project:

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

Hope that helps... I don't know that to do.

1

1 Answers

1
votes

Your pom.xml has lots of issues that I can see, but the one pertaining to your immediate problem is your jaws-maven-plugin configuration.

Remove the <artifactId>webservices-api</artifactId> dependency and change the target configuration to:

 <target>2.2</target>