Search code examples
mavenwebsphereejb-3.0

How to properly include IBM EJB mappings using Maven


I have a Maven EJB project that is meant to be installed on a WAS8.5 server. Everything compiles up to the EAR fine, however, when I try to deploy the application the MDB mappings are not auto-filled in. I extract the jar (inside the ear) and I see...

--META-INF
----ejb-jar.xml
----ibm-ejb-jar-bnd.xml

So why isn't the mapping being picked up? Is there a configuration I need in my Plugin?

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <ejbVersion>3.0</ejbVersion>
                <generateClient>true</generateClient>
                <archive>
                    <manifest>
                        <!-- generate manifest file properly -->
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
            </configuration>
        </plugin>

UPDATE:

This looks like it is more of a problem with ibm-web-bnd.xml. I have confirmed that is in the final war.

Update for question...

I am using activation spec, as far as I can tell these are delcared fine in the ibm-ejb-bnd.xml of the ejb project. I can see them there in the ear. However, it still doesn't work. Also, I have an ear built by the old system and here and I have found no real differences in the following files...

  • application.xml
  • ibm-web-bnd.xml
  • ibm-ejb-jar-bnd.xml

I have also glanced over the web.xml and MANIFEST files and don't see anything.

Finally another weird note is when I try to install the maven generated one I see...

enter image description here

However, when I try to upload the Ant (previous build) one I see these options

enter image description here

UPDATE: Per comment

I added these files to a folder called new and one called old.

~/My Documents/tmp/file
$ ls old/
application.xml  ibm-ejb-jar-bnd.xml  ibm-web-ext.xml
ejb-jar.xml      ibm-web-bnd.xml

I then diffed the two folders, here is the outcome...

diff new/application.xml old/application.xml
5c5
<       <module id="Module_1352494482335">^M
---
>       <module id="Module_1276803943498">^M

Solution

  • I played around with so many things my resolution was unscientific. However, this SEEMED to work for me....

    <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <configuration>
                            <tasks>
                                <property name="was6.home" value="C:\Program Files\IBM\WebSphere\AppServer" />
                                <property name="user.install.root" value="${was6.home}" />   
                                <path id="was.classpath">
                                    <fileset dir="${was6.home}/lib">
                                        <include name="webservices.jar" />
                                        <include name="wsprofile.jar" />
                                        <include name="j2ee.jar" />
                                        <include name="ffdc.jar" />
                                        <include name="wsdl4j.jar" />
                                        <include name="bootstrap.jar" />
                                        <include name="commons-logging-api.jar" />
                                        <include name="commons-discovery.jar" />
                                        <include name="ras.jar" />
                                        <include name="wsexception.jar" />
                                        <include name="emf.jar" />
                                        <include name="classloader.jar" />
                                    </fileset>
                                    <fileset dir="${was6.home}/dev">
                                        <include name="was_public.jar" />
                                    </fileset>
                                    <fileset dir="${was6.home}/plugins">
                                        <include name="com.ibm.ws.runtime.jar" />
                                    </fileset>
                                    <fileset dir="${was6.home}/java/jre/lib">
                                        <include name="xml.jar" />
                                        <include name="ibmorb.jar" />
                                        <include name="ibmorbapi.jar" />
                                    </fileset>
                                </path>
                                <path id="wsejbdeploy.path">
                                    <path refid="maven.compile.classpath"/>
                                    <fileset dir="${was6.home}/java/jre/lib">
                                        <include name="xml.jar" />
                                        <include name="ibmorb.jar" />
                                        <include name="ibmorbapi.jar" />
                                    </fileset>
                                </path>
                                <taskdef name="wasEjbDeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy" 
                                     classpathref="was.classpath" />
    
                                <echo> 
                                    Hello World: FYI
                                    project.name=${project.name}
                                    project.artifactId=${project.artifactId}
                                    project.groupId=${project.groupId}
                                    project.version=${project.version}
                                    project.packaging=${project.packaging}
                                    project.description=${project.description}
                                </echo>
    
                                <delete dir="${project.build.directory}/ejbdeply-working" />
                                <wasEjbDeploy 
                                    inputJar="${project.build.directory}/${project.artifactId}-${project.version}.jar" 
                                    outputJar="${project.build.directory}/${project.artifactId}-${project.version}-OUTPUT.jar" 
                                    wasHome="${was6.home}" 
                                    classpathref="wsejbdeploy.path"
                                    workingDirectory="${project.build.directory}/ejbdeply-working"
                                    keepGenerated="true"
                                    failonerror="true"
                                    trace="true" />
    
                                <move file="${project.build.directory}/${project.artifactId}-${version}.jar" 
                                    tofile="${project.build.directory}/${project.artifactId}-${version}-INPUT.jar"  />
    
                                <move file="${project.build.directory}/${project.artifactId}-${version}-OUTPUT.jar" 
                                   tofile="${project.build.directory}/${project.artifactId}-${version}.jar"  />
    
                                <echo> **** Task WsEJBDeploy Complete! **** </echo>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>