diff --git a/clustering/ejb/infinispan/src/main/java/org/wildfly/clustering/ejb/infinispan/bean/InfinispanBeanFactory.java b/clustering/ejb/infinispan/src/main/java/org/wildfly/clustering/ejb/infinispan/bean/InfinispanBeanFactory.java index 8b869e7099..f79c26948b 100644 --- a/clustering/ejb/infinispan/src/main/java/org/wildfly/clustering/ejb/infinispan/bean/InfinispanBeanFactory.java +++ b/clustering/ejb/infinispan/src/main/java/org/wildfly/clustering/ejb/infinispan/bean/InfinispanBeanFactory.java @@ -23,8 +23,11 @@ package org.wildfly.clustering.ejb.infinispan.bean; import java.time.Duration; +import javax.ejb.ConcurrentAccessTimeoutException; + import org.infinispan.Cache; import org.infinispan.context.Flag; +import org.infinispan.util.concurrent.TimeoutException; import org.wildfly.clustering.ee.Mutator; import org.wildfly.clustering.ee.MutatorFactory; import org.wildfly.clustering.ee.cache.CacheProperties; @@ -89,7 +92,12 @@ public class InfinispanBeanFactory implements BeanFactory { @Override public BeanEntry findValue(I id) { - return this.findCache.get(this.createKey(id)); + // TODO WFLY-14167 Cache lookup timeout should reflect @AccessTimeout of associated bean/invocation + try { + return this.findCache.get(this.createKey(id)); + } catch (TimeoutException e) { + throw new ConcurrentAccessTimeoutException(e.getLocalizedMessage()); + } } @Override diff --git a/connector/src/main/java/org/jboss/as/connector/_drivermanager/DriverManagerAdapter.java b/connector/src/main/java/org/jboss/as/connector/_drivermanager/DriverManagerAdapter.java new file mode 100644 index 0000000000..ed7845c5ff --- /dev/null +++ b/connector/src/main/java/org/jboss/as/connector/_drivermanager/DriverManagerAdapter.java @@ -0,0 +1,46 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.as.connector._drivermanager; + +import java.util.Enumeration; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; + +/** + * @author Tomasz Adamski + */ + +public class DriverManagerAdapter { + + private DriverManagerAdapter() { + } + + public static Enumeration getDrivers() { + return DriverManager.getDrivers(); + } + + public static void deregisterDriver(final Driver driver) throws SQLException { + DriverManager.deregisterDriver(driver); + } +} diff --git a/connector/src/main/java/org/jboss/as/connector/deployers/datasource/DefaultDataSourceResourceReferenceProcessor.java b/connector/src/main/java/org/jboss/as/connector/deployers/datasource/DefaultDataSourceResourceReferenceProcessor.java index 0be394b8a3..9c4ee22b2d 100644 --- a/connector/src/main/java/org/jboss/as/connector/deployers/datasource/DefaultDataSourceResourceReferenceProcessor.java +++ b/connector/src/main/java/org/jboss/as/connector/deployers/datasource/DefaultDataSourceResourceReferenceProcessor.java @@ -22,6 +22,7 @@ package org.jboss.as.connector.deployers.datasource; import org.jboss.as.ee.component.Attachments; +import org.jboss.as.ee.component.EEModuleDescription; import org.jboss.as.ee.component.InjectionSource; import org.jboss.as.ee.component.LookupInjectionSource; import org.jboss.as.ee.component.deployers.EEResourceReferenceProcessor; @@ -48,7 +49,10 @@ public class DefaultDataSourceResourceReferenceProcessor implements DeploymentUn if(deploymentUnit.getParent() == null) { final EEResourceReferenceProcessorRegistry eeResourceReferenceProcessorRegistry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY); if(eeResourceReferenceProcessorRegistry != null) { - eeResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(RESOURCE_REFERENCE_PROCESSOR); + final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); + if (eeModuleDescription != null && eeModuleDescription.getDefaultResourceJndiNames().getDataSource() != null) { + eeResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(RESOURCE_REFERENCE_PROCESSOR); + } } } } diff --git a/connector/src/main/java/org/jboss/as/connector/deployers/ds/processors/DriverManagerAdapterProcessor.java b/connector/src/main/java/org/jboss/as/connector/deployers/ds/processors/DriverManagerAdapterProcessor.java new file mode 100644 index 0000000000..72d32938eb --- /dev/null +++ b/connector/src/main/java/org/jboss/as/connector/deployers/ds/processors/DriverManagerAdapterProcessor.java @@ -0,0 +1,112 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2020, Red Hat, Inc., and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.as.connector.deployers.ds.processors; + +import org.jboss.as.connector._drivermanager.DriverManagerAdapter; +import org.jboss.as.server.deployment.Attachments; +import org.jboss.as.server.deployment.DeploymentPhaseContext; +import org.jboss.as.server.deployment.DeploymentUnit; +import org.jboss.as.server.deployment.DeploymentUnitProcessingException; +import org.jboss.as.server.deployment.DeploymentUnitProcessor; +import org.jboss.as.server.deployment.module.ModuleSpecification; +import org.jboss.modules.AbstractResourceLoader; +import org.jboss.modules.ClassSpec; +import org.jboss.modules.ResourceLoaderSpec; + +import java.io.ByteArrayOutputStream; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; +import java.util.Collections; + +/** + * @author Tomasz Adamski + *

+ * https://issues.redhat.com/browse/WFLY-14114 + *

+ * This is a hack that allows us to get access to {@link java.sql.Driver} registered by the driver code. Those objects are created by the + * driver code and registered in {@link java.sql.DriverManager}. Driver objects are not guaranteed to be deregistered which leads to leaks. + * {@link java.sql.DriverManager} allows for obtaining the list of drivers, and deregistering a driver but only in a give classloading context. + * As a result, connector module can not neither list or deregister drivers from a deployed driver module. + *

+ * To work this around, this hack modifies driver's module by injecting {@link DriverManagerAdapter} class to it. Because @{@link DriverManagerAdapter} + * is loaded by driver module it allows to obtain and deregister the drivers. + */ + +public class DriverManagerAdapterProcessor implements DeploymentUnitProcessor { + + @Override + public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { + final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); + final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); + final DriverAdapterResourceLoader resourceLoader = new DriverAdapterResourceLoader(); + moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoader)); + } + + static class DriverAdapterResourceLoader extends AbstractResourceLoader { + @Override + public ClassSpec getClassSpec(final String fileName) throws IOException { + InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName); + if (is == null) { + return null; + } + final byte[] bytes = readAllBytesFromStream(is); + final ClassSpec spec = new ClassSpec(); + spec.setBytes(bytes); + return spec; + } + + @Override + public Collection getPaths() { + return Collections.singletonList(DriverManagerAdapter.class.getPackage().getName().replace('.','/')); + } + + private static byte[] readAllBytesFromStream(final InputStream is) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + try { + final byte[] buffer = new byte[1024]; + int read = 0; + while ((read = is.read(buffer)) != -1) { + bos.write(buffer, 0, read); + } + return bos.toByteArray(); + } finally { + safeClose(is); + safeClose(bos); + } + } + + private static void safeClose(final Closeable c) { + if (c != null) { + try { + c.close(); + } catch (Throwable ignored) {} + } + } + } + + @Override + public void undeploy(DeploymentUnit deploymentUnit) { + + } +} diff --git a/connector/src/main/java/org/jboss/as/connector/deployers/ds/processors/DriverProcessor.java b/connector/src/main/java/org/jboss/as/connector/deployers/ds/processors/DriverProcessor.java index 37c1135d22..a474aa9835 100644 --- a/connector/src/main/java/org/jboss/as/connector/deployers/ds/processors/DriverProcessor.java +++ b/connector/src/main/java/org/jboss/as/connector/deployers/ds/processors/DriverProcessor.java @@ -25,9 +25,13 @@ package org.jboss.as.connector.deployers.ds.processors; import static org.jboss.as.connector.logging.ConnectorLogger.DEPLOYER_JDBC_LOGGER; import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.sql.Driver; +import java.util.Enumeration; import java.util.List; +import org.jboss.as.connector._drivermanager.DriverManagerAdapter; import org.jboss.as.connector.services.driver.DriverService; import org.jboss.as.connector.services.driver.InstalledDriver; import org.jboss.as.connector.services.driver.registry.DriverRegistry; @@ -42,6 +46,7 @@ import org.jboss.modules.Module; import org.jboss.modules.ModuleClassLoader; import org.jboss.msc.service.ServiceController.Mode; import org.jboss.msc.service.ServiceName; +import org.wildfly.common.Assert; /** * Deploy any JDBC drivers in a deployment unit. @@ -110,5 +115,25 @@ public final class DriverProcessor implements DeploymentUnitProcessor { /** {@inheritDoc} */ @Override public void undeploy(final DeploymentUnit context) { + try { + /** + * https://issues.redhat.com/browse/WFLY-14114 + * + * This hack allows to deregister all drivers registered by this module. See comments in {@link DriverManagerAdapterProcessor} + */ + final Module module = context.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE); + Class driverManagerAdapterClass = module.getClassLoader().loadClass(DriverManagerAdapter.class.getName()); + + Method getDriversMethod = driverManagerAdapterClass.getDeclaredMethod("getDrivers"); + Enumeration drivers = (Enumeration) getDriversMethod.invoke(null, null); + + Method deregisterDriverMethod = driverManagerAdapterClass.getDeclaredMethod("deregisterDriver", Driver.class); + while (drivers.hasMoreElements()) { + Driver driver = drivers.nextElement(); + deregisterDriverMethod.invoke(null, driver); + } + } catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { + Assert.unreachableCode(); + } } } diff --git a/connector/src/main/java/org/jboss/as/connector/deployers/ra/RaDeploymentActivator.java b/connector/src/main/java/org/jboss/as/connector/deployers/ra/RaDeploymentActivator.java index 9970405a02..1452d91cab 100644 --- a/connector/src/main/java/org/jboss/as/connector/deployers/ra/RaDeploymentActivator.java +++ b/connector/src/main/java/org/jboss/as/connector/deployers/ra/RaDeploymentActivator.java @@ -25,6 +25,7 @@ package org.jboss.as.connector.deployers.ra; import static org.jboss.as.connector.util.ConnectorServices.TRANSACTION_INTEGRATION_CAPABILITY_NAME; import org.jboss.as.connector.deployers.ds.processors.DriverProcessor; +import org.jboss.as.connector.deployers.ds.processors.DriverManagerAdapterProcessor; import org.jboss.as.connector.deployers.ds.processors.StructureDriverProcessor; import org.jboss.as.connector.deployers.ra.processors.IronJacamarDeploymentParsingProcessor; import org.jboss.as.connector.deployers.ra.processors.ParsedRaDeploymentProcessor; @@ -55,6 +56,7 @@ import org.jboss.msc.service.ServiceTarget; * @author Stefano Maestri */ public class RaDeploymentActivator { + private final boolean appclient; private final MdrService mdrService = new MdrService(); @@ -104,6 +106,7 @@ public class RaDeploymentActivator { updateContext.addDeploymentProcessor(ResourceAdaptersExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_RESOURCE_DEF_ANNOTATION_ADMINISTERED_OBJECT, new AdministeredObjectDefinitionAnnotationProcessor()); updateContext.addDeploymentProcessor(ResourceAdaptersExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_RAR_CONFIG, new RarDependencyProcessor(appclient)); + updateContext.addDeploymentProcessor(ResourceAdaptersExtension.SUBSYSTEM_NAME, Phase.CONFIGURE_MODULE, Phase.CONFIGURE_JDBC_DRIVER_MANAGER_ADAPTER, new DriverManagerAdapterProcessor()); if (!appclient) updateContext.addDeploymentProcessor(ResourceAdaptersExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_RAR_SERVICES_DEPS, new RaXmlDependencyProcessor()); updateContext.addDeploymentProcessor(ResourceAdaptersExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_RESOURCE_DEF_XML_CONNECTION_FACTORY, diff --git a/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/jboss/as/connector/main/module.xml b/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/jboss/as/connector/main/module.xml index 8bea2a38ec..8372bb8c5e 100644 --- a/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/jboss/as/connector/main/module.xml +++ b/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/jboss/as/connector/main/module.xml @@ -28,6 +28,7 @@ + diff --git a/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/clustering/ejb/infinispan/main/module.xml b/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/clustering/ejb/infinispan/main/module.xml index 7d13860ec1..55039b3c62 100644 --- a/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/clustering/ejb/infinispan/main/module.xml +++ b/ee-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/clustering/ejb/infinispan/main/module.xml @@ -36,6 +36,7 @@ + diff --git a/ee/src/main/java/org/jboss/as/ee/component/deployers/ResourceReferenceRegistrySetupProcessor.java b/ee/src/main/java/org/jboss/as/ee/component/deployers/ResourceReferenceRegistrySetupProcessor.java index 34af7b672a..bee5965ffc 100644 --- a/ee/src/main/java/org/jboss/as/ee/component/deployers/ResourceReferenceRegistrySetupProcessor.java +++ b/ee/src/main/java/org/jboss/as/ee/component/deployers/ResourceReferenceRegistrySetupProcessor.java @@ -23,6 +23,7 @@ package org.jboss.as.ee.component.deployers; import org.jboss.as.ee.component.Attachments; +import org.jboss.as.ee.component.EEModuleDescription; import org.jboss.as.ee.concurrent.deployers.injection.ContextServiceResourceReferenceProcessor; import org.jboss.as.ee.concurrent.deployers.injection.ManagedExecutorServiceResourceReferenceProcessor; import org.jboss.as.ee.concurrent.deployers.injection.ManagedScheduledExecutorServiceResourceReferenceProcessor; @@ -45,10 +46,21 @@ public class ResourceReferenceRegistrySetupProcessor implements DeploymentUnitPr final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if(deploymentUnit.getParent() == null) { final EEResourceReferenceProcessorRegistry registry = new EEResourceReferenceProcessorRegistry(); - registry.registerResourceReferenceProcessor(ContextServiceResourceReferenceProcessor.INSTANCE); - registry.registerResourceReferenceProcessor(ManagedExecutorServiceResourceReferenceProcessor.INSTANCE); - registry.registerResourceReferenceProcessor(ManagedScheduledExecutorServiceResourceReferenceProcessor.INSTANCE); - registry.registerResourceReferenceProcessor(ManagedThreadFactoryResourceReferenceProcessor.INSTANCE); + final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); + if (eeModuleDescription != null) { + if (eeModuleDescription.getDefaultResourceJndiNames().getContextService() != null) { + registry.registerResourceReferenceProcessor(ContextServiceResourceReferenceProcessor.INSTANCE); + } + if (eeModuleDescription.getDefaultResourceJndiNames().getManagedExecutorService() != null) { + registry.registerResourceReferenceProcessor(ManagedExecutorServiceResourceReferenceProcessor.INSTANCE); + } + if (eeModuleDescription.getDefaultResourceJndiNames().getManagedScheduledExecutorService() != null) { + registry.registerResourceReferenceProcessor(ManagedScheduledExecutorServiceResourceReferenceProcessor.INSTANCE); + } + if (eeModuleDescription.getDefaultResourceJndiNames().getManagedThreadFactory() != null) { + registry.registerResourceReferenceProcessor(ManagedThreadFactoryResourceReferenceProcessor.INSTANCE); + } + } deploymentUnit.putAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY, registry); } else{ deploymentUnit.putAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY, deploymentUnit.getParent().getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY)); diff --git a/ee/src/main/java/org/jboss/as/ee/subsystem/DefaultBindingsAdd.java b/ee/src/main/java/org/jboss/as/ee/subsystem/DefaultBindingsAdd.java index d46f6ac5ec..3c203558fc 100644 --- a/ee/src/main/java/org/jboss/as/ee/subsystem/DefaultBindingsAdd.java +++ b/ee/src/main/java/org/jboss/as/ee/subsystem/DefaultBindingsAdd.java @@ -36,6 +36,8 @@ import org.jboss.dmr.ModelNode; */ public class DefaultBindingsAdd extends AbstractBoottimeAddStepHandler { + public static final int STRUCTURE_EE_DEFAULT_BINDINGS_CONFIG = 0x1B01; + private final DefaultBindingsConfigurationProcessor defaultBindingsConfigurationProcessor; public DefaultBindingsAdd(DefaultBindingsConfigurationProcessor defaultBindingsConfigurationProcessor) { @@ -73,7 +75,7 @@ public class DefaultBindingsAdd extends AbstractBoottimeAddStepHandler { context.addStep(new AbstractDeploymentChainStep() { protected void execute(DeploymentProcessorTarget processorTarget) { - processorTarget.addDeploymentProcessor(EeExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EE_DEFAULT_BINDINGS_CONFIG, defaultBindingsConfigurationProcessor); + processorTarget.addDeploymentProcessor(EeExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, STRUCTURE_EE_DEFAULT_BINDINGS_CONFIG, defaultBindingsConfigurationProcessor); } }, OperationContext.Stage.RUNTIME); } diff --git a/ejb3/src/main/java/org/jboss/as/ejb3/remote/AssociationImpl.java b/ejb3/src/main/java/org/jboss/as/ejb3/remote/AssociationImpl.java index 1cc0f6d022..984266ba8f 100644 --- a/ejb3/src/main/java/org/jboss/as/ejb3/remote/AssociationImpl.java +++ b/ejb3/src/main/java/org/jboss/as/ejb3/remote/AssociationImpl.java @@ -172,6 +172,40 @@ final class AssociationImpl implements Association, AutoCloseable { return CancelHandle.NULL; } + final Component component = componentView.getComponent(); + + try { + component.waitForComponentStart(); + } catch (RuntimeException e) { + invocationRequest.writeException(new EJBException(e)); + return CancelHandle.NULL; + } + + final EJBLocator actualLocator; + + if (component instanceof StatefulSessionComponent) { + if (ejbLocator.isStateless()) { + final SessionID sessionID = ((StatefulSessionComponent) component).createSessionRemote(); + try { + invocationRequest.convertToStateful(sessionID); + } catch (IllegalArgumentException e) { + // cannot convert (old protocol) + invocationRequest.writeNotStateful(); + return CancelHandle.NULL; + } + actualLocator = ejbLocator.withSession(sessionID); + } else { + actualLocator = ejbLocator; + } + } else { + if (ejbLocator.isStateful()) { + invocationRequest.writeNotStateful(); + return CancelHandle.NULL; + } else { + actualLocator = ejbLocator; + } + } + final boolean isAsync = componentView.isAsynchronous(invokedMethod); final boolean oneWay = isAsync && invokedMethod.getReturnType() == void.class; @@ -214,7 +248,7 @@ final class AssociationImpl implements Association, AutoCloseable { try { final Map contextDataHolder = new HashMap<>(); - result = invokeMethod(componentView, invokedMethod, invocationRequest, requestContent, cancellationFlag, contextDataHolder); + result = invokeMethod(componentView, invokedMethod, invocationRequest, requestContent, cancellationFlag, actualLocator, contextDataHolder); attachments.putAll(contextDataHolder); } catch (EJBComponentUnavailableException ex) { // if the EJB is shutting down when the invocation was done, then it's as good as the EJB not being available. The client has to know about this as @@ -253,7 +287,7 @@ final class AssociationImpl implements Association, AutoCloseable { } // invocation was successful if (! oneWay) try { - updateAffinities(invocationRequest, attachments, ejbLocator, componentView); + updateAffinities(invocationRequest, attachments, actualLocator, componentView); requestContent.writeInvocationResult(result); } catch (Throwable ioe) { EjbLogger.REMOTE_LOGGER.couldNotWriteMethodInvocation(ioe, invokedMethod, beanName, appName, moduleName, distinctName); @@ -556,7 +590,7 @@ final class AssociationImpl implements Association, AutoCloseable { } } - static Object invokeMethod(final ComponentView componentView, final Method method, final InvocationRequest incomingInvocation, final InvocationRequest.Resolved content, final CancellationFlag cancellationFlag, Map contextDataHolder) throws Exception { + static Object invokeMethod(final ComponentView componentView, final Method method, final InvocationRequest incomingInvocation, final InvocationRequest.Resolved content, final CancellationFlag cancellationFlag, final EJBLocator ejbLocator, Map contextDataHolder) throws Exception { final InterceptorContext interceptorContext = new InterceptorContext(); interceptorContext.setParameters(content.getParameters()); interceptorContext.setMethod(method); @@ -590,7 +624,6 @@ final class AssociationImpl implements Association, AutoCloseable { } } // add the session id to the interceptor context, if it's a stateful ejb locator - final EJBLocator ejbLocator = content.getEJBLocator(); if (ejbLocator.isStateful()) { interceptorContext.putPrivateData(SessionID.class, ejbLocator.asStateful().getSessionId()); } diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/deployment/DefaultJMSConnectionFactoryResourceReferenceProcessor.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/deployment/DefaultJMSConnectionFactoryResourceReferenceProcessor.java index 5317660184..d2e8c3cd21 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/deployment/DefaultJMSConnectionFactoryResourceReferenceProcessor.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/deployment/DefaultJMSConnectionFactoryResourceReferenceProcessor.java @@ -24,6 +24,7 @@ package org.wildfly.extension.messaging.activemq.deployment; import javax.jms.ConnectionFactory; import org.jboss.as.ee.component.Attachments; +import org.jboss.as.ee.component.EEModuleDescription; import org.jboss.as.ee.component.InjectionSource; import org.jboss.as.ee.component.LookupInjectionSource; import org.jboss.as.ee.component.deployers.EEResourceReferenceProcessor; @@ -47,8 +48,11 @@ public class DefaultJMSConnectionFactoryResourceReferenceProcessor implements De final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if(deploymentUnit.getParent() == null) { final EEResourceReferenceProcessorRegistry eeResourceReferenceProcessorRegistry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY); - if(eeResourceReferenceProcessorRegistry != null) { - eeResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(RESOURCE_REFERENCE_PROCESSOR); + if (eeResourceReferenceProcessorRegistry != null) { + final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); + if (eeModuleDescription != null && eeModuleDescription.getDefaultResourceJndiNames().getJmsConnectionFactory() != null) { + eeResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(RESOURCE_REFERENCE_PROCESSOR); + } } } } diff --git a/pom.xml b/pom.xml index b95bca00af..df1de2de42 100644 --- a/pom.xml +++ b/pom.xml @@ -342,7 +342,6 @@ 2.2.5 2.7.1.jbossorg-4 0.7.0 - 1.65 1.9.11 1.9.13.redhat-00007 1.4.0 @@ -426,7 +425,7 @@ 1.3.2.Final 5.4.2.Final 1.0.1.Final - 3.3.0.Final + 3.3.1.Final 0.1.9.Final 2.1.2 4.2.10.Final @@ -446,7 +445,7 @@ 0.9.30 6.14.3 3.0.1.Final - 14.0.0.Beta2 + 14.0.0.Beta3 1.6.1 1.1.2.Final 1.0.13.Final @@ -5646,24 +5645,6 @@ - - org.bouncycastle - bcmail-jdk15on - ${version.org.bouncycastle} - - - - org.bouncycastle - bcpkix-jdk15on - ${version.org.bouncycastle} - - - - org.bouncycastle - bcprov-jdk15on - ${version.org.bouncycastle} - - org.codehaus.jackson jackson-core-asl