FighterHayabusa
FighterHayabusa

Reputation: 331

Problems building and deploying JAX-RS 2.0 app on WebLogic 12.1.3 with Maven

We have an app running on WebLogic 12.1.3 and we would like to add some JAX-RS 2.0 services to it. We use Maven to build and deploy to the server (with the weblogic-maven-plugin).

To install JAX-RS 2.0 on the server I followed the steps given here:

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

Everything seems fine. No errors or warnings given during install and the library is visible in the WebLogic Administration Console.

But now when I do "mvn clean install" I'm getting this:

<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...)

Compiling with "-verbose" option doesn't render more information btw.

I've googled and searched StackOverflow thoroughly to the best of my ability but I can't seem to find an explanation or a solution to this issue.

Here are (I believe) the relevant parts of our 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>

and this is in our 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>

I'd be very appreciative if anybody with more experience and knowledge of WebLogic could point me towards a solution. I've mainly worked with JBoss and Glassfish previously and this is giving me a huge headache since I've never experienced anything like it with those application servers.

Upvotes: 0

Views: 3000

Answers (3)

Boris_Ndong
Boris_Ndong

Reputation: 247

You're probably missing the JAX-RS 2.0 library. Follow this to install it : Go into your server , click on install new Application/Library , then select the the path to Oracle-> Middleware-> wlserver-> common-> deployable-libraries and select the JAX-RS 2.0.war library . It worked for me

Upvotes: 0

devwebcl
devwebcl

Reputation: 3203

This happens because those library references are missing when trying to pre-compile the war with wls-appc.

those shared libraries must be in the classpath at compilation time.

Upvotes: 0

FighterHayabusa
FighterHayabusa

Reputation: 331

Solved it. The library-ref goes in META-INF/weblogic-application.xml, not in WEB-INF/weblogic.xml.

Upvotes: 0

Related Questions