【问题标题】:Weblogic Mvn Plugin Deploy Fails to Connect to server t3://localhost:7001Weblogic Maven 插件部署无法连接到服务器 t3://localhost:7001
【发布时间】:2015-01-05 00:58:00
【问题描述】:

提前感谢您的帮助。

我试图让 oracle weblogic mvn 插件在我的机器上正常运行,但我最终无法连接到管理服务器,并且插件错误消息对于跟踪问题不是很有用。

概述: 我基本上遵循了以下两页: (a) 在我的本地存储库中安装插件: http://docs.oracle.com/cd/E24329_01/web.1211/e24443/maven_deployer.htm#DEPGD383 (b) 配置maven插件 http://www.oracle.com/technetwork/articles/soa/eisele-weblogic-netbeans-2193786.html

所以我的配置如下:

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

上面的配置似乎没有任何错误: (a) (t3Url x 用户名 x 密码) 我可以很容易地验证这些是有效的

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

我也可以使用 WLST 连接到服务器: 正在初始化 WebLogic 脚本工具 (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) 上一点显示 (a) url,(b) 用户名​​,(c) 密码,(d) 目标管理服务器...基本上所有内容。

但在 mvn 中,运行 mvn 插件,我最终总是以以下异常结束。

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]

上面的异常消息是一个非常笨拙的消息: (a) 插件知道它给出的 url,它知道它没有被告知使用 http 它是 t3 protocl (b) 如果使用 url 端口并设置了一个无效端口,我确实会得到一个套接字异常,并且来自插件的异常消息是完全相同的......

应该有一个配置方面我有错误,管理服务器名称,隐藏的安全策略......一些东西,但我现在不知道它可能是什么。

顺便说一句,我已经评论了对服务器 pom 的依赖,因为你无法从远程存储库中获取这些依赖,而且我不知道 Web 逻辑服务器中的哪个 jar 隐藏了 pom。否则,我也会安装在我的本地存储库中。我怀疑这是否相关,因为插件似乎对尝试连接到 weblogic 感到满意。

非常感谢。

【问题讨论】:

    标签: netbeans deployment weblogic weblogic-maven-plugin


    【解决方案1】:

    按照有关如何安装 maven 插件的不同 oracle 指南修复了该问题。

    本指南似乎在安装 Web 逻辑插件方面做得更好。 http://docs.oracle.com/middleware/1213/wls/WLPRG/maven.htm

    引用 oracle 安装指南的相关部分。

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

    根据自己的产品安装路径调整指南,等待maven push命令构建成功。希望您从这次体验中获得的 weblogic 插件会比第一个指南安装的插件更好。

    在此之后,我唯一需要更改配置的就是插件版本。

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

    瞧,这一次我得到了一个工作插件,而不是一个虚构的玩具。

    【讨论】:

      【解决方案2】:

      您可以在文件夹 /weblogic/weblogic12/wlserver/modules 中的 com.oracle.weblogic.security.encryption_1.0.0.0.jar 中找到“KeyStoreConfiguration”。 只需将 KeyStoreConfiguration.class 输入 weblogic-maven-plugin,一切顺利!

      【讨论】:

      • 感谢您的回答。虽然它被否决了两次,但我尝试了这种方式并将 jar 作为依赖项放在 POM.xml 文件中。它现在正在工作。
      • 我给了你一点 :D 这对我来说太有用了,我正在从 Weblogic 之外的服务器配置我的 Maven 3.3,所以当我使用 weblogic-maven-plugin 时出现了这个错误。我刚刚将该 jar 添加到存储库中的同一个文件夹中,我必须修改 MANIFEST 以加载该 jar 并完成......不错的技巧
      • 非常感谢!我认为这是正确的解决方案。由于 oracle-maven-sync:push 安装/部署了所有需要的依赖项。
      • 您如何将 jar 作为依赖项包含在最终项目或 Weblogic POM 中?
      • @Neo 我所做的是修改.jar 所以我已经在weblogic插件中添加了所有需要的编译包,
      【解决方案3】:

      这与@crimsonwisp 给出的答案相同。感谢@DanielHernández 的 cmets。这是我摆脱的步骤

       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]
      

      从您的wlserver,找到 weblogic.security.encryption jar

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

      将这个jar的内容复制到weblogic-maven-plugin.jar。假设您在INSTALL_HOME/wlserver/server/lib 目录中。

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

      再次运行以安装 maven 命令以安装在本地存储库或任何您想要的位置。

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

      【讨论】: