Search
Calendar
April 2024
S M T W T F S
« Sep    
 123456
78910111213
14151617181920
21222324252627
282930  
Your widget title
Archives

Posts Tagged ‘Maven 2’

PostHeaderIcon How to include a dependency to tools.jar in Maven?

Case

You need include tools.jar as a dependency in a pom.xml, for instance in order to use Java 5’s annotations and APT. From a “Maven’s view point”, tools.jar is not a regular JAR defined by a groupId and artefactId.

Solution

Add this block in your pom.xml:

<dependency>
    <groupId>com.sun</groupId>
    <artifactId>tools</artifactId>
    <version>1.6.0_24</version>
    <scope>system</scope>
    <systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>

(You can also add it in your settings.xml)

You can do the same for any other “non-regular” JAR, available in your file system.

PostHeaderIcon javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException

Case

I deploy a WAR on a WebLogic server, thanks to Maven’s Weblogic plugin. For any reason, the pom.xml was modified, to add a dependency to weblogic-maven-plugin:

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>weblogic-maven-plugin</artifactId>
				<version>2.9.1</version>
				<configuration>(...)</configuration>
				<dependencies>
					<dependency>
						<groupId>weblogic</groupId>
						<artifactId>wlfullclient</artifactId>
						<version>10.3</version>
					        <scope>provided</scope>
					</dependency>
				</dependencies>
			</plugin>

From then I could not deploy anymore. I get the error:

javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException
        at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(WebLogicDeploymentManagerImpl.java:121)

Complete stacktrace

"[ServerConnectionImpl.close():332] : Closing DM connection
[ServerConnectionImpl.close():352] : Unregistered all listeners
javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException
        at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.(WebLogicDeploymentManagerImpl.java:121)
        at weblogic.deploy.api.spi.factories.internal.DeploymentFactoryImpl.getDeploymentManager(DeploymentFactoryImpl.java:86)
        at weblogic.deploy.api.tools.SessionHelper.getRemoteDeploymentManager(SessionHelper.java:496)
        at weblogic.deploy.api.tools.deployer.Jsr88Operation.connect(Jsr88Operation.java:297)
        at weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:137)
        at weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88)
        at weblogic.utils.compiler.Tool.run(Tool.java:158)
        at weblogic.utils.compiler.Tool.run(Tool.java:115)
        at weblogic.Deployer.run(Deployer.java:70)
        at org.codehaus.mojo.weblogic.DeployMojoBase.executeDeployer(DeployMojoBase.java:510)
        at org.codehaus.mojo.weblogic.DeployMojo.execute(DeployMojo.java:49)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:454)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:290)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: weblogic.deploy.api.spi.exceptions.ServerConnectionException
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(ServerConnectionImpl.java:141)
        at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.getNewConnection(WebLogicDeploymentManagerImpl.java:148)
        at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.(WebLogicDeploymentManagerImpl.java:118)
        ... 28 more
Caused by: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://localhost:7001: Destination unreachable; nested exception is:
        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination]
        at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
        at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:787)
        at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:366)
        at weblogic.jndi.Environment.getContext(Environment.java:315)
        at weblogic.jndi.Environment.getContext(Environment.java:285)
        at weblogic.jndi.Environment.createInitialContext(Environment.java:208)
        at weblogic.jndi.Environment.getInitialContext(Environment.java:192)
        at weblogic.jndi.Environment.getInitialContext(Environment.java:170)
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getContext(ServerConnectionImpl.java:328)
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getEnvironment(ServerConnectionImpl.java:300)
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(ServerConnectionImpl.java:139)
        ... 30 more
Caused by: java.net.ConnectException: t3://localhost:7001: Destination unreachable; nested exception is:
        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination
        at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216)
        at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
        at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
        at weblogic.jndi.WLInitialContextFactoryDelegate$1.run(WLInitialContextFactoryDelegate.java:345)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
        at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:340)
        ... 38 more
Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is:
        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination
        at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:464)
        at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:315)
        at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:254)
        at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
        at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
        at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:200)
        ... 44 more
