我编写了一个WebService。在SOAP UI中,它运行良好,在Java客户端应用程序中,它做了,我想要的。所以WebService工作正常。另一方面,我有一个带有无状态EJB的EJB模块。 EJB的工作是调用SOAP-Webservice。注释@WebServiceRef
应该是所描述的here解决方案。所以我试过了:
@Stateless
@Remote(IRecomendationCaller.class)
public class RecommendationCallerBean implements IRecomendationCaller {
@WebServiceRef(PrescriptiveKipService.class)
private PrescriptiveTool service;
PrescriptiveKipService
正在扩展服务(我使用netbeans生成它,就像在Java客户端应用程序中一样)。 PrescriptiveTool
是端口的接口。每当我注释@EJB IRecommendationCaller
以将其注入另一个Bean时,我会收到以下错误:
引起:javax.naming.NamingException:WFLYNAM0062:查找失败 ENV / org.shitstorm.processapplicationejbs.RecommendationCallerBean /服务 [根异常是org.jboss.wsf.spi.WSFException:JBWS024104:服务 class org.shitstorm.wsclient。缺少PrescriptiveKipService 需要JAX-WS 2.2附加构造函数] org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:157) 在 org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:83) 在org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207) 在org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193) 在org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189) 在 org.jboss.as.naming.deployment.ContextNames $ BindInfo $ 1 $ 1.getReference(ContextNames.java:316) ... 137更多引起:org.jboss.wsf.spi.WSFException:JBWS024104: 缺少服务类org.shitstorm.wsclient.PrescriptiveKipService 需要JAX-WS 2.2附加构造函数 at org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceObjectFactoryJAXWS.instantiateService(CXFServiceObjectFactoryJAXWS.java:279) 在 org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceObjectFactoryJAXWS.getObjectInstance(CXFServiceObjectFactoryJAXWS.java:86) 在 org.jboss.wsf.stack.cxf.client.serviceref.CXFServiceRefFactoryImpl.newServiceRef(CXFServiceRefFactoryImpl.java:35) 在 org.jboss.as.webservices.webserviceref.WebServiceManagedReferenceFactory.getReference(WebServiceManagedReferenceFactory.java:37) 在 org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:143) ......还有142个
我失踪了什么?我很感激你的帮助!
更新:这是一个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>
更新2 :我已经比较了Netbeans生成的来源。我可以看到,&#34;正常&#34; Java Application有更多的构造函数。这似乎是一代版本的问题。生成的源如下评论:
普通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-Project中生成的类:
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.8
* Generated source version: 2.0
*
*/
希望有所帮助......我不知道该怎么做。
答案 0 :(得分:1)
您的pom.xml存在许多我可以看到的问题,但与您当前问题有关的问题是您的jaws-maven-plugin
配置。
删除<artifactId>webservices-api</artifactId>
依赖项并将目标配置更改为:
<target>2.2</target>