[英]Maven EAR + WAR + JAR
I have 3 projects (using Maven): war, ejb and ear and I'm facing this problem: 我有3个项目(使用Maven):war,ejb和ear,我正面临这个问题:
My war
project has a ejb
dependency so I put... 我的war
项目具有ejb
依赖性,所以我把...
<dependency>
<groupId>my.company.name</groupId>
<artifactId>ejb-module</artifactId>
<version>1.0</version>
<type>ejb</type>
<scope>provided</scope>
</dependency>
... and ear
has ejb
and war
dependencies: ...并且ear
具有ejb
和war
依赖性:
<dependency>
<groupId>my.company.name</groupId>
<artifactId>web-module</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
<dependency>
<groupId>my.company.name</groupId>
<artifactId>ejb-module</artifactId>
<version>1.0</version>
<type>ejb</type>
</dependency>
...
<configuration>
<filtering>true</filtering>
<version>7</version>
<modules>
<webModule>
<groupId>my.company.name</groupId>
<artifactId>web-module</artifactId>
<contextRoot>/</contextRoot>
</webModule>
<ejbModule>
<groupId>my.company.name</groupId>
<artifactId>ejb-module</artifactId>
</ejbModule>
</modules>
</configuration>
During deployment I can update schema and create tables, sequences, but when I try to use a session bean I always get javax.naming.NameNotFoundException: MySessionBean
and it's funny because I see on console JNDI bindings for session bean named 'MySessionBean'
in subdeployment ejb-module
of ear
. 在部署期间,我可以更新架构并创建表,序列,但是当我尝试使用会话bean时,总是会得到javax.naming.NameNotFoundException: MySessionBean
,这很有趣,因为我在控制台上看到子部署中JNDI bindings for session bean named 'MySessionBean'
ejb-module
ear
ejb-module
。
I've been trying for hours to figure it out what I'm missing, but I got nothing. 我已经尝试了好几个小时才能弄清我所缺少的内容,但是却一无所获。 Could it be the dependency scopes? 可能是依赖范围吗?
I forgot to say what was wrong: 我忘了说什么错了:
java:global/ejb-module/MySessionBean
java:app/ejb-module/MySessionBean
java:module/MySessionBean
It turns I was using java:module/MySessionBean
to acquire Session Bean so the exception was something like '..cannot find ear/module/MySessionBean', so I changed to java:app/ejb-module/MySessionBean
and now it works! 轮到我使用java:module/MySessionBean
来获取Session Bean,所以异常是类似“ ..找不到耳朵/模块/ MySessionBean”的东西,所以我改为java:app/ejb-module/MySessionBean
,现在可以了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.