Archive for weblogic 10.3

Weblogic 10.3 and Maven Integration

(Update: I’m moving this article and the t3 channel creation step to my permanent blog here)

So another one for my notes. After searching in-vain for proper way to integrate the Weblogic 10.3 with maven, I think the solution below is working very well for me. We are going to use the weblogic-maven-plugin from codehaus. All the current solution including the plugin documentation requires either installing a bunch of

Requirements:

  • You have a WL 10.3 installation
  • JDK5
  • Maven 2.0.9 or above

Required Steps

We will break it down into three main steps. One of the steps could be avoided if the weblogic-maven-plugin authors did not hard-code weblogic dependencies which are not available in the Maven repositories anyway (or if maven could support excluding plugin dependencies).

  1. Building the uber weblogic jar and publishing it to your local or organization repository.
  2. Downloading the weblogic-maven-plugin pom and jar.
  3. Configuring WL 10.3 a non-ssl admin channel

Step 1. Building the uber weblogic jar

There is a way to build a full weblogic client jar, so we don’t have to figure out what jars we need. For this of course you need a WL 10.3 installation. The instruction are actually given here (weblogic jarbuilder tool). If you follow the steps then you should have a wlfullclient.jar, in the WL_HOME/sever/lib folder. Here is how it looks like:

C:\>java -jar ...
...
Created new jar file: C:\..\server\lib\wlfullclient.jar
...
Now, we will use maven to install this for this example in our local repository (you can use deploy to publish it to your org. repo, such as Nexus).
$ mvn install:install-file -Dfile=wlfullclient.jar \
    -DgroupId=weblogic -DartifactId=wlfullclient \
    -Dversion=10.3 -Dpackaging=jar -DgeneratePom=true

Note the use of the character "\" is just a *nix newline escape, basically the whole thing above should be on one line.
 

Step 2. Download and modify the weblogic-maven-plugin POM and jar

As mentioned before, we need to modify the pom because of hard coded dependency to weblogic. So what we do here is:

  • Download the POM
  • Change the version in the pom and delete the 2 weblogic dependencies
  • Then install the Pom and the associated jar into our repository (local).

Download the POM & Jar

Download the POM from here (weblogic-maven-plugin pom) and then also download the jar. So first we download the POM and change as shown below:

<project xmlns=http://maven.apache.org/POM/4.0.0>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>mojo</artifactId>
    <groupId>org.codehaus.mojo</groupId>
    <version>14</version>
  </parent>
  <prerequisites>
    <maven>2.0</maven>
  </prerequisites>
  <artifactId>weblogic-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <name>Weblogic Maven Plugin</name>
  <version>2.9.1-001</version>  <!-- CHANGED -->
  ...
  <dependencies>
        ...
    <!-- COMMENT OUT THE 2 WL DEPENDENCIES
    <dependency>
      <groupId>weblogic</groupId>
      <artifactId>weblogic</artifactId>
      <version>[9.0,11.0)</version>
    </dependency>
    <dependency>
      <groupId>weblogic</groupId>
      <artifactId>webservices</artifactId>
      <version>[9.0,11.0)</version>
    </dependency>
     -->
       ...
  </dependencies>
  ...
</project>

Notice the comment CHANGED lines. Now we install this pom and the downloaded jar into our local repository because of the changes.

mvn install:install-file -Dfile=weblogic-maven-plugin-2.9.1.jar \
                         -DpomFile=weblogic-maven-plugin-2.9.1-001.pom \
                         -DgroupId=org.codehaus.mojo \
                         -DartifactId=weblogic-maven-plugin \
                         -Dversion=2.9.1-001 \
                         -Dpackaging=maven-plugin

Important things to note above:

  • -DpomFile  the pom file is the edited one as we did before, I called the edited pom weblogic-maven-plugin-2.9.1-001.pom
  • The version -Dversion=2.9.1-001
  • And the packaging (very important) -Dpackaging=maven-plugin

Now, of course in your project you would use this version of the installed plugin.

Step 3. Create an admin channel in Weblogic 10.3

Ok, we need to do this step because for some reason WL 10.3, you can no longer do the deploys using the t3. Only SSL is allowed, and for some reason the uber jar does not include a particular implementation and I did not have the time to investigate it. <TODO>Another post describing the process</TODO> (Update: The steps is described here.)

Putting it all together

Ok, after you have done all the 3 steps, here is how the configuration looks like. Enjoy and leave a comment if this was useful or need more clarification.

    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>weblogic-maven-plugin</artifactId>
      <version>2.9.1-001</version>
      <inherited>true</inherited>
      <configuration>
        <adminServerHostName>localhost</adminServerHostName>
        <adminServerPort>7001</adminServerPort>
        <adminServerProtocol>t3</adminServerProtocol>
        <userId>weblogic</userId>
        <password>weblogic</password>
        <upload>true</upload>
        <remote>true</remote>
        <verbose>true</verbose>
        <debug>false</debug>
        <targetNames>my_admin_server</targetNames>
        <noExit>true</noExit>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>weblogic</groupId>
          <artifactId>wlfullclient</artifactId>
          <version>10.3</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </plugin>

Few things to note here:

  • The adminServerPort corresponds to 7001, this is the port I configured in the Step 3 (admin channel)
  • Also note, the wlfullclient dependency I chose to add it here, instead of the edited pom in Step 2. Of course this requires Maven 2.0.9 and above.
  • Also the plugin version is 2.9.1-001 the one we installed in Step 2.

So that’s it.

Advertisements

Comments (13)