WAR outside the EAR, not able to reference JAR ins

2019-09-06 07:13发布

I am migrating to Wildfly 8.2 from JBoss 5.1, I am deploying a Web Service using the resteasy and some EAR which has the code to get the requested data from the DB. Both the EAR which has multiple (6) JARs, but when I call the Web Service, it is not able to find the EAR and refer it's JARs

14:57:48,183 INFO [stdout] (default task-4) InitialContextFactory not defined - using default: org.jnp.interfaces.NamingContextFactory

14:57:48,184 ERROR [stderr] (default task-4) javax.naming.NameNotFoundException: bpc/AccountManagementService -- service jboss.naming.context.java.bpc.AccountManagementService

I have 2 separate deployment of EAR and WAR and both of them are deployed simultaneously and they both get deployed without any hassle.

Why are then not able to integrate is my issue right now.

2条回答
别忘想泡老子
2楼-- · 2019-09-06 07:28

I resolved this issue by adding jboss-deployment-structure.xml in my WAR file under the web-inf folder by adding dependency like

dependencies>  
            <module name="deployment.MY_EAR.ear.MY_EJB_JAR.jar"/>  
</dependencies>
查看更多
对你真心纯属浪费
3楼-- · 2019-09-06 07:42

If you migrated from jboss 5 to wildfly, you have to adjust your jndi lookups.. You are getting a NameNotFoundException, so probably you are performing a lookup using the old jndi syntax..

When you startup your server, the log will show you different jndi names for your ejbs.. If you are looking for an ejb from a war, and both of them are not bundled in the same ear, then you have to use the java:global naming type..

For example, assuming that AccountManagementService is an interface, annotate it with @Remote, and search it from your war using the following jndi syntax

java:global/earName/ejb-jar-name/AccountManagementService!com.example.AccountManagementServiceImpl

See if this document helps (Modify JNDI lookup code section) https://docs.jboss.org/author/display/AS71/Order+Application+Migration+from+EAP5.1+to+AS7

查看更多
登录 后发表回答