99Sono
99Sono

Reputation: 3687

Weblogic Mvn Plugin Deploy Fails to Connect to server t3://localhost:7001

and thanks in advance for the help.

I am trying to get the oracle weblogic mvn plugin to run properly on my machine, but I am ultimately having difficulty with the connection to the admin server, and the plugins error message is not very useful in tracking the issue.

Overview: I have essentially followed the following two pages to: (a) install the plugin on my local repository: http://docs.oracle.com/cd/E24329_01/web.1211/e24443/maven_deployer.htm#DEPGD383 (b) configure the maven plugin http://www.oracle.com/technetwork/articles/soa/eisele-weblogic-netbeans-2193786.html

So my configuration looks as follows:

<profiles>
        <profile>
            <id>weblogicDeploy</id>
            <properties>
                <weblogic.server.version>12.1.2.0</weblogic.server.version>
                <weblogic.server.adminurl>t3://127.0.0.1:7001</weblogic.server.adminurl>
                <weblogic.server.middlewareHome>D:/appservers/weblogic</weblogic.server.middlewareHome>    
                <weblogic.server.serverName>AdminServer</weblogic.server.serverName>                                
                <weblogic.server.userName>weblogic</weblogic.server.userName>                                
                <weblogic.server.password>welcome1</weblogic.server.password>                                
            </properties>
            <dependencies>
                <!--dependency>
                    <groupId>com.oracle.weblogic</groupId>
                    <artifactId>weblogic-server-pom</artifactId>
                    <version>${weblogic.server.version}</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency-->
            </dependencies>

            <build>
                <plugins>
                    <!--
                        To have access to this plugin one must follow this guide:
                        http://docs.oracle.com/cd/E24329_01/web.1211/e24443/maven_deployer.htm#DEPGD383
                        The plugin is bundled with the web logic server - we cannot get it from the web unless we install it
                        into our nexus ...                        
                        (1) D:\weblogic\wlserver\server\lib>java -jar wljarbuilder.jar -profile weblogic-maven-plugin
                        (2) jar xvf c:\tmp\weblogic-maven-plugin.jar META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml
                        (3) mvn install:install-file -Dfile=weblogic-maven-plugin.jar -DpomFile=META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml
                    -->
                    <plugin>
                        <!-- This is the configuration for the weblogic-maven-plugin -->
                        <groupId>com.oracle.weblogic</groupId>
                        <artifactId>weblogic-maven-plugin</artifactId>
                        <version>${weblogic.server.version}</version>
                        <configuration>
                            <middlewareHome>${weblogic.server.middlewareHome}</middlewareHome>
                        </configuration>
                        <executions>
                            <!-- Deploy the application to the WebLogic Server in the pre-integration-test phase -->
                            <execution>
                                <id>wls-deploy</id>
                                <!-- Summary Of phase: 
                                    process and deploy the package if necessary into an environment where integration tests can be run
                                -->
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                                <configuration>
                                    <!--The admin URL where the app is deployed. 
                                    Here use the plugin's default value t3://localhost:7001-->
                                    <adminurl>${weblogic.server.adminurl}</adminurl>
                                    <user>${weblogic.server.userName}</user>
                                    <password>${weblogic.server.password}</password>
                                    <!--The location of the file or directory to be deployed-->
                                    <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
                                    <!--The target servers where the application is deployed. -->
                                    <!--targets>${weblogic.server.serverName}</targets-->
                                    <verbose>true</verbose>
                                    <name>${project.build.finalName}</name>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

There is nothing in the above configuration that appears to be wrong: (a) The ( t3Url x userName x password) i can very easily validate that these are valid

$ netstat -an | grep "LISTEN" | grep "7001"
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:7001           0.0.0.0:0              LISTENING
  TCP    127.0.0.1:7001         0.0.0.0:0              LISTENING
....

I can also use WLST to connect to the server: Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect('weblogic','welcome1','t3://127.0.0.1:7001')
Connecting to t3://127.0.0.1:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "whateverdomain".

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

(c) The previous point shows (a) the url, (b) the user name, (c) the password, (d) the target admin server... essentially everything.

