• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven 2 EJB 3.0

 
Bhiku Mhatre
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to compile a ejb 3 project using maven2. However, I am running into following issue.

[40,1] annotations are not supportedin -source 1.3
(try -source 1.5 to enable annotations)
@MessageDriven(mappedName = "jms/mymsgbean", activationConfig =


The project structure is
parentProj
ejbpoj1
ejbpoj2
ejbpoj3


Here is the parentproj.pom file.

<project>
<parent>
<groupId>com.acme</groupId>
<artifactId>apps</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ejb</artifactId>
<name>ejb</name>
<packaging>pom</packaging>
<modules>
<moduleAmessagebean</module>
<module>Bmessagebean</module>
<module>Cmessagebean</module>
<module>Dmessagebean</module>
<module>Emessagebean</module>
</modules>


<build>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerVersion>1.5</compilerVersion>
<source>1.5</source>
<target>1.5</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<optimize>false</optimize>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>

</plugins>

</build>


</project>

Does anyone have a solution?
Important input: JAVA_HOME point to JDK 5.0

Thanks,
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this happening to beans in all your sub-projects or just one? Is there anything in the sub-project POMs that could override the setting? Or any system/user settings that could override this?
 
Bhiku Mhatre
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I resolved the problem. The issue arised due to faulty inheritance. Now that inheritance is set properly, it is working.

Thanks Natan for looking into the problem.
 
Bhiku Mhatre
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. Looks like I reported the success prematurely. The EJB 3.0 problem still persists.

Here is my pom.xml

<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.acme</groupId>
<artifactId>ejbs</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>abcdMassageBean</artifactId>
<packaging>ejb3</packaging>
<name>abcdMassageBean</name>

</project>
upon trying compile target, following error is thrown.


Please note: When packaging is set to ejb, it works fine.



[INFO] The plugin 'org.apache.maven.plugins:maven-ejb3-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-ejb3-plugin' does not exist or no valid version could be f
ound
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1286)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1522)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindLifecycleForPackaging(DefaultLifecycleExecutor.java:1016)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:980)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:458)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
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: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-ejb3-plugin' does not exist or no valid
version could be found
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:228)
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:90)
at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:166)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1257)
... 18 more
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The maven-ejb-plugin page gives this plugin configuration for building to the EJB3 spec -



So you would leave packaging as 'ejb' and the above configuration should make your EJB 3.0 spec.
 
Bhiku Mhatre
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan,
Thanks for quick reply. I tried and it worked. I was refering to documents on Maven forum which it appears are obsolete. I am very close to packaging an ear file. However, another error is thrown in the following script of ear generation project.


Here is pom.xml

<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.acme</groupId>
<artifactId>apps</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>psmear</artifactId>
<name>psm ear packaging</name>
<packaging>ear</packaging>

<build>
<plugins>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.1</version>
<configuration>
<displayName>PSM Project Enterprise Archive</displayName>
<description>includes EJBS, Apps and War file</description>
<earSourceDirectory>EarContent</earSourceDirectory>
<defaultJavaBundleDir>APP-INF/lib</defaultJavaBundleDir>

<modules>

<javaModule>
<groupId>com.acme</groupId>
<artifactId>core</artifactId>
</javaModule>
<javaModule>
<groupId>com.acme</groupId>
<artifactId>product</artifactId>
</javaModule>



<ejb3Module>
<groupId>com.acme</groupId>
<artifactId>handlermessagebean</artifactId>
<bundleFileName>handlermessagebean.ejb3</bundleFileName>
</ejb3Module>


<ejb3Module>
<groupId>com.acme</groupId>
<artifactId>interfacemessagebean</artifactId>
<bundleFileName>interfacemessagebean.ejb3</bundleFileName>
</ejb3Module>


<ejb3Module>
<groupId>com.acme</groupId>
<artifactId>persistencemessagebean</artifactId>
<bundleFileName>persistencemessagebean.ejb3</bundleFileName>
</ejb3Module>


<ejb3Module>
<groupId>com.acme</groupId>
<artifactId>productmessagebean</artifactId>
<bundleFileName>productmessagebean.ejb3</bundleFileName>
</ejb3Module>

<ejb3Module>
<groupId>com.acme</groupId>
<artifactId>urlharvestermessagebean</artifactId>
<bundleFileName>urlharvestermessagebean.ejb3</bundleFileName>
</ejb3Module>
</modules>
</configuration>
</plugin>



</plugins>

</build>

<dependencies>

<dependency>
<groupId>com.acme</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>com.acme</groupId>
<artifactId>product</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>


<dependency>
<groupId>com.acme</groupId>
<artifactId>interfacemessagebean</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>


<dependency>
<groupId>com.acme</groupId>
<artifactId>handlermessagebean</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>


<dependency>
<groupId>com.acme</groupId>
<artifactId>persistencemessagebean</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>


<dependency>
<groupId>com.acme</groupId>
<artifactId>productmessagebean</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>


<dependency>
<groupId>com.acme</groupId>
<artifactId>urlharvestermessagebean</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>

and Here is the exception stack.


[INFO] Trace
org.apache.maven.BuildFailureException: Artifact[com.acme:handlermessagebean:ejb3] is not a dependency of the project.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:560)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
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: org.apache.maven.plugin.MojoFailureException: Artifact[com.acme:handlermessagebean:ejb3] is not a dependency of the project.
at org.apache.maven.plugin.ear.AbstractEarModule.resolveArtifact(AbstractEarModule.java:98)
at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:98)
at org.apache.maven.plugin.ear.GenerateApplicationXmlMojo.execute(GenerateApplicationXmlMojo.java:96)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
... 16 more


Thanks once again for your help.
 
Bhiku Mhatre
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolved the issue by stating ejbModule instead of ejb3Module and type to be ejb instaed of jar. Please note, with these changes, Still, ejb3 files are inclueded.
The question is, when is one suppoesed to use ejb3Module Tag? It appears to be redundant and misleading tag.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic