<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Erp on despatches</title><link>https://icle.es/tags/erp/</link><description>Recent content in Erp on despatches</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 20 Jun 2025 08:42:17 +0100</lastBuildDate><atom:link href="https://icle.es/tags/erp/index.xml" rel="self" type="application/rss+xml"/><item><title>Maven2, EJB3 and JBoss</title><link>https://icle.es/2008/12/28/maven2-ejb3-and-jboss/</link><pubDate>Sun, 28 Dec 2008 18:53:50 +0000</pubDate><guid>https://icle.es/2008/12/28/maven2-ejb3-and-jboss/</guid><description>&lt;p>I started work on a project called InVision about a year ago but have probably
spent about a week or two worth of effort on it in total&amp;hellip; :-(&lt;/p>
&lt;p>The Project aim was to bring together the easy time logging capabilities of
&lt;a href="http://processdash.sourceforge.net/" title="The Software Process Dashboard Initiative">Process Dashboard&lt;/a>
along with the project management capabilities of Microsoft Project (including
the Server Component). It is also to be integrated into our request tracking
System - &lt;a href="http://bestpractical.com/rt/" title="Request Tracker">Request Tracker&lt;/a>.
Eventually, it is also to integrate with our accounting system and turn into an
ERP (Enterprise Resource Planning) system and MIS (Management Information
System). There are plans to integrate with our Wiki and our Document Management
System too.&lt;/p>
&lt;p>But these are all lofty goals.  One of our recent projects introduced me to the
&lt;a href="http://www.springframework.net/" title="Spring.NET Application Framework">Spring Framework&lt;/a>.
While I am still not a fan of Spring, the scale of the project and the way of
approaching it gave me some ideas and additional tools to work with. I wanted to
bring these into the InVision Project.&lt;/p>
&lt;p>The key one here was Maven 2. InVision already used EJB3 and JBoss (4.2 as it
happened). There was one additional issue for me to resolve and that was out of
container testing. Something that is very easy to do with Spring but a little
more troublesome with EJB3 since it doesn&amp;rsquo;t have an out of container
framework&amp;hellip;&lt;/p></description><content:encoded><![CDATA[<p>I started work on a project called InVision about a year ago but have probably
spent about a week or two worth of effort on it in total&hellip; :-(</p>
<p>The Project aim was to bring together the easy time logging capabilities of
<a href="http://processdash.sourceforge.net/" title="The Software Process Dashboard Initiative">Process Dashboard</a>
along with the project management capabilities of Microsoft Project (including
the Server Component). It is also to be integrated into our request tracking
System - <a href="http://bestpractical.com/rt/" title="Request Tracker">Request Tracker</a>.
Eventually, it is also to integrate with our accounting system and turn into an
ERP (Enterprise Resource Planning) system and MIS (Management Information
System). There are plans to integrate with our Wiki and our Document Management
System too.</p>
<p>But these are all lofty goals.  One of our recent projects introduced me to the
<a href="http://www.springframework.net/" title="Spring.NET Application Framework">Spring Framework</a>.
While I am still not a fan of Spring, the scale of the project and the way of
approaching it gave me some ideas and additional tools to work with. I wanted to
bring these into the InVision Project.</p>
<p>The key one here was Maven 2. InVision already used EJB3 and JBoss (4.2 as it
happened). There was one additional issue for me to resolve and that was out of
container testing. Something that is very easy to do with Spring but a little
more troublesome with EJB3 since it doesn&rsquo;t have an out of container
framework&hellip;</p>
<p>I have grown to be a big fan of Maven 2 and using Maven 2 to configure an EJB
project is not as easy or straightforward as I would have liked: I wanted to
separate the whole project into four parts</p>
<ul>
<li>Domain Model (or just the entity beans); Also referred to as a Hibernate
Archive (HAR)</li>
<li>Stateful/Stateless Beans (Just the Beans, since I don&rsquo;t consider entities
beans in EJB3)</li>
<li>Application Client (J2SE Application)</li>
<li>Web App (Using SEAM)</li>
<li>I would also need an EAR project to deploy the DomainModel, Beans &amp; WebApp as
one pacakge into JBoss.</li>
</ul>
<p>I have not got as far as the SEAM project yet but the other ones were
straightforward enough to set up with Maven 2.</p>
<p>Both the Domain Model and the Beans project had to be set up as ejb projects and
use the maven-ejb-plugin</p>
```xml
 <build>
     <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-ejb-plugin</artifactId>
             <configuration>
                 <ejbVersion>3.0</ejbVersion>
             </configuration>
         </plugin>
     </plugins>
 </build>
```
<p>I set up the persistence context within the Domain Model</p>
```xml
<persistence-unit name="em">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>java:/datasource</jta-data-source>
</persistence-unit>
```
<p>I could then reference the context from the Beans project by injecting it with</p>
```java
@PersistenceContext(unitName="em")
```
<p>Easy enough!</p>
<p>Now configuring the EAR project: This was configured as an ear package which
depended on the other two projects with the following configuration</p>
```
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<version>5</version>
 <modules>
 <ejbModule>
 <groupId>uk.co.kraya.invision</groupId>
 <artifactId>beans</artifactId>
 </ejbModule>
 <ejbModule>
 <groupId>uk.co.kraya.invision</groupId>
 <artifactId>DomainModel</artifactId>
 </ejbModule>
 </modules>
 <jboss>
 <version>4.2</version>
 <data-sources>
 <data-source>invision-ds.xml</data-source>
 </data-sources>
 </jboss>
 </configuration>
 </plugin>
 <plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>jboss-maven-plugin</artifactId>
 <configuration>
 <jbossHome><jboss-home-path></jbossHome>
 <hostName><hostname></hostName>
 <port>8080</port>
 </configuration>
 </plugin>
 </plugins>
 </build>
```
<p>With this configured, from the EAR project, I could do mvn ear:deploy to deploy
to JBoss.</p>
<p>Additionally, within eclipse, I created a new run-type that ran ear:undeploy
package ear:deploy to re-deploy the package to JBoss. Works a treat</p>
<p>There are still a few kinks to be ironed out.</p>
<p>I still need to install (mvn install) the two projects before the EAR will pick
it up to deploy. I need to get the ear re-deploy to re-build the other projects.
Something to look at another day.</p>
<p>I had manually deployed the DataSource file to JBoss. It might be possible to do
this via Maven.</p>
<p>I also very much liked the Eclipse automatic deploy feature. It is possible to
use the eclipse plugin on maven to get Eclipse to identify this as a JBoss
deployable project but I ran into some problems and gave up. Ideally, Eclipse
would auto-deploy the project.</p>
<p>However, the above is less relevant once Out-Of-Container testing is in place.
Now, this does work, but I will leave that to another day&hellip;</p>]]></content:encoded></item></channel></rss>