Giter Site home page Giter Site logo

was-maven-plugin's Introduction

was-maven-plugin is looking for new maintainer

was-maven-plugin Build Status Maven Central

Introduction

Maven plugin to deploy a single war or ear to one or multi local or remote WebSphere Application Server (WAS) at a single build.
Tested on WAS 8.5
Requires: WebSphere Application Server installation on host box! But no need to be configured, nor running.

Requires: JDK 6 or later

How It Works

These are the known popular ways that you can programmly have your war/ear deployed to a running WebSphere Application Server:

JMX

Using IBM specialized JMX APIs you could not only retrieve the information of the apps, but also you can do deployment.

2 jars from WebSphere are required along with your build.

  • com.ibm.ws.admin.client_x.x.x.jar (over 50MB)
  • com.ibm.ws.orb_x.x.x.jar (about 2MB)

It does NOT support all options for deployment!

Monitored Directory Deployment

Deployment by adding your packages to a monitoredDeployableApps subdirectory of an application server or deployment manager profile.

For more information, please check: http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/trun_app_install_dragdrop.html

In order to deploy to a remote WAS, you'll have to copy/upload your packages to remote host first thru sftp or other approaches.

It's turned off by default.

Ant Tasks

WebSphere provides a set of built-in ant tasks, by using which you could also programmly have your packages deployed to WAS.

http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.javadoc.doc/web/apidocs/com/ibm/websphere/ant/tasks/package-summary.html

Ant tasks are in the end been translated to jacl script and been executed in wsadmin client.

wsadmin client (what we are using)

wsadmin client tool is the most powerful and flexible tool from OPS' perspective, which locates in $WAS_HOME/bin/wsadmin.sh.

It supports 2 scripting languages: jacl (default) and jython (recommended).

It uses WebSphere built-in security (credencials) and file transfer protocal (no sftp is needed) for a remote deployment.

JMX and Ant Tasks approaches were also implemented in the beginning, but we had them removed before 1.0.2

Goal-deploy

The only goal of this plugin, it will:

  1. Check if an application with the same name already installed on target server(s)/cluster(s)
  • Uninstall it if yes
  1. Install the package to target server(s)/cluster(s)
  2. Restart target server(s)/cluster(s)

Parameters

Name Type Description
wasHome String WebSphere Application Server home. Default: ${env.WAS_HOME}, required
applicationName String Application name displayed in admin console. Default: ${project.build.finalName}
applicationNameSuffix String Will be appended to applicationName, as applicationName_applicationNameSuffix, property file only
host String Local/Remote WAS IP/domain URL. e.g. 10.95.0.100, devtrunk01.company.com, default: localhost
port String Default: 8879 (when cluster not empty); 8880 (when cluster empty)
connectorType String Default: SOAP
cluster String Target cluster name, required if target WAS is a cluster
cell String Target cell name
node String Target node name,
server String Target server name,
webservers String Target web server(s) name, comma-separated.
virtualHost String Target virtual host name
user String Account username for target WAS admin console, if global security is turned on
password String Account password for target WAS admin console, if global security is turned on
contextRoot String required for war deployment
sharedLibs String Bind the exist shared libs to ear/war, comma-separated (,)
parentLast Boolean true to set classloader mode of application to PARENT_LAST, default false
restartAfterDeploy Boolean true to restart server after deploy, false to start application directly. Default true
webModuleParentLast Boolean true to set classloader mode of web module to PARENT_LAST, default false
packageFile String The EAR/WAR package that will be deployed to remote RAS, Default: ${project.artifact.file}
failOnError Boolean Default: false Whether failed the build when failed to deploy.
verbose Boolean Whether show more detailed info in log
script String Your own jython script for deployment. Double braces for variables, such as: {{cluster}}
scriptArgs String Args that will be passed to the script
javaoption String Sample -Xmx1024m, -Xms512m -Xmx1024m
deployOptions String Sample -precompileJSPs, -precompileJSPs -deployws
preSteps Ant tasks Ant tasks that can be executed before the deployments
postSteps Ant tasks Ant tasks that can be executed after the deployments
deploymentsPropertyFile File For multi target, hold above parameters, except those in bold. Default: was-maven-plugin.properties

Generally, you need to specify at least

  • cluster for a cluster
  • server and node for a non-cluster

Single Target Server

<plugin>
  <groupId>com.orctom.mojo</groupId>
  <artifactId>was-maven-plugin</artifactId>
  <version>${latest-version}</version>
  <executions>
    <execution>
      <id>deploy</id>
      <phase>install</phase>
      <goals>
        <goal>deploy</goal>
      </goals>
      <configuration>
        <wasHome>${env.WAS_HOME}</wasHome>
        <applicationName>${project.build.finalName}</applicationName>
        <host>localhost</host>
        <server>server01</server>
        <node>node01</node>
        <virtualHost>default_host</virtualHost>
        <verbose>true</verbose>
      </configuration>
    </execution>
  </executions>
