Mule : How to share the same mule project between a JBoss AS and a CE runtime? - eclipse

The objective I have is to develop a bus with Mule, to run it into a JBoss.
My IDE is eclipse kepler, I have the Anypoint Studio plugin installed, a JBoss 7.1.1, a 3.5 CE runtime, Maven etc etc.
I took a look a this page : Deploy War into Mule Standalone server but I don't see haw it could help.
Context :
- Jboss is an imposed choice. I know it exists an EE version of the runtime, specially for the HA ability (that I need), but it's not an option for my client.
As it's "easier" to test my flows on the standalone (CE) runtime, I wanted to find a way to develop one Mule project to execute it on a CE runtime during the developing phase, and on a JBoss AS during the integration phase.
To do that, I tried to define :
- a jar maven project which contains all the flow
- a "mule" maven project, with the previous jar as the dependency
- a war maven project which athe previous jar and all the module/transport mule jars as dependencies
When I build the mule zip, my jar is included inside, but when it's executed none of ny flew is registered. So it doesn't work.
When I execute the war on JBoss, everything looks fine for the "first" flow (the input one), but I have a crash when the second one is called using a VM connector (other issue, I'll make another request)
Is there a way to do something working with this approach?
I tried to define 2 pom for the same mule project (one pom which generate a war, and a standalone-pom which generate the mule zip), but this is not very "easy to use" for my team, as the eclipse integration of this kind of project is not very friendly.
The last thing I can try is to keep the mule project pom with a mule packaging, and add a maven assembly to build the jar I could include in my war, but I'd prefer a nicer solution...
Thanks for all of your ideas!
Ah, the test flew I'm trying to integrate.
I have 3 flew :
- The first one stands for the HTTP request (to call my CE runtime)
- The second one stands for the Servlet request (to call my JBoss)
- The third one is called by both my CE runtime and my JBoss input flow, throw the VM connector. I'm thinking replace the VM connector by a Flow Call, as the VM inbound-endpoint is not registered when it's embedded into my war (but it works when executed in a CE runtime...)
main file :
<flow name="muleFlow1" doc:name="muleFlow1">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" doc:name="HTTP" />
<echo-component doc:name="Echo" />
<vm:outbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
</flow>
<flow name="muleFlow2" doc:name="muleFlow2">
<servlet:inbound-endpoint path="servlet"
responseTimeout="10000" doc:name="Servlet" />
<echo-component doc:name="Echo" />
<vm:outbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
</flow>
second file :
<flow name="otroFlow1" doc:name="otroFlow1">
<vm:inbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
<set-payload value="it works" doc:name="Set Payload" />
<echo-component doc:name="Echo" />
</flow>
Thanks !

I didn't find anything else, so I opted for an assembly descriptor...
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>mule</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>classes/**/*.class</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<excludes>
<exclude>org.mule:mule-core</exclude>
<exclude>commons-cli:commons-cli</exclude>
<exclude>log4j:log4j</exclude>
<exclude>org.mule.mvel:mule-mvel2</exclude>
<exclude>org.mule.common:mule-common</exclude>
<exclude>org.mule.modules:mule-module-client</exclude>
<exclude>org.mule.modules:mule-module-spring-config</exclude>
<exclude>org.mule.modules:mule-module-annotations</exclude>
<exclude>org.mule.modules:mule-module-xml</exclude>
<exclude>org.mule.modules:mule-module-cxf</exclude>
<exclude>org.mule.modules:mule-module-spring-security</exclude>
<exclude>org.mule.transports:mule-transport-http</exclude>
<exclude>org.mule.transports:mule-transport-ssl</exclude>
<exclude>org.mule.transports:mule-transport-tcp</exclude>
<exclude>commons-codec:commons-codec</exclude>
<exclude>org.mule.modules:mule-module-spring-extras</exclude>
<exclude>org.mule.modules:mule-module-builders</exclude>
<exclude>org.mule.modules:mule-module-management</exclude>
<exclude>org.mule.modules:mule-module-scripting</exclude>
<exclude>org.mule.modules:mule-module-sxc</exclude>
<exclude>org.mule.tests:mule-tests-functional</exclude>
<exclude>org.mule:mule-core</exclude>
<exclude>org.mule.transports:mule-transport-file</exclude>
<exclude>org.mule.transports:mule-transport-jdbc</exclude>
<exclude>org.mule.transports:mule-transport-jms</exclude>
<exclude>org.mule.transports:mule-transport-servlet</exclude>
<exclude>org.mule.transports:mule-transport-vm</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
My mule project is now a jar, which generate a jar file (for my webapp) and a zip file (for my runtime CE)
One important thing :
To realize the spring imports of each flow, we need to specify when mule is deployed in a web app, but the runtime expects to work. It can be done by creating a maven profile and enabling the resources filtering to determine when add "classpath:"...

Related

JBOSS 7.2.2 External Folder Linking

I have been searching around for this specific problem of mine. We have a folder that is on a shared folder on another server "\\server1\shares\web\images" and I want to link this folder into my web application in Jboss 7.2.2. I'm migrating from Jboss 4.2.2 to Jboss 7.2.2.
Here is my server.xml file from Jboss 4.2.2. You'll notice that the <Context> tag handles this link for me.
<Server>
<Service name="jboss.web">
<!-- ... -->
<Engine name="jboss.web" defaultHost="localhost">
<!-- ... -->
<Host name="myApp" autoDeploy="false" deployOnStartup="false"
deployXML="false" configClass="org.jboss.web.tomcat.security.config.JBossContextConfig">
<!-- ... -->
<Context path="/images" appBase="" docBase="\\server1\shares\web\images"
debug="99" reloadable="true" />
<!-- ... -->
</Host>
</Engine>
</Service>
My research has lead me to use modules, but I cannot figure out how to use the modules properly for this problem. Most examples shows how to provide some link to a folder on the same machine as the Jboss server is on.
So, am I suppose to use modules or is there another way of doing this?

failed to run wicket examples on tomcat7

I downloaded wicket examples 1.6.0 and built successfully in netbeans7.2. but got errors when I tried to deploy on tomcat 7:
Cannot deploy the module. The context.xml file seems to be broken. Check whether it is well-formed and valid.
The module has not been deployed.
See the server log for details.
at
org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
at
org.netbeans.modules.maven.j2ee.ExecutionChecker.performDeploy(ExecutionChecker.java:178)
at
org.netbeans.modules.maven.j2ee.ExecutionChecker.executionResult(ExecutionChecker.java:130)
at
org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:212)
at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
heres the contents in context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<!-- <Loader className="org.atmosphere.util.AtmosphereClassloader"/> -->
<Loader delegate="true"/>
</Context>
I prefer to run wicket in eclipse as it negates the requirement to mess around with an external tomcat instance.
If you are comfortable with eclipse and maven i would download wicket 1.6 example archetype via maven, import into eclipse and then in the test directory you can run the run.java class to get an internal jetty server host wicket for you.
this should get you started quickly without having to wrestle with tomcat configurations too.
Not really an answer but an alternative route to the same end point
Add parameter path to context tag, same path that app will be served:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/application-path-name/">
<!-- <Loader className="org.atmosphere.util.AtmosphereClassloader"/> -->
<Loader delegate="true"/>
</Context>
Answer obtained from this question.

Beginner Steps to Configure a Java Project to Build with Apache Maven

I've been given the task of migrating an existing project -- formerly built with Ant -- to use Apache Maven. I'm brand new to the entire concept, though I've spent the last several hours doing as much research as I can on the subject. Sadly, I'm having some proxy issues when it comes to installing things like m2e and Eclipse IAM, so everything must be done from the command prompt. As of right now, I do have maven installed properly; the trick now is to use it in my project rather than Ant. I've looked online and found a few tutorials, but they are all too vague for me considering my lack of experience with all of this. If anyone can break the steps down for me one-by-one in a detailed manner, that would be more than amazing. On a side note, I've been told to add the following to the local Maven Settings:
<settings>
<servers>
<server>
<id>local_tomcat</id>
<username>admin</username>
<password>tomcat</password>
</server>
<server>
<id>artifactory</id>
<username>user</username>
<password>password</password>
</server>
</servers>
<mirrors>
<mirror>
<id>artifactory</id>
<name>Artifactory</name>
<url>https://jenkins.web.jw.local/artifactory/repo1</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.jw.local</host>
<port>80</port>
<username>user</username>
<password>password</password>
<nonProxyHosts>*.jw.local</nonProxyHosts>
</proxy>
</proxies>
</settings>
With the obvious username and password information filled in. I think I've managed that thus far by simply adding the necessary blocks into the settings.xml file under my ApacheMaven\conf directory. Other than that single step, I'm pretty much lost. Again, any help, especially that of a detailed tutorial in terms of command line instructions to build this project would be wonderful. Oh, and on another side-note, I am using Eclipse... Not sure if that would matter much.
EDIT: Considering Petr Kozelka's answer, I've attempted to make a pom.xml file for my project. Here's what I have so far...
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>appName</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>Application Name</name>
<description>Yadda Yadda</description>
<build>
<plugins>
</plugins>
</build>
<dependencies>
</dependencies>
<repositories>
</repositories>
</project>
Is this heading in the right direction? Also, do I need to construct the archetype.xml file myself, or will Maven do that through the command line somehow? If I need to do it myself, this is what I've come up with thus far:
<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
<id>lighthouse</id>
<sources>
<source>src/com/jeldwen/lighthouse/controller/AddTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/BugController.java</source>
<source>src/com/jeldwen/lighthouse/controller/DeleteTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/EnterTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/ModifyTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/PersonController.java</source>
<source>src/com/jeldwen/lighthouse/controller/ProjectController.java</source>
<source>src/com/jeldwen/lighthouse/controller/TimeController.java</source>
<source>src/com/jeldwen/lighthouse/model/Area.java</source>
<source>src/com/jeldwen/lighthouse/model/Bug.java</source>
<source>src/com/jeldwen/lighthouse/model/DBModel.java</source>
<source>src/com/jeldwen/lighthouse/model/DefaultModel.java</source>
<source>src/com/jeldwen/lighthouse/model/JWModel.java</source>
<source>src/com/jeldwen/lighthouse/model/JWTime.java</source>
<source>src/com/jeldwen/lighthouse/model/Person.java</source>
<source>src/com/jeldwen/lighthouse/model/Project.java</source>
<source>src/com/jeldwen/lighthouse/util/Lighthouse.java</source>
<source>src/com/jeldwen/lighthouse/util/LighthouseApplicationListener.java</source>
<source>src/com/jeldwen/lighthouse/util/LighthouseServlet.java</source>
<source>src/com/jeldwen/lighthouse/util/LighthouseSystemProperties.java</source>
<source>src/com/jeldwen/lighthouse/LighthouseApp.java</source>
</sources>
<testSources>
<!-- None -->
</testSources>
<allowPartial>true</allowPartial>
</archetype>
First of all: if you wish to customize settings.xml, do not touch the one in maven distro - instead, create a new file in $HOME/.m2/settings.xml where maven finds and uses it.
As the very first step, I recommend you to not use settings.xml at all.
Create a supersimple maven project, and try to compile it:
mvn clean install
Second step
Use very simple settings.xml:
you probably do not need proxy
servers part is needed only for publishing artifacts to a maven repository; that's not important at the beginning
here it is:
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<mirrors>
<mirror>
<id>repos</id>
<mirrorOf>*</mirrorOf>
<name>internal mirror</name>
<url>https://jenkins.web.jw.local/artifactory/repo1</url>
</mirror>
</mirrors>
<!-- TODO: the proxy part here -->
</settings>
This assumes that you use inhouse maven repository, for instance Nexus or Artifactory.
Using maven repo makes only sense if your projects are not happy with deps available in the Maven Central Repository - otherwise, you can safely go without it. (let's neglect the performance effect of repoman for now)
Now, add some java sources, dependencies etc. - and watch how new depenencies get automatically downloaded to your local repository...
Third step
Learn how to add further repositories to your repository manager (group "public" on Nexus)...
The rest is probably subject of further research.

Java Webstart with Tibco Native Libs

I am trying to deploy an application that uses the native implementation of Tibrv through the TibrvJ library using Java Webstart.
I have packaged up all of the Windows dlls from inside c:\tibco\tibrv\bin into a Jar file and have added these to the nativelib element in the JNLP file.
I was hoping that webstart would take the dll files from thetibco-7.5.1-nativelibs.jar file and allow them to be loaded via System.loadLibrary which is called from Tibrv.open(). However it doesn't seem to want to work properly.
My JNLP file looks like this:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="6.0+"
codebase="http://somewhere:8080/my-gui/application"
href="launch.jnlp">
<information>
<title>My GUI</title>
<vendor>Technology</vendor>
<description>Dashboard</description>
<description kind="short">Dashboard</description>
<icon href="icon/Stocks-128x128.png" />
<offline-allowed />
<shortcut online="true">
<desktop />
<menu submenu="Dashboard" />
</shortcut>
</information>
<security>
<all-permissions />
</security>
<update check="always" policy="prompt-update" />
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"
java-vm-args="-Xmx120M -ea />
<property name="log4j.configuration" value="live/log4j.xml" />
<property name="swing.aatext" value="true" />
<jar href="tibrvj-7.5.1.jar" />
<jar href="dashboard-gui.jar" main="true" />
</resources>
<resources>
<nativelib href="nativelib/tibco-7.5.1-nativelibs.jar" />
</resources>
<application-desc main-class="com.somewhere.Main">
<argument>classpath:/live/client.xml</argument>
<argument>/live/live.properties</argument>
</application-desc>
</jnlp>
The application launches but as soon as a call is made to open tib then it falls apart with an error along the lines of:
[Root exception is TibrvException[error=22,message=Version mismatch: libtibrv version 7.4 does not match version of tibrvj shared library 7.5]]
TibrvException[error=901,message=Library not found: tibrvj]]
The users have a variety of Tib installations already on their PCs from Tib 7.2 through to 7.5. The Webstart Application only works correctly on a machine with 7.5 installed which matches the Jar file inside the package. So it doesn't appear to do anything with the nativelib jar.
I would like to avoid having to deploy 3 versions of the web start application for the different versions of Tib that the users have installed.
Has anyone else managed to get this combination of TibrvJ and Webstart working?
I've managed to get it working. The trouble is that the call to System.loadLibrary when using Webstart doesn't load in the dependencies of the specified library even if they have been packaged up into a nativelib jar.
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6191612 for more info.
To get around this problem it is necessary to explicity load all of the dependencies in the correct order. It is also necessary to put each dll library into its own jar file.
So to use native TibrvJ you need to make the following calls before any calls to Tibrv.Open.
System.loadLibrary("msvcr71");
System.loadLibrary("tibrv");
System.loadLibrary("tibrvcm");
System.loadLibrary("tibrvft");
System.loadLibrary("tibrvcmq");
System.loadLibrary("tibrvj");
Happy Days!
I think you have encountered a problem with Webstart.
Some years ago, I had a Webstart application using Java 3D that didn't work on Macs. Eventually I found that all Macs some with an old version of Java 3D installed, and that already installed version was used over the newer version that I had included in the in my JNLP file. Your problem sounds almost exactly like this, so it could very well be the same problem.

