我必须将一个软件项目从Websphere Application Server v8 (WAS8)迁移到Webphere from v17 (WL17),并遇到EJB的麻烦。
@Stateless
@Local(MyUserServiceLocal.class)
public class MyUserServiceBean implements MyUserServiceLocal {
@EJB
private OtherServiceLocal otherServiceLocal;
@Resource
private SessionContext context;
public MyUserServiceBean() {
}
public String getUserEmail() {...}
public String getUserDataId() throws ServiceException {...}
...
}具有相应的本地接口:
@Local
public interface MyUserServiceLocal {
public String getUserEmail();
public String getUserDataId() throws ServiceException;
...
}有更多的EJB遵循类似的实现方案。
该项目构建良好,所有Eclipse项目中的所有方面都被正确设置,maven创建了一个新的和可部署的EAR文件。但是,当我访问应用程序默认页面时,将引发以下嵌套异常:The MyUserServiceBean bean class for the MyApplication#MyUserServiceEjb.jar#MyUserServiceBean bean does not have a public constructor that does not take parameters.
目前,我无法想象为什么WL17会抛出此异常。WL的功能配置如下所示:
<featureManager>
<feature>appSecurity-2.0</feature>
<feature>cdi-1.2</feature>
<feature>distributedMap-1.0</feature>
<feature>ejbLite-3.2</feature>
<feature>ejb-3.2</feature>
<feature>jacc-1.5</feature>
<feature>jaxrs-2.0</feature>
<feature>jaxws-2.2</feature>
<feature>jca-1.7</feature>
<feature>jdbc-4.1</feature>
<feature>jndi-1.0</feature>
<feature>jpa-2.1</feature>
<feature>jsf-2.2</feature>
<feature>jsp-2.3</feature>
<feature>ldapRegistry-3.0</feature>
<feature>mdb-3.2</feature>
<feature>servlet-3.1</feature>
<feature>ssl-1.0</feature>
<feature>webCache-1.0</feature>
<feature>wmqJmsClient-2.0</feature>
</featureManager>当我不加载mdb或ejb特性时,我也是一样的。有什么办法解决这个问题吗?我在谷歌上搜了很多,还浏览了一半的互联网,但没有得到答案,也不知道如何解决这个问题。
发布于 2017-09-13 15:19:51
我发现了EJB的问题。其中一个接口方法被声明为抛出一个javax.xml.rpc.ServiceException。我不明白为什么这会是一个问题,但是在删除接口中的throws声明和实现类WL 17能够正确初始化bean之后。
https://stackoverflow.com/questions/46153007
复制相似问题