</plugin>

Multi Target Servers

was-maven-plugin.properties

This property file contains the meta config for target WAS.
The section name will be used to identify each target WAS.

Please put was-maven-plugin.properties to the same folder as pom.xml, to make it available as ${project.basedir}/was-maven-plugin.properties

[DEFAULT]
virtualHost=default_host

[dev-trunk1]
host=devtrunk1.company.com
applicationNameSuffix=trunk1
cluster=cluster01
server=server01

[dev-trunk2]
host=devtrunk2.company.com
applicationNameSuffix=trunk2
cluster=cluster02
server=server02

[dev-trunk3]
host=devtrunk3.company.com
applicationNameSuffix=trunk3
cluster=cluster03
server=server03
virtualHost=devtrunk3_host

pom.xml

<plugin>
  <groupId>com.orctom.mojo</groupId>
  <artifactId>was-maven-plugin</artifactId>
  <version>${latest-version}</version>
  <executions>
    <execution>
      <id>deploy</id>
      <phase>install</phase>
      <goals>
        <goal>deploy</goal>
      </goals>
      <configuration>
        <wasHome>${env.WAS_HOME}</wasHome>
        <verbose>true</verbose>
      </configuration>
    </execution>
  </executions>
</plugin>

Deploy to dev-trunk1 and dev-trunk2

mvn clean install -Ddeploy_targets=`dev-trunk1`,`dev-trunk2`

Deploy to dev-trunk2 and dev-trunk3

mvn clean install -Ddeploy_targets=`dev-trunk2`,`dev-trunk3`

Pre-Steps and Post-Steps

<plugin>
  <groupId>com.orctom.mojo</groupId>
  <artifactId>was-maven-plugin</artifactId>
  <version>${latest-version}</version>
  <executions>
    <execution>
      <id>deploy</id>
      <phase>install</phase>
      <goals>
        <goal>deploy</goal>
      </goals>
      <configuration>
        <wasHome>${env.WAS_HOME}</wasHome>
        <verbose>true</verbose>
        <preSteps>
          <target name="pre 1">
            <echo message="====== pre 1 ===== ${applicationName}" />
          </target>
          <target name="pre 2">
            <echo message="====== pre 2 =====" />
          </target>
        </preSteps>
        <postSteps>
          <target name="post 1">
            <echo message="====== post 1 =====" />
          </target>
          <target name="post 2">
            <echo message="====== post 2 =====" />
            <sleep seconds="10"/>
          </target>
        </postSteps>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>ant-contrib</groupId>
      <artifactId>ant-contrib</artifactId>
      <version>20020829</version>
    </dependency>
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant-jsch</artifactId>
      <version>1.8.4</version>
    </dependency>
    <dependency>
      <groupId>com.jcraft</groupId>
      <artifactId>jsch</artifactId>
      <version>0.1.49</version>
    </dependency>
  </dependencies>
</plugin>
  • pre-steps/post-steps can be used with both single target server and multi target servers
  • All properties defined in properties section of pom or in was-maven-plugin.properties are available in pre-steps/post-steps ant tasks

Customized Jython Script File

This plugin also supports customized jython script if you need to tween the installation options, such server mappings.

You can copy-create it from the built-in one, or write a totally different one of you own.

Double braces for variables, such as: {{cluster}}, properties in was-maven-plugin.properties are all available as variables.

<plugin>
  <groupId>com.orctom.mojo</groupId>
  <artifactId>was-maven-plugin</artifactId>
  <version>${latest-version}</version>
  <executions>
    <execution>
      <id>deploy</id>
      <phase>install</phase>
      <goals>
        <goal>deploy</goal>
      </goals>
      <configuration>
        <wasHome>${env.WAS_HOME}</wasHome>
        <script>your-jython-script.py</script><!-- relative path to project root, or absolute path starts with a "/" (Linux) or "\" (Windows)  -->
        <scriptArgs>optional-args</scriptArgs><!-- "-o deploy" will be appended if not specified. -->
        <verbose>true</verbose>
      </configuration>
    </execution>
  </executions>
</plugin>

Continues Deployment with Jenkins

We could move this plugin to a profile, and utilize Extended Choice Parameter plugin to make this parameterized.

Sample pom.xml

<profiles>
  <profile>
    <id>deploy</id>
    <activation>
      <property>
        <name>deploy</name>
        <value>true</value>
      </property>
    </activation>
    <build>
      <plugins>
        <plugin>
          <groupId>com.orctom.mojo</groupId>
          <artifactId>was-maven-plugin</artifactId>
          <version>${latest-version}</version>
          <executions>
            <execution>
              <id>deploy</id>
              <phase>install</phase>
              <goals>
                <goal>deploy</goal>
              </goals>
              <configuration>
                <wasHome>${env.WAS_HOME}</wasHome>
                <verbose>true</verbose>
                <preSteps>
                  <target name="unzip-Config-zip">
                    <echo message="Unzipping ${project.build.directory}/Config.zip --> WAS shared libs folder" />
                    <unzip dest="${WAS shared libs folder}/conf">
                      <fileset dir="${project.build.directory}/">
                        <include name="Config.zip" />
                      </fileset>
                    </unzip>
                  </target>
                  <target name="unzip-static-zip">
                    <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
                    <if>
                      <available file="${project.build.directory}/static.zip" />
                      <then>
                        <echo message="Unzipping ${project.build.directory}/static.zip --> apache sratic path" />
                        <unzip dest="${apache sratic path}" src="${project.build.directory}/static.zip" />
                      </then>
                    </if>
                  </target>
                  <target name="copy-config-to-remote">
                    <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
                    <if>
                      <isset property="some property name in pom or was-maven-plugin/properties" />
                      <then>
                        <echo message="Coping ${WAS shared libs folder}/conf to ${remote ip}:${WAS shared libs folder}/conf ..." />
                        <scp todir="wsadmin@${remote ip}:${WAS shared libs folder}/conf" keyfile="${user.home}/.ssh/id_rsa" trust="true" failonerror="false">
                          <fileset dir="${WAS shared libs folder}/conf" />
                        </scp>
                        <echo message="Copied ${meta.config.path}/conf" />
                      </then>
                      <else>
                        <echo message="Skipped, not needed." />
                      </else>
                    </if>
                  </target>
                </preSteps>
              </configuration>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>ant-contrib</groupId>
              <artifactId>ant-contrib</artifactId>
              <version>20020829</version>
            </dependency>
            <dependency>
              <groupId>org.apache.ant</groupId>
              <artifactId>ant-jsch</artifactId>
              <version>1.8.4</version>
            </dependency>
            <dependency>
              <groupId>com.jcraft</groupId>
              <artifactId>jsch</artifactId>
              <version>0.1.49</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles>

Sample Jenkins Job Configuration

Configure

Jenkins Job configure

Trigger

Jenkins Job Trigger

With Global Security Turned on

When Global Security is enabled on remote WAS (not under a same deployment manager), certificates of remote WAS need to be added to local trust store. We could configure WAS to prompt to add them to local trust store.

  1. Open ${WAS_HOME}/properties/ssl.client.props
  2. Change the value of com.ibm.ssl.enableSignerExchangePrompt to gui or stdin
  • gui: will prompt a Java based window, this requires a X window installed.
  • stdin: when using ssh, or on client linux without X window installed.

Change Log

1.1.3.3

  • Added system property support for defining the deployments property file. #19

1.1.3.2

  • Added support for IHS webserver mapping for standalone WAS.

1.1.3.1

1.1.2

  • Fixed issue for workspace path includes whitespaces.

1.1.1

  • Fixed issue of not starting application on standalone WAS (restartAfterDeploy=false)

1.1.0

  • Fixed server mapping issue with cluster. Apps will be deployed to all servers that managed by the specified cluster.
  • Web servers support, use webservers to specify the web server(s) that you want to bind. (but you still have to 'update web server plug-in configuration' by your self.)
  • Added parameter deployOptions, expecting space-separated options such as -precompileJSPs -deployws, which will be prepended in the deployment options.
  • Fixed issue about failOnError.
  • Extracted some common code including websphere.py to was-util, which is also been used by was-gradle-plugin

1.0.12

  • Fixed the issue about "Template 'jython\websphere.py' not found" specific for Windows.

1.0.11

  • Fixed the issue with customized script.

1.0.10

  • Added a boolean parameter restartAfterDeploy:
    • true to restart server after deploy
    • false to start application directly
    • Default: true

1.0.9

  • Added support to override default javaoption in wsadmin client, in case you get OutOfMemoryError.

1.0.8

  • Fixed single target WAS deployment issue.
  • Not to check whether parent folder of deployment script been created or not.

1.0.7

  • Removed preCompileJSPs options for deployment.

1.0.6

  • Fixed multi-server deployment issue.

1.0.5

  • Downgraded to use 1.5 build level, so that it can be used for older version of websphere.
  • Fixed property resolving issue, properties in was-maven-plugin.properties are all available in custome scripts and pre/post steps.

1.0.4

  • Added PARENT_LAST for application and web module and shared libs bindings.
  • Added failonerror

