我們在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合作過,這讓我非常頭痛,因爲我從來沒有遇到過像這樣的應用服務器。
weblogic.xml自9.0版以來有library-ref https://docs.oracle.com/cd/E13222_01/wls/docs90/webapp/weblogic_xml.html#1060332 – devwebcl