WFLYNAM0027 : ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory

前端 未结 2 2004
-上瘾入骨i
-上瘾入骨i 2021-01-25 08:24

Enviornment- wildfly-9.0.2.Final, EJB 3.0

Following error occurred while trying to connect Test.java class(deployed as module at wildfly-9.0.2.Final@machine-A) to EJB wh

相关标签:
2条回答
  • 2021-01-25 09:05

    jboss-client.jar is required by the server at runtime. There are several ways of providing jars to a JBoss server -

    1. include jars in MANIFEST.MF (this is generally used for your own application jars)
    2. include jars in WEB-INF/lib - if the jar is specific to the given web project or WAR
    3. include jars in a module class loader and provide it to the web project via jboss-deploymet-structure.xml . This is done when there are multiple WARS and some of them (not all) need the jars.
    4. include jars in a module class loader and provide it to the server via global modules in standalone.xml . This is done when the jars are being referenced by all applications deployed on the server.

    For details on modules in JBoss, please refer to this link - https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

    As to your question on how putting the jboss-client.jar in a WAR instead of testclient.jar is resolving the issue, the answer is the same - this is how class loading works.

    0 讨论(0)
  • 2021-01-25 09:22

    You need to make your own module depend on a module that contains not only the jboss-client jar, but also all the dependencies of jboss-client, this might just be other modules or possibly other jars too. The first class it's moaning about being missing is javax/naming/spi/InitialContextFactory so edit the module.xml for the jboss-client module to depend on javax.api

    0 讨论(0)
提交回复
热议问题