But in mvn, running the mvn plugin, I ultimately always end up with the following exception.

Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.1.2.0:deploy (wls-deploy) on project whatevermy-war: weblogic.deploy.api.tools.deployer.DeployerException: Unable to connect to 't3://127.0.0.1:7001': weblogic.security.utils.KeyStoreConfiguration. Ensure the url represents a running admin server and that the credentials are correct. If using http protocol, tunneling must be enabled on the admin server. -> [Help 1]

The exception message above is a very clumnsy one: (a) the plugin knows the url it was given, it knows it was not told to use http it is the t3 protocl (b) if a play with the url port and setup an invalid port, i do get a socket exception and the exception message from the plugin is exactly the same thing...

there ought to be a configuraiton aspect that i have wrong, admin server name, hidden security policies ... something, but I am at this point not seing what it may be.

By th way, I have commented the dependency on the server pom, since this onther of those dependencies that you cannot fetch from a remote repository and I do not know which jar in the web logic server is hiding the pom. Otherwise, i would have installed also in my local repository. I doubt this is relevant though, since the plugin seems to be satisfied with trying to connect to weblogic.

Many thanks.

Upvotes: 1

Views: 7004

Answers (3)

Neo
Neo

Reputation: 4880

This is the same answer given by @crimsonwisp. Thanks to @DanielHernández for his comments. Here are the steps I followed to get rid of

 Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.1.2.0:deploy (wls-deploy) on project whatevermy-war: weblogic.deploy.api.tools.deployer.DeployerException: Unable to connect to 't3://127.0.0.1:7001': weblogic.security.utils.KeyStoreConfiguration. Ensure the url represents a running admin server and that the credentials are correct. If using http protocol, tunneling must be enabled on the admin server. -> [Help 1]

From your wlserver, find the weblogic.security.encryption jar

$ find . -name com.oracle.weblogic.security.encryption*
./modules/com.oracle.weblogic.security.encryption_2.0.0.0.jar

Copy the contents of this jar into weblogic-maven-plugin.jar. Assuming you are in INSTALL_HOME/wlserver/server/lib directory.

$ mkdir -p /tmp/wlsmaven
$ cp ../../modules/com.oracle.weblogic.security.encryption_2.0.0.0.jar /tmp/wlsmaven/
$ cp weblogic-maven-plugin.jar /tmp/wlsmaven/
$ cd /tmp/wlsmaven
$ jar xvf com.oracle.weblogic.security.encryption_2.0.0.0.jar 
# Update jar with classes from weblogic.security.encryption jar
$ jar uvf weblogic-maven-plugin.jar weblogic
$ cd -
$ cp /tmp/wlsmaven/weblogic-maven-plugin.jar .

Run to install the maven command again to install in your local repo or whereever you want this to be.

$ mvn install:install-file -Dfile=weblogic-maven-plugin.jar -DpomFile=pom.xml

Upvotes: 1

crimsonwisp
crimsonwisp

Reputation: 31

u can find 'KeyStoreConfiguration' in com.oracle.weblogic.security.encryption_1.0.0.0.jar which in folder /weblogic/weblogic12/wlserver/modules. just put KeyStoreConfiguration.class input weblogic-maven-plugin, all goes well!

Upvotes: 2

99Sono
99Sono

Reputation: 3687

Fixed the issue by following a different oracle guide on how to install the maven plugin.

This guide seems to do a better job at installing the web logic plugin. http://docs.oracle.com/middleware/1213/wls/WLPRG/maven.htm

Quoting the relevant part of the oracle installation guide.

Install the Oracle Maven sync plug-in and run the push goal:

Change directory to ORACLE_HOME\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3.

mvn install:install-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar.

mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=c:\oracle\middleware\oracle_home\.

Adapt the guide to your own installtion path of the product, and wait for the maven push command to build successfully. Hopefully the weblogic plugin you will get out of this experiecen will turn out to be better than the one installed by the first guide.

After this, the only thing i needed to change in my configuration was the plugin version.

   <weblogic.server.version>12.1.2-0-0</weblogic.server.version>

And voila, this time I got a working plugin instead of a make-believe toy.

Upvotes: 2

Related Questions