我有一个Maven应用程序.war
我正在使用Weblogic Maven Plugin(很棒的插件,顺便说一句),我正在将它部署到Weblogic服务器(当然)。不幸的是,我不断收到部署失败消息:
weblogic.deployment.EnvironmentException: [J2EE:160200]Error resolving ejb-ref 'com.vendor.thing.UsingHelloWorldEJB/h' from module 'myapp.war' of application 'myapp'. The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because no EJBs in the application were found to implement the 'com.vendor.thing.HelloWorld' interface. Please link or map this ejb-ref to its target EJB and ensure the interfaces declared in the ejb-ref are correct.
这个HelloWorld
EJB不是我的应用程序的一部分,我知道这个类的唯一地方,Weblogic甚至引用它都在我在.war中使用的类路径jar中。这是供应商.jar
,因此它们可能有一些我不使用或不知道的类是有意义的。在这种情况下,它似乎将EJB类捆绑到我无法删除的.jar
中。
我不是Weblogic专家,所以这种行为对我来说很奇怪。这个标准的servlet行为是否尝试链接然后基于某些任意类EJB而失败.war部署的EJB不是我的.war的一部分(除了作为类路径中的API .jar)?
如何将.war
部署到Weblogic服务器?我对此ejb-ref
一无所知,在使用Jetty本地运行时,它似乎也不会影响我的应用的工作方式。有没有办法告诉Weblogic忽略此.jar
或包范围内的所有类?
根据mhaller's answer,我做了一些调查,发现:
weblogic.xml
或类似)。.war
的行为与使用maven插件没什么不同(所以我认为weblogic-maven-plugin不会导致错误)web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.mypacakages.ws</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<!-- All web services will be under http://localhost:{port}/{context}/ws/ -->
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
</web-app>
答案 0 :(得分:0)
.war
文件是否包含您不需要的其他部署描述符。我怀疑maven-weblogic-plugin添加了自定义部署描述符。maven-war-plugin
。