weblogic.deploy.api.tools.deployer.DeployerException: Unable to connect to 't3://localhost:7001': Destination unreachable; nested exception is:
        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination. 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.
        at weblogic.deploy.api.tools.deployer.Jsr88Operation.connect(Jsr88Operation.java:316)
        at weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:137)
        at weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88)
        at weblogic.utils.compiler.Tool.run(Tool.java:158)
        at weblogic.utils.compiler.Tool.run(Tool.java:115)
        at weblogic.Deployer.run(Deployer.java:70)
        at org.codehaus.mojo.weblogic.DeployMojoBase.executeDeployer(DeployMojoBase.java:510)
        at org.codehaus.mojo.weblogic.DeployMojo.execute(DeployMojo.java:49)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:454)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:290)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException
        at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.(WebLogicDeploymentManagerImpl.java:121)
        at weblogic.deploy.api.spi.factories.internal.DeploymentFactoryImpl.getDeploymentManager(DeploymentFactoryImpl.java:86)
        at weblogic.deploy.api.tools.SessionHelper.getRemoteDeploymentManager(SessionHelper.java:496)
        at weblogic.deploy.api.tools.deployer.Jsr88Operation.connect(Jsr88Operation.java:297)
        ... 25 more
Caused by: weblogic.deploy.api.spi.exceptions.ServerConnectionException
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(ServerConnectionImpl.java:141)
        at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.getNewConnection(WebLogicDeploymentManagerImpl.java:148)
        at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.(WebLogicDeploymentManagerImpl.java:118)
        ... 28 more
Caused by: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://localhost:7001: Destination unreachable; nested exception is:
        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination]
        at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
        at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:787)
        at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:366)
        at weblogic.jndi.Environment.getContext(Environment.java:315)
        at weblogic.jndi.Environment.getContext(Environment.java:285)
        at weblogic.jndi.Environment.createInitialContext(Environment.java:208)
        at weblogic.jndi.Environment.getInitialContext(Environment.java:192)
        at weblogic.jndi.Environment.getInitialContext(Environment.java:170)
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getContext(ServerConnectionImpl.java:328)
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getEnvironment(ServerConnectionImpl.java:300)
        at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(ServerConnectionImpl.java:139)
        ... 30 more
Caused by: java.net.ConnectException: t3://localhost:7001: Destination unreachable; nested exception is:
        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination
        at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216)
        at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
        at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
        at weblogic.jndi.WLInitialContextFactoryDelegate$1.run(WLInitialContextFactoryDelegate.java:345)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
        at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:340)
        ... 38 more
Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is:
        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination
        at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:464)
        at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:315)
        at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:254)
        at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
        at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
        at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:200)
        ... 44 more
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Exception encountered during artifact start: weblogic.deploy.api.tools.deployer.DeployerException: Unable to connect to 't3://localhost:7001': Destination unreachable; nested exception is:

        java.net.ProtocolException: unrecognized response from proxy: 'HTTP/1.1 403 Forbidden'; No available router to destination. 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."

Explanation

In weblogic-maven-plugin-2.9.1.pom, we can find the following 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>

Since WebLogic client jars are not compatibles between versions 9 and 10, a conflit of JARs appears between my pom’s dependency to weblogic:wlfullclient-10.3.jar and the plugin pom’s dependencies to weblogic:weblogic-XXX.jar and weblogic:webservices-XXX.jar

Fix

In the project pom.xml, remove the dependency to wlfullclient.jar.

PostHeaderIcon Tutorial: Re-package Mule ESB as a standalone client

Case

You have to deliver Mule 2.2.1 as a standalone application, or, more accurately, as a simple archive ready-to-use by someone else (customer, co-team worker, etc.).

In this tutorial, we assume that:

  • you have to include external jars, eg. MQ and WebLogic jars
  • you have written your XML configuration file for Mule, of which all properties are externalized in an external property file. We don’t mind the actual workflow, we assume you’re skilled enough with Mule 😉

Build

Prerequisites

