2016-11-23 82 views
0

我们在WebLogic 12.1.3上运行了一个应用程序,我们希望为其添加一些JAX-RS 2.0服务。我们使用Maven构建并部署到服务器(使用weblogic-maven-plugin)。使用Maven在WebLogic 12.1.3上构建和部署JAX-RS 2.0应用程序时遇到的问题

要我跟着这里给出的步骤在服务器上安装JAX-RS 2.0:

https://docs.oracle.com/middleware/1213/wls/RESTF/use-jersey20-ri.htm#RESTF297

似乎一切都很好。安装过程中未出现错误或警告,并且WebLogic管理控制台中可以看到该库。

但现在,当我做“MVN净安装”我得到这个:

<Nov 23, 2016 2:39:00 PM CET> <Error> <J2EE> <BEA-160187> <weblogic.appc failed to compile the application. Recompile with the -verbose option for more details about the issue.> 
    [INFO] ------------------------------------------------------------------------ 
    [INFO] BUILD FAILURE 
    [INFO] ------------------------------------------------------------------------ 
    [INFO] Total time: 26.655s 
    [INFO] Finished at: Wed Nov 23 14:28:21 CET 2016 
    [INFO] Final Memory: 65M/872M 
    [INFO] ------------------------------------------------------------------------ 
    [ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.1.3-0-0:appc (wls-appc) on project our-awesome-app: weblogic.utils.compiler.ToolFailureException: Unresolved WebApp library references defined in weblogic.xml, of module 'our-awesome-app.war' [Extension-Name: jax-rs, Specification-Version: 2, Implementation-Version: 2.5.1, exact-match: false] 
    [ERROR] at weblogic.servlet.tools.WARModule.initWebAppLibraryManager(WARModule.java:449) 
    [ERROR] at weblogic.servlet.tools.WARModule.processLibraries(WARModule.java:492) 
    [ERROR] at weblogic.servlet.tools.WARModule.compile(WARModule.java:274) 
    [ERROR] at weblogic.application.compiler.ToolsModuleWrapper.compile(ToolsModuleWrapper.java:107) 
    (goes on and on...) 

与“-verbose”选项不BTW呈现更多的信息编制。

我已经用Google搜索并彻底搜索了StackOverflow,但我似乎无法找到解释或解决此问题的方法。

这里是(我相信)我们的pom.xml的相关部分:

<plugin> 
        <!-- This is the configuration for the weblogic-maven-plugin --> 
        <groupId>com.oracle.weblogic</groupId> 
        <artifactId>weblogic-maven-plugin</artifactId> 
        <version>12.1.3-0-0</version> 
        <configuration> 
         <middlewareHome>${wls-admin-middleware-home}</middlewareHome> 
         <adminurl>${wls-admin-url}</adminurl> 
         <user>${wls-admin-user}</user> 
         <password>${wls-admin-password}</password> 
         <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> 
         <targets>${wls-admin-targets}</targets> 
         <name>${project.build.finalName}</name> 
         <domainHome>${wls-admin-domain-home}</domainHome> 
         <securityModel>DDOnly</securityModel> 
        </configuration> 
        <executions> 
         <execution> 
          <id>wls-appc</id> 
          <phase>package</phase> 
          <goals> 
           <goal>appc</goal> 
          </goals> 
          <configuration /> 
         </execution> 
         <execution> 
          <id>wls-wlst-start-server</id> 
          <phase>pre-integration-test</phase> 
          <goals> 
           <goal>start-server</goal> 
          </goals> 
          <configuration> 
          </configuration> 
         </execution> 
         <execution> 
          <id>wls-deploy</id> 
          <phase>pre-integration-test</phase> 
          <goals> 
           <goal>deploy</goal> 
          </goals> 
          <configuration> 
           <securityModel>DDOnly</securityModel> 
          </configuration> 
         </execution> 
         <execution> 
          <id>wls-start-app</id> 
          <phase>pre-integration-test</phase> 
          <goals> 
           <goal>start-app</goal> 
          </goals> 
          <configuration /> 
         </execution> 
        </executions> 
       </plugin> 
... 
<dependencies> 
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-api</artifactId> 
      <version>7.0</version> 
      <scope>provided</scope> 
     </dependency> 

,这是我们的weblogic.xml:

<wls:library-ref> 
     <wls:library-name>jax-rs</wls:library-name> 
     <wls:specification-version>2.0</wls:specification-version> 
     <wls:implementation-version>2.5.1</wls:implementation-version> 
    </wls:library-ref> 

我会,如果有人非常赞赏有了更多的有关WebLogic的经验和知识,可以为我提供一个解决方案。我以前主要与JBoss和Glassfish合作过,这让我非常头痛,因为我从来没有遇到过像这样的应用服务器。

回答

0

解决了它。库-ref进入META-INF/weblogic-application.xml,而不是在WEB-INF/weblogic.xml中。

+1

weblogic.xml自9.0版以来有library-ref https://docs.oracle.com/cd/E13222_01/wls/docs90/webapp/weblogic_xml.html#1060332 – devwebcl

0

发生这种情况是因为在尝试使用wls-appc预编译war时缺少这些库引用。

这些共享库必须在编译时位于类路径中。

0

您可能会错过JAX-RS 2.0库。按照以下步骤安装它:进入你的服务器,点击安装新的应用程序/库,然后选择Oracle-> Middleware-> wlserver-> common-> deployable-libraries的路径,然后选择JAX-RS 2.0.war库。它对我有用

相关问题