1

I have to build a project(Parent and EAR, which contains jar, ejb, and 2 war modules) from RAD 9.5 and with maven.

When I build a project from maven command-line, everything works fine. It's creating skinny wars archive that runs on WebSphere 8.5.5.

When trying to update project from RAD, or to export EAR I'm getting the file that is different and won't work, with ClassNotFoundException for one of dependencies of the EJB.

Looking further, I found out that there is a difference in MANIFEST.MF in classpath section. Maven project put there instances with lib/ prefix and m2e/RAD without, like this:

Class-Path: lib/log4j-api-2.6.jar lib/log4j-core-2.6.jar lib/junit-4.12.jar lib/hamcrest-core-1.3.

in pure maven and:

Class-Path: log4j-api-2.6.jar log4j-core-2.6.jar junit-4.12.jar hamcrest-core-1.3.

I've tried to update a project, played with settings in pom. This is the closest I've got to working application.

My current ejb plugin configuration:

        <plugin>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
                <ejbVersion>3.1</ejbVersion>
            </configuration>
        </plugin>

And the exception(the lowest level):

Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:600)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:786)
at java.lang.ClassLoader.loadClass(ClassLoader.java:764)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:741)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:585)
at java.lang.ClassLoader.loadClass(ClassLoader.java:741)
... 75 more

I suppose that it's the issue, but I do not know hot to fix it.

Update: tried adding to manifest section:

<classpathPrefix>lib/</classpathPrefix>

same result.

Anton
  • 1,409
  • 1
  • 19
  • 37

2 Answers2

0

This is a roundabout answer, but you might find more success starting with the EE projects: WAR, EAR, etc. and then using the "Convert to Maven projects" option.

You can find info here and here.

Once you know a Maven structure that will map back to the EE project structure in RAD you'd also be able to work in the other direction. Not sure how much work that leaves you if you're happy with your existing project format.

Not sure I answered your question, but this was too long for a comment so here it is...

Community
  • 1
  • 1
Scott Kurz
  • 4,985
  • 1
  • 18
  • 40
  • This is done already, the project started as RAD project (which hides ant under its skin) and had to be converted to maven, because CI and ant didn't worked well. After conversion I spotted that RAD behaves differently from native maven. – Anton Jun 21 '16 at 09:52
0

I've noticed that if I copy manifest.mf generated by maven to the project and then build the project with RAD, it takes the right file to the final EAR. It's a workaround. Also, according to this: m2e-wtp will only generate manifest if does not exist.

Community
  • 1
  • 1
Anton
  • 1,409
  • 1
  • 19
  • 37