Prior to building standalone:

  • get Mule ESB 2.2.1 standalone archive, available on MuleSoft website
  • get the JARs needed by MQ
    • providerutil.jar
    • fscontext.jar
    • dhbcore.jar
    • connector.jar
    • commonservices.jar
    • com.ibm.mqjms.jar
    • com.ibm.mq.jar
  • get WebLogic’s wlfullclient.jar
  • install the zip and the jars on your local repository:
    mvn install:install-file -DgroupId=org.mulesource -DartifactId=mule-esb -Dversion=2.2.1 -Dpackaging=zip -Dfile=mule-standalone-2.2.1.zip
    mvn install:install-file -Dfile=wlfullclient.jar  -DgroupId=weblogic -DartifactId=wlfullclient -Dversion=10.3 -Dpackaging=jar -DgeneratePom=true
    mvn install:install-file -Dfile=fscontext.jar  -DgroupId=fscontext -DartifactId=fscontext -Dversion=1.2 -Dpackaging=jar -DgeneratePom=true
    mvn install:install-file -Dfile=providerutil.jar  -DgroupId=fscontext -DartifactId=providerutil -Dversion=1.2 -Dpackaging=jar -DgeneratePom=true
    mvn install:install-file -DgroupId=mq -DartifactId=com.ibm.mq -Dversion=6.0.2.0 -Dpackaging=jar -Dfile=com.ibm.mq.jar
    mvn install:install-file -DgroupId=mq -DartifactId=com.ibm.mqjms -Dversion=6.0.2.0 -Dpackaging=jar -Dfile=com.ibm.mqjms.jar
    mvn install:install-file -DgroupId=mq -DartifactId=dhbcore -Dversion=6.0.2.0 -Dpackaging=jar -Dfile=dhbcore.jar
    mvn install:install-file -DgroupId=mq -DartifactId=commonservices -Dversion=6.0.2.0 -Dpackaging=jar -Dfile=commonservices.jar
    mvn install:install-file -DgroupId=connector -DartifactId=connector -Dversion=1.0 -Dpackaging=jar -Dfile=connector.jar

Files to be edited

  • Create a mule-jonathan.xml file in src/main/resources/ folder.
  • Externalize all properties in mule-jonathan.properties file in src/main/resources/ folder. As you may anticipate it, you will have add this property file in Mule classpath
  • To perform that:
    • Copy the wrapper.conf of Mule standalone archive as src/main/resources/wrapper.conf
    • After the line:
      wrapper.java.classpath.3=%MULE_HOME%/lib/boot/*.jar

      , add the line:

      wrapper.java.classpath.4=%MULE_HOME%/etc
  • in src/main/resources/, create a file start-mule-jonathan.bat, with the content:
    set MULE_HOME=%CD%
    cd %MULE_HOME%\bin
    mule.bat -config mule-jonathan.xml
    

Maven

Here is the pom.xml of our project:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <parent>
    <groupId>lalou-jonathan</groupId>
    <artifactId>jonathan-parent</artifactId>
    <version>1.0</version></parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>lalou.jonathan</groupId>
  <artifactId>jonathan-lalou-standalone-esb</artifactId>
  <packaging>jar</packaging>
  <version>${jonathan.version}</version>
  <name>jonathan-lalou-standalone-esb</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.mulesource</groupId>
      <artifactId>mule-esb</artifactId>
      <version>2.2.1</version>
      <type>zip</type></dependency>
    <dependency>
      <groupId>weblogic</groupId>
      <artifactId>wlfullclient</artifactId>
      <version>10.3</version></dependency>
    <dependency>
      <groupId>fscontext</groupId>
      <artifactId>fscontext</artifactId>
      <version>1.2</version></dependency>
    <dependency>
      <groupId>fscontext</groupId>
      <artifactId>providerutil</artifactId>
      <version>1.2</version></dependency>
    <dependency>
      <groupId>mq</groupId>
      <artifactId>com.ibm.mq</artifactId>
      <version>6.0.2.0</version></dependency>
    <dependency>
      <groupId>mq</groupId>
      <artifactId>com.ibm.mqjms</artifactId>
      <version>6.0.2.0</version></dependency>
    <dependency>
      <groupId>mq</groupId>
      <artifactId>commonservices</artifactId>
      <version>6.0.2.0</version></dependency>
    <dependency>
      <groupId>mq</groupId>
      <artifactId>dhbcore</artifactId>
      <version>6.0.2.0</version></dependency>
    <dependency>
      <groupId>connector</groupId>
      <artifactId>connector</artifactId>
      <version>1.0</version></dependency></dependencies>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>**/*</exclude></excludes></resource></resources>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2-beta-2</version>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/assembly.xml</descriptor></descriptors></configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
