diff --git a/src/main/java/org/jboss/ejb/_private/Logs.java b/src/main/java/org/jboss/ejb/_private/Logs.java index ef3b37c18..3ff1df72e 100644 --- a/src/main/java/org/jboss/ejb/_private/Logs.java +++ b/src/main/java/org/jboss/ejb/_private/Logs.java @@ -36,8 +36,11 @@ import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.MessageLogger; import org.jboss.logging.annotations.Once; +import org.jboss.logging.annotations.Param; import org.jboss.logging.annotations.Property; import org.jboss.remoting3.Channel; +import org.wildfly.client.config.ConfigXMLParseException; +import org.wildfly.client.config.ConfigurationXMLStreamReader; import javax.ejb.EJBException; import javax.naming.CommunicationException; @@ -318,6 +321,11 @@ public interface Logs extends BasicLogger { @Message(id = 102, value = "No asynchronous operation in progress") IllegalStateException noAsyncInProgress(); + // Configuration problems + + @Message(id = 200, value = "Cannot load from a module when jboss-modules is not available") + ConfigXMLParseException noJBossModules(@Param ConfigurationXMLStreamReader streamReader); + // Invocation result exceptions @Message(id = 400, value = "Remote invocation failed due to an exception") diff --git a/src/main/java/org/jboss/ejb/client/ConfigurationBasedEJBClientContextSelector.java b/src/main/java/org/jboss/ejb/client/ConfigurationBasedEJBClientContextSelector.java index ad1e3e237..e5d55c040 100644 --- a/src/main/java/org/jboss/ejb/client/ConfigurationBasedEJBClientContextSelector.java +++ b/src/main/java/org/jboss/ejb/client/ConfigurationBasedEJBClientContextSelector.java @@ -157,9 +157,9 @@ private static void parseInterceptorType(final ConfigurationXMLStreamReader stre ClassLoader cl; if (moduleName != null) { try { - cl = Module.getModuleFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName)).getClassLoader(); - } catch (ModuleLoadException e) { - throw new ConfigXMLParseException(e); + cl = ModuleLoadDelegate.loadModule(moduleName); + } catch (LinkageError e) { + throw Logs.MAIN.noJBossModules(streamReader); } } else { cl = ConfigurationBasedEJBClientContextSelector.class.getClassLoader(); @@ -180,6 +180,16 @@ private static void parseInterceptorType(final ConfigurationXMLStreamReader stre throw streamReader.unexpectedElement(); } + static final class ModuleLoadDelegate { + static ClassLoader loadModule(String moduleName) throws ConfigXMLParseException { + try { + return Module.getModuleFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName)).getClassLoader(); + } catch (ModuleLoadException e) { + throw new ConfigXMLParseException(e); + } + } + } + private static void parseConnectionsType(final ConfigurationXMLStreamReader streamReader, final EJBClientContext.Builder builder) throws ConfigXMLParseException { if (streamReader.getAttributeCount() > 0) { throw streamReader.unexpectedAttribute(0);