【问题标题】:Can't deploy war to Weblogic--server is unable to resolve classpath ejb-refs that aren't mine无法将战争部署到 Weblogic——服务器无法解析不是我的类路径 ejb-refs
【发布时间】:2010-12-28 01:19:09
【问题描述】:

我有一个 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 或包范围内的所有类?

编辑 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】:
    • 检查最终的.war 文件是否包含您不需要的其他部署描述符。我怀疑 maven-weblogic-plugin 添加了自定义部署描述符。
    • 请改用maven-war-plugin。

    【讨论】:

      猜你喜欢
      • 2013-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-12
      相关资源
      最近更新 更多