</project>

Maven Assembly

We will use Maven Assembly: this plugin allows unpack archives, copy files, insert files, delete folders, etc.

Here is the assembly.xml file that should be located in src/main/assembly/ folder of your project. The code is commented so that you understand what we do.

<assembly xmlns="http://maven.apache.org/xsd/1.1.0/assembly"           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"           xsi:schemaLocation="http://maven.apache.org/xsd/assembly-1.1.2.xsd                               http://maven.apache.org/xsd/1.1.2/assembly">
  <id/>
  <baseDirectory>jonathan-lalou-standalone-esb-${version}</baseDirectory>
  <formats>
    <format>zip</format></formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <includes>
        <include>org.mulesource:mule-esb</include></includes>
      <unpack>true</unpack>
      <unpackOptions>
        <excludes>
          <!-- excluse original wrapper.conf, to include our tuned wrapper.conf-->
          <exclude>**/conf/wrapper.conf</exclude>
          <!--remove the these folders, useless in a standalone client-->
          <exclude>**/examples/**</exclude>
          <exclude>**/docs/**</exclude>
          <exclude>**/src/**</exclude></excludes></unpackOptions></dependencySet>
    <dependencySet>
      <outputDirectory>mule-standalone-2.2.1/lib/user</outputDirectory>
      <excludes>
        <exclude>org.mulesource:mule-esb</exclude></excludes></dependencySet></dependencySets>
  <fileSets>
    <fileSet>
      <directory>${basedir}/src/main/resources</directory>
      <outputDirectory>/mule-standalone-2.2.1/etc</outputDirectory>
      <includes>
        <!--include the property file -->
        <include>**/*jonathan*.properties</include></includes></fileSet>
    <fileSet>
      <directory>${basedir}/src/main/resources</directory>
      <outputDirectory>/mule-standalone-2.2.1/bin</outputDirectory>
      <includes>
        <!-- include Mule XML config file-->
        <include>**/*jonathan*.xml</include></includes></fileSet>
    <fileSet>
      <directory>${basedir}/src/main/resources</directory>
      <outputDirectory>/mule-standalone-2.2.1/conf</outputDirectory>
      <includes>
        <!-- modified wrapper.conf to stake in account the etc/ folder, containing the property file-->
        <include>**/wrapper.conf</include></includes></fileSet>
    <fileSet>
      <directory>${basedir}/src/main/resources</directory>
      <outputDirectory>/mule-standalone-2.2.1/</outputDirectory>
      <includes>
        <include>**/*-mule-jonathan.bat</include>
      </includes>
    </fileSet>
  </fileSets>
</assembly>

Build process

To build go to the folder yourproject/jonathan, then launch a mvn clean install. A complete installation package is output on target folder: jonathan-lalou-standalone-esb-1.0.zip.

The archive is built thanks to Maven Assembly plugin.

Install

Install

Copy or move the archive jonathan-lalou-standalone-esb-1.0.zip to any folder of your choice. Then unzip it.

(optionnal) Checks

Tree

Here is a tree of the installation, with some important file that must appear:

+---start-mule-jonathan.bat
+---bin
¦   +---mule-jonathan.xml
+---conf
¦   +---wrapper.conf
+---etc
¦   +---mule-jonathan.properties
+---lib
¦   +---boot
¦   ¦   +---exec
¦   +---endorsed
¦   +---mule
¦   +---opt
¦   +---user
¦       +------com.ibm.mq-6.0.2.0.jar
¦       +------com.ibm.mqjms-6.0.2.0.jar
¦       +------commonservices-6.0.2.0.jar
¦       +------connector-1.0.jar
¦       +------dhbcore-6.0.2.0.jar
¦       +------fscontext-1.2.jar
¦       +------providerutil-1.2.jar
¦       +------wlfullclient-10.3.jar
¦       +------connector-1.0.jar
+---licenses
+---logs

Files

Check the files listed above in the tree appear. Besides, check the conf/wrapper.conf file contains the line wrapper.java.classpath.4=%MULE_HOME%/etc

Config

Edit etc/mule-jonathan.properties file and set the right properties.

Use

Execute start-mule-jonathan.bat to launch Mule on Windows. On first attempt, Mule will display the user licence and ask you your confirmation you accept the terms of the agreement.

PostHeaderIcon WebLogic Deployment with Maven: Dynamic Property Settings

Case

You have to deploy a WAR archive on a WebLogic server. To simplify the deployment process, you use weblogic-maven-plugin. Then, you only have to launch a mvn clean install weblogic:deploy to compile and deploy the WAR.

Actually, the plugin configuration expects you to hard write the settings in the pom.xml, such as:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>weblogic-maven-plugin</artifactId>
    <version>2.9.1</version>
    <configuration>
        <name>myWebApplication-web</name>
        <adminServerHostName>localhost</adminServerHostName>
        <adminServerPort>7001</adminServerPort>
        <adminServerProtocol>t3</adminServerProtocol>
        <targetNames>myTargetServer</targetNames>
        <userId>myUserId</userId>
        <password>myPassword</password>
        <securitymodel>Advanced</securitymodel>
        <artifactPath>${project.build.directory}/myWebApplication-web.war</artifactPath>
    </configuration>
</plugin>

Yet, when you work on a multi-environment / multi-developper platform, hard writing the properties bothers. Production teams are not pleased, and, above all, it’s not safe.

Unworking fix

At first glance, I tried to use Maven filtering mechanisms. Anyway, this features was designed for compilation phase: properties are recopied from a property file to the actual one, and then included in the archive generated (may it be JAR, EAR or WAR); in a deployment phase, properties are not taken in account.
http://maven.apache.org/guides/getting-started/index.html#How_do_I_filter_resource_files

Unelegant fix

Another solution is to set properties by profile. This works, but is not elegant at all: the password for production environment has to reason to be readable in the pom.xml used by a developper!

Fix

WebLogic / Maven plugin

Add the following block:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>weblogic-maven-plugin</artifactId>
  <version>2.9.1</version>
  <configuration>
      <name>myWebApplication-web</name>
      <adminServerHostName>${weblogic.server.name}</adminServerHostName>
      <adminServerPort>${weblogic.server.port}</adminServerPort>
      <adminServerProtocol>${weblogic.server.protocol}
      </adminServerProtocol>
      <targetNames>${weblogic.target}</targetNames>
      <userId>${weblogic.user}</userId>
      <password>${weblogic.password}</password>
      <securitymodel>${weblogic.security}</securitymodel>
      <artifactPath>${project.build.directory}/myWebApplication-web.war
      </artifactPath>
  </configuration>
</plugin>

Properties / Maven plugin

Under the tag, add the block:

<properties>
    <weblogic.server.name>${myTargetServer.server.name}</weblogic.server.name>
    <weblogic.server.port>${myTargetServer.server.port}</weblogic.server.port>
    <weblogic.server.protocol>${myTargetServer.server.protocol}</weblogic.server.protocol>
    <weblogic.user>${myTargetServer.user}</weblogic.user>
    <weblogic.password>${myTargetServer.password}</weblogic.password>
    <weblogic.target>${myTargetServer.target}</weblogic.target>
    <weblogic.security>${myTargetServer.security}</weblogic.security>
</properties>

Within the block, add the the following block:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0-alpha-2</version>
    <executions>
        <execution>
            <phase>initialize</phase>
            <goals>
                <goal>read-project-properties</goal>
            </goals>
            <configuration>
                <files>
                    <file>conf/${maven.user}.myTargetServer.properties</file>
                </files>
            </configuration>
        </execution>
    </executions>
</plugin>

Settings.xml

Optionnaly, in your settings.xml, in your default profile, set the following property:

<profile></pre>
<id>myDefaultProfile</id>
 <properties>
 <maven.user>jonathan_lalou</maven.user>
 </properties>
</profile>

You can decide to bypass this step. In this case, you will have to add the following parameter on launching Maven:
-Dmaven.user=jonathan_lalou

Property file

Create a property file, with a name corresponding to the one you specified in maven.user property.

myTargetServer.server.name=localhost
myTargetServer.server.port=7001
myTargetServer.server.protocol=t3
myTargetServer.user=myUserId
myTargetServer.password=myPassword
myTargetServer.target=myTargetServer
myTargetServer.security=Advanced

Now, you can launch mvn package weblogic:deploy. The WAR will be deployed on the right server.

PostHeaderIcon weblogic-maven-plugin / java.net.MalformedURLException: no protocol: and

Case

I run mvn weblogic:deploy, with a correct configuration inside pom.xml file, in order to deploy a WAR on a WebLogic 10 server. My development machine runs under Windows XP, the distant server is under Linux. I get the following error:
java.net.MalformedURLException: no protocol: and

Complete stacktrace:

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'weblogic'.
[INFO] ------------------------------------------------------------------------
[INFO] Building myWar Maven Webapp
[INFO]    task-segment: [weblogic:deploy]
[INFO] ------------------------------------------------------------------------
Downloading: http://repository.codehaus.org/weblogic/weblogic/9.0/weblogic-9.0.pom
[INFO] Unable to find resource 'weblogic:weblogic:pom:9.0' in repository codehaus.org (http://repository.codehaus.org)
Downloading: http://repo1.maven.org/maven2/weblogic/weblogic/9.0/weblogic-9.0.pom
[INFO] Unable to find resource 'weblogic:weblogic:pom:9.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/weblogic/weblogic/9.0/weblogic-9.0.pom
[INFO] Unable to find resource 'weblogic:weblogic:pom:9.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repository.codehaus.org/weblogic/webservices/9.0/webservices-9.0.pom
[INFO] Unable to find resource 'weblogic:webservices:pom:9.0' in repository codehaus.org (http://repository.codehaus.org)
Downloading: http://repo1.maven.org/maven2/weblogic/webservices/9.0/webservices-9.0.pom
[INFO] Unable to find resource 'weblogic:webservices:pom:9.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/weblogic/webservices/9.0/webservices-9.0.pom
[INFO] Unable to find resource 'weblogic:webservices:pom:9.0' in repository central (http://repo1.maven.org/maven2)
[INFO] [weblogic:deploy]
[INFO] Weblogic Deployment beginning with parameters DeployMojoBase[adminServerHostName = myLocalHost, adminServerProtocol = t3, adminServerPort = 7001, userId = weblogic, password = myPassword, artifactPath = C:\...\target/myWar.war, projectPackaging = war, name = myWar, targetNames = oneTier, remote = true]
[INFO] Weblogic Deployment parameters [-adminurl, t3://myLocalHost:7001, -username, weblogic, -password, myPassword, -verbose, -debug, -name, myWar, -targets, muletier, -upload, -source, C:\...\target/myWar, -deploy]
weblogic.Deployer invoked with options:  -adminurl t3://myLocalHost:7001 -username weblogic -verbose -debug -name myWar -targets muletier -upload -source C:\workarea\development\primeweb\primeweb\projects\strategic\myWar\target/myWar -deploy
[WebLogicDeploymentManagerImpl.<init>():103] : Constructing DeploymentManager for J2EE version V1_4
deployments
[WebLogicDeploymentManagerImpl.getNewConnection():146] : Connecting to admin server at myLocalHost:7001, as user weblogic
[ServerConnectionImpl.getEnvironment():288] : setting environment
[ServerConnectionImpl.getEnvironment():291] : getting context using t3://myLocalHost:7001
[ServerConnectionImpl.getMBeanServer():239] : Connecting to MBeanServer at service:jmx:t3://myLocalHost:7001/jndi/weblogic.management.mbeanservers.domainruntime
[ServerConnectionImpl.getMBeanServer():239] : Connecting to MBeanServer at service:jmx:t3://myLocalHost:7001/jndi/weblogic.management.mbeanservers.runtime
[DomainManager.resetDomain():36] : Getting new domain
[DomainManager.resetDomain():39] : Using pending domain: true
[MBeanCache.addNotificationListener():96] : Adding notification listener for weblogic.deploy.api.spi.deploy.mbeans.TargetCache@19ccba
[MBeanCache.addNotificationListener():107] : Disabling mbean caching due to: java.net.MalformedURLException: no protocol: and
[MBeanCache.addNotificationListener():96] : Adding notification listener for weblogic.deploy.api.spi.deploy.mbeans.ModuleCache@ae1cf
[MBeanCache.addNotificationListener():107] : Disabling mbean caching due to: java.net.MalformedURLException: no protocol: and
[ServerConnectionImpl.initialize():171] : Connected to WLS domain: myMainDomain
[ServerConnectionImpl.setRemote():482] : Running in remote mode
[ServerConnectionImpl.init():161] : Initializing ServerConnection : weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl@a0e990
[BasicOperation.dumpTmids():690] : Incoming tmids:
[BasicOperation.dumpTmids():692] :   {Target=muletier, WebLogicTargetType=server, Name=myWar}, targeted=true
[BasicOperation.deriveAppName():139] : appname established as: myWar
<Aug 16, 2010 11:46:42 AM CEST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, myWar [archive: C:\workarea\development\primeweb\primeweb\projects\strategic\myWar\target\myWar], to muletier .>
[ServerConnectionImpl.upload():658] : Uploaded app to C:\win32app\bea\user_projects\domains\myMainDomain\.\servers\adminServer\upload\myWar
[BasicOperation.dumpTmids():690] : Incoming tmids:
[BasicOperation.dumpTmids():692] :   {Target=muletier, WebLogicTargetType=server, Name=myWar}, targeted=true
[BasicOperation.loadGeneralOptions():607] : Delete Files:false
Timeout :3600000
Targets:
muletier
ModuleTargets={}
SubModuleTargets={}
}
Files:
null
Deployment Plan: null
App root: C:\win32app\bea\user_projects\domains\myMainDomain\.\servers\adminServer\upload\myWar
App config: C:\win32app\bea\user_projects\domains\myMainDomain\.\servers\adminServer\upload\myWar\plan
Deployment Options: {isRetireGracefully=true,isGracefulProductionToAdmin=false,isGracefulIgnoreSessions=false,rmiGracePeriod=-1,retireTimeoutSecs=-1,undeployAllVersions=false,archiveVersion=null,planVersion=null,isLibrary=false,libSpecVersion=null,libImplVersion=null,stageMode=null,clusterTimeout=3600000,altDD=null,altWlsDD=null,name=myWar,securityModel=null,securityValidationEnabled=false,versionIdentifier=null,isTestMode=false,forceUndeployTimeout=0,defaultSubmoduleTargets=true,timeout=0}

[BasicOperation.execute():424] : Initiating deploy operation for app, myWar, on targets:
[BasicOperation.execute():426] :    muletier
<strong>java.net.MalformedURLException: no protocol: and</strong>
        at java.net.URL.<init>(URL.java:567)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:751)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
        at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
        at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
        at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
        at javax.management.remote.rmi.RMIConnectionImpl$6.run(RMIConnectionImpl.java:1513)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.management.remote.rmi.RMIConnectionImpl.unwrap(RMIConnectionImpl.java:1505)
        at javax.management.remote.rmi.RMIConnectionImpl.access$500(RMIConnectionImpl.java:72)
        at javax.management.remote.rmi.RMIConnectionImpl$7.run(RMIConnectionImpl.java:1548)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.management.remote.rmi.RMIConnectionImpl.unwrap(RMIConnectionImpl.java:1544)
        at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:771)
        at javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(Unknown Source)
        at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
        at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
        at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
        at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
[ServerConnectionImpl.close():334] : Closing DM connection
[ServerConnectionImpl.close():354] : Unregistered all listeners
[ServerConnectionImpl.closeJMX():374] : Closed JMX connection
[ServerConnectionImpl.closeJMX():386] : Closed Runtime JMX connection
[ServerConnectionImpl.closeJMX():398] : Closed Edit JMX connection

Explanation

Indeed, the " and " comes from the address of my local Maven 2 repository: C:\Documents and Settings\myLogin\.m2\repository, which is the default location. I consider this to be a bug of Mojo’s weblogic-maven-plugin plugin.

Fix

You do not have many choices :-(… You have to move your repository to a destination without blank spaces, such as C:\M2_repository.
Then, take care to edit your settings.xml, and add the following block after <settings> tag:

<localRepository>C:\M2_repository</localRepository>