Buckminster RCP simple project materialization

After watching the webinar, skimming over the BuckyBook PDF, and following the Eclipse RCP build tutorial, I still don't know how to materialize a simple RCP plug-in project from CVS into an eclipse workspace.
Does anyone have an example with a CQUERY and an RMAP file, for a simple one project workspace?
Its actually easy.
Here is a sample CSPEC:
<?xml version="1.0" encoding="UTF-8"?>
<cq:componentQuery xmlns:cq="http://www.eclipse.org/buckminster/CQuery-1.0" resourceMap="example-site.rmap">
<cq:rootRequest name="example-site" componentType="eclipse.feature"/>
</cq:componentQuery>
Note the root request name property points to a component. If you have an RCP app which has a main bundle (say one that is the launching point to your app), then you would point to this component using the name property above. This CSPEC will then download all dependent components using the RMAP below, using search paths, providers etc.
The RMAP:
<searchPath name="default">
<provider
readerType="cvs"
componentTypes="osgi.bundle,eclipse.feature"
source="true"
mutable="true">
<uri format=":pserver:anon#cvs.local:/opt/data/cvsroot,{0}/">
<bc:propertyRef key="buckminster.component" />
</uri>
</provider>
</searchPath>
<searchPath name="galileo">
<provider readerType="eclipse.import" componentTypes="osgi.bundle,eclipse.feature"
mutable="false" source="false">
<uri format="http://download.eclipse.org/releases/galileo?importType=binary"/>
</provider>
</searchPath>
<locator searchPathRef="default" pattern="^example\-.*" />
<locator searchPathRef="galileo" failOnError="false" />