1.0.3

  • Removed private project specific logic. (it's the 1st working version for general projects for websphere deployment).

was-maven-plugin's People

Contributors

awwwis avatar orctom avatar sparty02 avatar svcacct-epo-cicd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

was-maven-plugin's Issues

Fix a websphere.py problem

Hi, friend

I fix a error in the default websphere.py

I am ussing was7 version 7.0.29

I invoke the Python Script with this config in my pom.xml

        <plugin>
            <groupId>com.orctom.mojo</groupId>
            <artifactId>was-maven-plugin</artifactId>
            <version>1.0.11</version>
            <executions>
                <execution>
                    <id>deploy</id>
                    <phase>install</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                    <configuration>
                        <wasHome>${env.WAS_HOME}</wasHome>
                        <applicationName>myEAR</applicationName>
                        <script>websphere.py</script>
                        <scriptArgs>-o deploy</scriptArgs>  
                        <cell>myCell</cell>                     
                        <host>localhost</host>
                        <port>8881</port>
                        <server>server1</server>
                        <user>admin</user>
                        <password>admin</password>
                        <node>myNode</node>
                        <virtualHost>default_host</virtualHost>
                        <verbose>true</verbose>
                        <sharedLibs>mySharedLibs</sharedLibs>
                        <restartAfterDeploy>false</restartAfterDeploy>
                        <failOnError>false</failOnError>
                    </configuration>
                </execution>
            </executions>
        </plugin>       

I have a problem to start the application in the function startApplication(self):

def startApplication(self):
    print '-'*60
    print "[STARTING APPLICATION]", host, applicationName
    print time.strftime("%Y-%b-%d %H:%M:%S %Z")
    print '-'*60
    try:
        if "" != cluster:
            appManager = AdminControl.queryNames('type=ApplicationManager,process=' + server + ',*')
        elif "" != node:
            appManager = AdminControl.queryNames('node=' + node + ',type=Server,process=' + server + ',*')
        else:
            appManager = AdminControl.queryNames('type=Server,process=' + server + ',*')
        print AdminControl.invoke(appManager, 'startApplication', applicationName)
        #AdminApplication.startApplicationOnCluster(applicationName, cluster)
    except:
        print "FAILED to start application:"
        print '-'*10
        traceback.print_exc(file=sys.stdout)
        print '-'*10

when i use node and cell i need pass the two params to create AppManager Object

    appManager = AdminControl.queryNames('cell=' + cell + ',node=' + node + ',type=ApplicationManager,process=' + server + ',*')

Thx ^^

Builds does not fail-on-error

The failOnError parameter does not seem to have any effect as my builds still succeeds even if the wsadmin commands fail. I don't see any references to WebSphereModel.isFailOnError() anywhere, which leads me to suspect that the feature was not fully implemented.

------------------------------------------------------------
[INSTALLING APPLICATION] xx.yy.portal.zzz.com angularTheme-ear
2015-nov-06 12:59:07 CET
------------------------------------------------------------

options:  ['-deployws', '-distributeApp', '-appname', 'angularTheme-ear', '-clus
ter', 'PortalCluster', '-MapModulesToServers', [['.*', '.*', 'WebSphere:cell=myp
or1Cell01,cluster=PortalCluster+WebSphere:cell=mypor1Cell01,node=myporihs2
UnmanagedNode,server=webserver1+WebSphere:cell=mypor1Cell01,node=myporihs1Un
managedNode,server=webserver1']], '-MapWebModToVH', [['.*', '.*', 'default_host'
]]]

INSTALLING
FAILED to install application:  angularTheme-ear
----------
Traceback (most recent call last):
  File "<string>", line 144, in installApplication
com.ibm.ws.scripting.ScriptingException: com.ibm.ws.scripting.ScriptingException
: com.ibm.websphere.management.filetransfer.client.TransferFailedException

java.net.UnknownHostException: java.net.UnknownHostException: mypor1.yyy.zzz.com

