无法将战争部署到Weblogic - 服务器无法解析不属于我的类路径ejb-refs

问题描述 投票:0回答:1

我有一个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部署不是我的.war的一部分(除了作为类路径中的API .jar)?

怎么修?

如何将我的.war部署到Weblogic服务器?我对这个ejb-ref一无所知,在使用Jetty本地运行时,它似乎也不会影响我的应用程序的工作方式。有没有办法告诉Weblogic忽略这个.jar或包范围内的所有类?

EDIT 1

根据mhaller's answer,我做了一些调查,发现:

  • weblogic-maven-plugin使用maven-war-plugin生成的.war,因此它不会干扰战争的产生。
  • 除了我的web.xml之外,没有其他部署描述符(没有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>
maven weblogic ejb classpath jersey
1个回答
0
投票
  • 检查最终的.war文件是否包含您不需要的其他部署描述符。我怀疑maven-weblogic-plugin添加了自定义部署描述符。
  • 请改用maven-war-plugin
© www.soinside.com 2019 - 2024. All rights reserved.