------------------------------------------------------------
[FINISHED] xx.yy.portal.zzz.com angularTheme-ear
2015-nov-06 12:59:26 CET
------------------------------------------------------------
Return code: 0
[INFO] ====================    post-steps    ======================
[INFO] Skipped, not configured.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] angularTheme-theme ................................. SUCCESS [  0.484 s]
[INFO] angularTheme-static ................................ SUCCESS [ 24.511 s]
[INFO] angularTheme-dynamic ............................... SUCCESS [  1.233 s]
[INFO] angularTheme-ear ................................... SUCCESS [ 36.216 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:02 min
[INFO] Finished at: 2015-11-06T12:59:26+01:00
[INFO] Final Memory: 13M/26M
[INFO] ------------------------------------------------------------------------

Issues with deploying to Web Server in a Single target server

Use Case is to deploy an application to a stand alone WAS Server and map it to IHS.

In the pom.xml file in the config section, we have 'server' and 'webservers' but the application is only being deployed to 'server' but not to the 'webservers'.

We are using the 1.1.2 version of the plugin and Version 8.5.5. of WAS.

Error while deploying to WAS 8.0

Hey,

I'm trying to deploy my JSF 2.0/PrimeFaces 6.0 application to my WAS 8.0 with this plugin but I'm always getting the following error:

[RESTARTING SERVER] localhost

2016-Aug-15 14:22:29 CEST

FAILED to restart cluster/server:

Traceback (most recent call last):
File "", line 45, in restartServer

com.ibm.ws.scripting.ScriptingException: com.ibm.ws.scripting.ScriptingException: WASX7025E: Es wurde ein Fehler in der Zeichenfolge "" gefunden. Das Objekt kann nicht erstellt werden.

try to startApplication directly...

[STARTING APPLICATION] localhost test

2016-Aug-15 14:22:29 CEST

FAILED to start application:

Traceback (most recent call last):
File "", line 67, in startApplication

com.ibm.ws.scripting.ScriptingException: com.ibm.ws.scripting.ScriptingException: WASX7025E: Es wurde ein Fehler in der Zeichenfolge "" gefunden. Das Objekt kann nicht erstellt werden.

WASX7017E: Beim Ausf�hren der Datei "C:\Entwicklung\Ford_HTS\hts2\de.ford.hts.jsf2client\target\was-maven-plugin\py\deploy-localhost-test-20160815-142159-685.py" ist eine Ausnahme eingetreten. Informationen zur Ausnahme: com.ibm.ws.scripting.ScriptingException: WASX7025E: Es wurde ein Fehler in der Zeichenfolge "" gefunden. Das Objekt kann nicht erstellt werden.

Here's my plugin config:

<plugin>
                <groupId>com.orctom.mojo</groupId>
                <artifactId>was-maven-plugin</artifactId>
                <version>${was-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                        <configuration>
                            <wasHome>${was.home}</wasHome>
                            <user>admin</user>
                            <password>admin</password>
                            <host>localhost</host>
                            <server>server1</server>
                            <node>vWLWGM158Node03</node>
                            <virtualHost>default_host</virtualHost>
                            <applicationName>${project.build.finalName}</applicationName>
                            <contextRoot>hts</contextRoot>
                            <parentLast>true</parentLast>
                            <verbose>true</verbose>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Does anyone know why I always get this error?
I've found some similar errors but no solution for my problem.

Thanks for your help,
Nico

remote deploy

hi,i got a problem with remote deploy.
The exception is "wrong wasHome or WAS_HOME:..".
But i readed the code and finded that the process want to new a local file with remote was_home.
can you give me a example with remote deploy ? Thank you very much.

wasHome missing or invalid

I am trying to run deploy goal, with the code in Readme.cmd, where wasHome is set. But it gives wasHome missing or invalid.

I have given value of was home as

C:\IBM\WebSphere\AppServer_1.

                            <code> Starts Here </code>
                            <configuration>                                
                            <wasHome>${env.WAS_HOME}</wasHome>
                            <applicationName>${project.build.finalName}</applicationName>
                            <host>localhost</host>
                            <server>server1</server>
                            <node>Node01</node>
                            <virtualHost>default_host</virtualHost>

                        </configuration>
                          <code> Ends Here </code>

Any Idea?

using below command
mvn -X com.orctom.mojo:was-maven-plugin:1.0.11:deploy

Issue with deployment of was EAR with 1.1.3.2

I am having an issue with the 1.1.3.2 plugin. When I deploy an application EAR file to WebSphere and the application EAR file is not already deployed to WebSphere, the plugin deploys fine. If the application EAR is already installed on WebSphere but NOT started, then the if a redeploy of the application EAR is run, the redeploy works fine.

Here is the problem. If the application EAR is deployed to WAS and IS started, then the deploy fails during the 'START APPLICATION' step with an error indicating that the application is already started.

I only want to restart the application after the deployment and not the server, so I am setting 'restartAfterDeploy' to false.

We are using the 1.1.3.2 version of the plugin and Version 8.5.5. of WAS.

Can you review my use of the plugin and see if you see anything out of the ordinary and/or is there something else I need to do when redeploying using 1.1.3.2. This is not a problem when using 1.1.3.1.

Thanks
Matt Goodnight

Attached is my configuration of the plugin, the settings.xml file and the error output from running the pom.xml.
my use of plugin.txt
settings for maven.txt
plugin deploy error.txt

Cannot deploy war on Was 8.5

Error when try to deploy a war with this plugin in Windows with maven install in eclipse. The error is
com.ibm.websphere.management.exception.AdminException: ADMA0043E: C:\tmp\Demo11679c9c999a.ear does not exist for installation.
I try to change the tmp directory but it does not work either. I try to manually execute the command wsadmin with file .py changing the war for one .ear, but it does not work either.

In addition, if I look the directory when websphere try to deploy I see the .ear during a short period of time but then, it's deleted and the error appears.

Seeing the .trace file I found this error too:

com.ibm.websphere.management.exception.AdminException: ADMA0176E: Application installation of mexico_web failed with PrivilegedActionException. Ear file path is C:\tmp\mexico_web16774038841.ear

but executing with admin privileges and changing the directory appears the same error.

Thanks in advance, Luis.

Template 'jython\websphere.py' not found.

Hi.

I'm getting the following error.

[ERROR] com.orctom.mojo.was.model.WebSphereServiceException: Template 'jython\websphere.py' not found
    at com.orctom.mojo.was.service.impl.WebSphereServiceScriptImpl.execute(WebSphereServiceScriptImpl.java:109)
    at com.orctom.mojo.was.service.impl.WebSphereServiceScriptImpl.deploy(WebSphereServiceScriptImpl.java:62)
    at com.orctom.mojo.was.WASDeployMojo.execute(WASDeployMojo.java:80)
    at com.orctom.mojo.was.WASDeployMojo.execute(WASDeployMojo.java:66)

Feature: Ability to map modules to an IHS webserver

Use case:

An applicaiton is deployed in a WAS cluster (clusterA), with e.g. 2 servers in the cluster (server1 with port 9081 and server2 with port 9082). The clustered app is then mapped not only to clusterA, but also to a webserver moduel (e.g. webserver1, an IHS WAS plugin). This allows the app to be load-balanced over webserver1's port 80, while it seamlessly directs traffic to clusterA (e.g. server1 or server2).

Some pseudo code to accomplish this from websphere.py

if "" != cluster:
    serverMapping = 'WebSphere:cluster=' + cluster
    if "" != webserver:
        serverMapping += '+WebSphere:server=' + webserver
    options += ['-cluster', cluster, '-MapModulesToServers', [['.*','.*', serverMapping]]]

May be of reference: wsadmin and MapModulesToServers

Can not deploy an ear project to WAS 8.5.5

Hello There,

I am trying to deploy an ear to a local WAS server, and I get this error :

[INFO] 
[INFO] --- was-maven-plugin:1.1.3.3:deploy (deploy) @ MyProjectEar ---
[INFO] was-maven-plugin - deploy
[INFO] Single target: localhost
[INFO] ============================================================
[INFO] [DEPLOY] localhost MyProjectEar-1.0.0-SNAPSHOT
[INFO] ============================================================
[INFO] ====================    pre-steps    =======================
[INFO] Skipped, not configured.
[INFO] ======================    deploy    ========================
wsadmin location: C:\PUBLIC\SOFTWARE2\bin\wsadmin.bat
Executing command:
cmd.exe /X /C "C:\PUBLIC\SOFTWARE2\bin\wsadmin.bat -conntype SOAP -host localhost -port 9082 -lang jython -tracefile 
C:\PUBLIC\dev\workspace-rtc-6\MyProjectEar\target\was-maven-plugin\py\deploy-localhost-MyProjectEar-1.0.0-SNAPSHOT-20171130-152536-245.py.trace
 -appendtrace true -f C:\PUBLIC\dev\workspace-rtc-6\MyProjectEar\target\was-maven-plugin\py\
 deploy-localhost-MyProjectEar-1.0.0-SNAPSHOT-20171130-152536-245.py -o deploy"
WASX7023E: Erreur lors de la cr‚ation de la connexion "SOAP" … l'h“te "localhost" ; informations sur l'exception : 
com.ibm.websphere.management.exception.ConnectorNotAvailableException: [SOAPException: faultCode=SOAP-ENV:Protocol; 
msg=Unsupported response content type &quot;text/html; charset=utf-8&quot;, must be: &quot;text/xml&quot;. Response was:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /
]
WASX7213I: Ce client de scriptage n'est pas connect‚ … un processus serveur ; consultez le fichier journal 
C:\PUBLIC\dev\workspace-rtc-6\MyProjectEar\target\was-maven-plugin\py\deploy-localhost-MyProjectEar-1.0.0-SNAPSHOT-20171130-152536-245.py.trace
 pour plus d'informations.
WASX8011W: L'objet AdminTask n'est pas disponible.
WASX7303I: Les options suivantes sont transmises … l'environnement de scriptage et sont disponibles sous forme d'arguments 
stock‚s dans la variable argv : "[-o, deploy]"
---------------------------------------------------------------
 AdminApplication:       Check if application exists
 Application Name:       MyProjectEar-1.0.0-SNAPSHOT
 Usage: AdminApplication.checkIfAppExists("MyProjectEar-1.0.0-SNAPSHOT")
 Return: Checks whether the application exists. If the application exists, a true value is returned.
---------------------------------------------------------------
 
 
Exception: com.ibm.ws.scripting.ScriptingException com.ibm.ws.scripting.ScriptingException: 
WASX7070E: Le service de configuration n'est pas disponible. 
WASX7017E: Exception re‡ue lors de l'ex‚cution du fichier "C:\PUBLIC\dev\workspace-rtc-6\MyProjectEar\target\was-maven-plugin\py\
deploy-localhost-MyProjectEar-1.0.0-SNAPSHOT-20171130-152536-245.py" ; informations sur l'exception : 
com.ibm.ws.scripting.ScriptingException: WASX7070E: Le service de configuration n'est pas disponible.

[ERROR] ##############  Exception occurred during deploying to WebSphere  ###############
[ERROR] com.orctom.was.model.WebSphereServiceException: Failed to deploy, return code: 105. Please make sure target WAS is alive and reachable.
	at com.orctom.was.service.impl.AbstractWebSphereServiceImpl.execute(AbstractWebSphereServiceImpl.java:68)
	at com.orctom.was.service.impl.AbstractWebSphereServiceImpl.deploy(AbstractWebSphereServiceImpl.java:60)
	at com.orctom.mojo.was.WASDeployMojo.execute(WASDeployMojo.java:81)
	at com.orctom.mojo.was.WASDeployMojo.execute(WASDeployMojo.java:67)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: com.orctom.was.model.WebSphereServiceException: Failed to deploy, return code: 105. Please make sure target WAS is alive and reachable.
	at com.orctom.mojo.was.WebSphereServiceImpl.executeCommand(WebSphereServiceImpl.java:53)
	at com.orctom.was.service.impl.AbstractWebSphereServiceImpl.execute(AbstractWebSphereServiceImpl.java:66)
	... 24 more
Caused by: com.orctom.was.model.WebSphereServiceException: Failed to deploy, return code: 105. Please make sure target WAS is alive and reachable.
	at com.orctom.mojo.was.WebSphereServiceImpl.executeCommand(WebSphereServiceImpl.java:67)
	at com.orctom.mojo.was.WebSphereServiceImpl.executeCommand(WebSphereServiceImpl.java:35)
	... 25 more

and my plugin configuration in the pom.xml is :

<plugin>
			  <groupId>com.orctom.mojo</groupId>
			  <artifactId>was-maven-plugin</artifactId>
			  <version>1.1.3.3</version>
			  <executions>
			    <execution>
			      <id>deploy</id>
			      <phase>install</phase>
			      <goals>
			        <goal>deploy</goal>
			      </goals>
			    </execution>
			  </executions>
			  <configuration>
			    <wasHome>C:\PUBLIC\SOFTWARE2</wasHome>
			    <profileName>AppSrv01</profileName>
			    <conntype>SOAP</conntype>
			    <server>server1</server>
			    <node>FWPC-86733Node02</node>
			    <contextRoot>/PosteRiWebRef/</contextRoot>
			    <host>localhost</host>
			    <port>9082</port>
			    <verbose>true</verbose>
			    <!-- <updateExisting>false</updateExisting> -->
			  </configuration>
</plugin>


Can you help me with this, Please?

The following argument value is not valid: appName

An exception is thrown when attempting to deploy, regarding the 'appName' being invalid. Using Java 7, Maven 3.2.5, WAS 8.5.5.

Pom plugin config:

  • connectorType = SOAP
<plugin>
     <groupId>com.orctom.mojo</groupId>
     <artifactId>was-maven-plugin</artifactId>
     <version>1.0.7</version>
     <executions>
          <execution>
               <id>deploy</id>
               <phase>package</phase>
               <goals>
                    <goal>deploy</goal>
               </goals>
               <configuration>
                    <wasHome>${was.home}</wasHome>
                    <applicationName>${project.build.finalName}</applicationName>
                    <host>${deployment.server}</host>
                    <connectorType>${was.connector.type}</connectorType>
                    <port>${was.deploy.port}</port>
                    <user>${was.deploy.username}</user>
                    <password>${was.deploy.password}</password>
                    <server>${was.server}</server>
                    <node>${was.node}</node>
                    <virtualHost>${was.virtual.host}</virtualHost>
                    <contextRoot>${deploy.app.name}</contextRoot>
                    <verbose>true</verbose>
               </configuration>
          </execution>
     </executions>
</plugin>

Py trace:

[1/16/15 16:58:10:393 CST] 00000001 AbstractShell A   WASX7093I: Issuing message: "WASX7017E: Exception received while running file "**********\target\was-maven-plugin\py\deploy-*****[host]*****-*****[applicationName]*****.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<string>", line 200, in ?
  File "<string>", line 180, in deploy
  File "<string>", line 177, in isApplicationInstalled
  File "*****[WAS_HOME]*****\scriptLibraries\application\V70\AdminApplication.py", line 4390, in checkIfAppExists
ScriptLibraryException: : 'exceptions.AttributeError WASL6041E: The following argument value is not valid: appName:.'
"

Can it be used for Liberty Profile?

I want to deploy my war on remote host. Liberty has it's own plugin but it only allows to deploy war on local box. Can orctom used for Liberty Profile 8.5.0 version?

Thanks
Jitendra

No restart of application (restartAfterDeploy=false)


WASX7017E: Exception received while running file "...\was-maven-plugin\py\deploy-localhost-APP-8.1-SNAPSHOT-20151112-182325-345.py"; exception information: javax.management.MBeanException
javax.management.ServiceNotFoundException: Operation startApplication not in ModelMBeanInfo

It works changing to type=ApplicationManager instead of type=Server in websphere.py

       if "" != cluster:
            appManager = AdminControl.queryNames('type=ApplicationManager,process=' + server + ',*')
        elif "" != node:
            appManager = AdminControl.queryNames('node=' + node + ',type=ApplicationManager,process=' + server + ',*')
        else:
            appManager = AdminControl.queryNames('type=ApplicationManager,process=' + server + ',*')

Regards

Can't use scriptArgs option

Hi and thanks for the great job, it saved me a lot of time and headaches!

I wrote a new method (update()) in a custom script (using yours as a base) to update an ear instead to uninstall and install it from scratch, and it worked fine, but...
When I try to use the scriptArgs option inside my pom.xml I always get a NullPointerException before the call to the script.
I've tryed with different syntax (update, -o update, "-o update"...) but simply inserting that option in pom.xml it throws that exception, always the same...

Do you have any suggestion?

pom.xml plugin configuration

<plugin>
    <groupId>com.orctom.mojo</groupId>
    <artifactId>was-maven-plugin</artifactId>
    <version>1.1.3.3</version>
    <executions>
        <execution>
            <id>deploy</id>
            <phase>install</phase>
            <goals>
                <goal>deploy</goal>
            </goals>
            <configuration>
                <wasHome>${env.WAS_HOME}</wasHome>
                <user>myuser</user>
                <password>mypwd</password>
                <applicationName>${project.artifactId}</applicationName>
                <host>localhost</host>
                <port>11111</port>
                <server>WebSphere_Portal</server>
                <node>node01</node>
                <virtualHost>default_host</virtualHost>
                <verbose>true</verbose>
                <restartAfterDeploy>false</restartAfterDeploy>
                <script>deploy.py</script>
                <scriptArgs>-o update</scriptArgs><!-- "-o deploy" will be appended if not specified. -->
                <deployOptions>-update.ignore.new</deployOptions>
            </configuration>
        </execution>
    </executions>
</plugin>

error trace

[INFO] --- was-maven-plugin:1.1.3.3:deploy (deploy) @ my.app.ear ---
[INFO] was-maven-plugin - deploy
[INFO] Single target: localhost
[INFO] ============================================================
[INFO] [DEPLOY] localhost my.app.ear
[INFO] ============================================================
[INFO] ====================    pre-steps    =======================
[INFO] Skipped, not configured.
[INFO] ======================    deploy    ========================
Using customized script: D:\workspace\my.app.ear\deploy.py
wsadmin location: D:\WebSphere\AppServer\bin\wsadmin.bat
[ERROR] ##############  Exception occurred during deploying to WebSphere  ###############
[ERROR] com.orctom.was.model.WebSphereServiceException
        at com.orctom.was.service.impl.AbstractWebSphereServiceImpl.execute(AbstractWebSphereServiceImpl.java:68)
        at com.orctom.was.service.impl.AbstractWebSphereServiceImpl.deploy(AbstractWebSphereServiceImpl.java:60)
        at com.orctom.mojo.was.WASDeployMojo.execute(WASDeployMojo.java:81)
        at com.orctom.mojo.was.WASDeployMojo.execute(WASDeployMojo.java:67)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:508)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.NullPointerException
        at com.orctom.was.model.Command.escapeWhitespace(Command.java:66)
        at com.orctom.was.model.Command.addArg(Command.java:54)
        at com.orctom.was.service.impl.AbstractWebSphereServiceImpl.getCommand(AbstractWebSphereServiceImpl.java:100)
        at com.orctom.was.service.impl.AbstractWebSphereServiceImpl.execute(AbstractWebSphereServiceImpl.java:65)
        ... 25 more

Issues with deploying to Web Server in a Single target server

This is a followup to my previous. Apologies, but I didn't come back and check for status and it got closed.

Use Case is to deploy an application to a stand alone WAS Server and map it to IHS.

In the pom.xml file in the config section, we have 'server' and 'webservers' but the application is only being deployed to 'server' but not to the 'webservers'.

We are using the 1.1.2 version of the plugin and Version 8.5.5. of WAS.

My values for the the command used by Maven are pulled from the Maven settings.xml and are as follows:
settings for maven.txt

I have the pom.xml plugin configured as follows:

maven setup for was plugin.txt

When I look in my log I see that it puts together this option string:
options: ['-distributeApp', '-appname', 'RetrieveProviderReport', '-MapModulesToServers', [['.', '.', 'WebSphere:server=ABCD29AS13']], '-MapWebModToVH', [['.', '.', 'default_host']]]

I would expect to see my value of 'webservers' in that option string.

Thanks

New goal 'create'

Hi,

Is it possible to extend plugin with new goal 'create'?
It should create the deployment descriptors and run.sh.
Scripts could be used then for manual deployments on remote WAS installations.

Regards,
Andras

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.