2

I have been trying to figure this issue out for a bit now and am in need of a different perspective. I am using spring and have incorporated this spring boot starter pack so that I could take advantage of the AMQP protocol: amqp-10-jms-spring-boot-starter which I have successfully configured and do have currently working. The issue arrises when I deploy this into a Jboss eap7 Container "THIS IS A REQ". So when I deploy this application for the first time, everything works great. The issue arrises when I do a re-deploy of the same application without first taking down the container(As I shouldn't have to). Here is what I have thought of and tried thus far:

  1. Something in spring isn't being cleaned up correctly? Look through some JMC flight planner stats and don't see anything that jumps out at me. No Springframework or JMSConnectionFactory instances left over.
  2. Wildlfy Classpath problem? I ignore artemis libs and artemis modules in my jboss-deployment
  3. Good Friend google 99% of the time a home run. This time though not much direction.

Jboss-deployment-structure

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="jaxrs" />
            <subsystem name="messaging-activemq" />
        </exclude-subsystems>
        <exclusions>
            <module name="org.hibernate" slot="main" />
            <module name="org.apache.activemq.artemis" slot="main" />
            <module name="org.apache.activemq.artemis.ra" slot="main" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

Keep in mind I have other code in here hense the JSR package, Hibernate, spring-web, etc. dependencies. I left those in for completeness.

pom.xml

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <scope>runtime</scope>
        </dependency>


        <!-- Spring Data/DB -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>4.3.10.RELEASE</version>
        </dependency>
        <dependency> <!-- works with spring 4.3.10-->
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.11.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-java8</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-core</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-core</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Spring JMS-->
        <dependency>
            <groupId>org.amqphub.spring</groupId>
            <artifactId>amqp-10-jms-spring-boot-starter</artifactId>
            <version>0.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
        </dependency>

Finally My Stack Trace

22:44:08,293 ERROR [org.apache.qpid.jms.provider.ProviderFactory] (ServiceEvent-144) Failed to create Provider instance for amqp, due to: java.io.IOException: Provider scheme NOT recognized: [amqp]
22:44:08,293 ERROR [org.apache.qpid.jms.JmsConnectionFactory] (ServiceEvent-144) Failed to create JMS Provider instance for: amqp
22:44:08,293 ERROR [stderr] (ServiceEvent-144) Exception in thread "ServiceEvent-144" org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Provider scheme NOT recognized: [amqp]
22:44:08,293 ERROR [stderr] (ServiceEvent-144)  at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
22:44:08,293 ERROR [stderr] (ServiceEvent-144)  at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:487)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:570)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:658)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at my.test.Producertest.send(Producertest:62)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at java.lang.reflect.Method.invoke(Method.java:498)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:256)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:177)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:140)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:134)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at java.lang.Thread.run(Thread.java:745)
22:44:08,294 ERROR [stderr] (ServiceEvent-144) Caused by: javax.jms.JMSException: Provider scheme NOT recognized: [amqp]
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:86)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:108)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.JmsConnectionFactory.createConnection(JmsConnectionFactory.java:211)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.JmsConnectionFactory.createConnection(JmsConnectionFactory.java:191)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:180)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
22:44:08,294 ERROR [stderr] (ServiceEvent-144)  ... 21 more
22:44:08,294 ERROR [stderr] (ServiceEvent-144) Caused by: java.io.IOException: Provider scheme NOT recognized: [amqp]
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.provider.ProviderFactory.findProviderFactory(ProviderFactory.java:124)
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.provider.ProviderFactory.findProviderFactory(ProviderFactory.java:99)
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.provider.ProviderFactory.create(ProviderFactory.java:70)
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.JmsConnectionFactory.createProvider(JmsConnectionFactory.java:329)
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.JmsConnectionFactory.createConnection(JmsConnectionFactory.java:200)
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  ... 24 more
22:44:08,295 ERROR [stderr] (ServiceEvent-144) Caused by: java.lang.ClassCastException: Cannot cast org.apache.qpid.jms.provider.amqp.AmqpProviderFactory to org.apache.qpid.jms.provider.ProviderFactory
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.util.FactoryFinder.newInstance(FactoryFinder.java:129)
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  at org.apache.qpid.jms.provider.ProviderFactory.findProviderFactory(ProviderFactory.java:122)
22:44:08,295 ERROR [stderr] (ServiceEvent-144)  ... 28 more

Nothing has helped leaving me grasping at straws here. So any direction is helpful. I could just use the JMS API which I will try later. But I was hopeful to figure this one out. Thanks in advance.

UPDATE

I took all my code out of the equation and created a simplistic service. The amqp-10-jms-spring-boot-starter is not the culprit. I am suspecting that either my Spring Event Listeners or my AsynchronousSocketChannel is somehow interfering somehow(either with Jboss or directly) and keeping a errand connection around.

Bandit
  • 31
  • 7
  • Alright I discovered the issue. Make note I only found the core problem once I move this application over to Tomcat. Which stated "you created a thread that did not get removed". My code uses the AsynchronousSocketChannel class that I use to listener on ports I care about. The default Implementation uses the class AnsychronousChannelGroup, which in this case does not get cleaned up, once you assign a channelgroup to your socketchannel, you can clean up the threads that way. I am going to upload my code to a github account later today so that one can play around with it. Java 8 Bug? – Bandit Feb 08 '18 at 21:32

2 Answers2

1

Alright I discovered the issue. Make note I only found the core problem once I move this application over to Tomcat. Which stated "you created a thread that did not get removed". My code uses the AsynchronousSocketChannel class that I use to listener on ports I care about. The default Implementation uses the class AnsychronousChannelGroup, which in this case does not get cleaned up, once you assign a channelgroup to your socketchannel, you can clean up the threads that way. I am going to upload my code to a github account later today so that one can play around with it. Java 8 Bug?

Bandit
  • 31
  • 7
0

I think this is to do with JBOSS class loading mechanism. When we migrated from WLS to JBOSS, we experienced several weird problems like this. One suggestion you to use Class.forName to instantiate the required driver class/library when your app starts up. Another this you can try is to remove the sub-system inclusion in standalone.xml/domain.xml (subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0") and check. Hope this helps.

VarunKrish
  • 179
  • 1
  • 9
  • Tring to exclude via messaging-acvtivemq is what the jboss-deployment-structure was meant to do. For good measure I took this out of the standalone as well, and on redeploy still displayed the same issue. – Bandit Feb 06 '18 at 07:05
  • Your intriguing other suggestion `One suggestion you to use Class.forName to instantiate the required driver class/library when your app starts up` Since EAP7 already has those classes. Short of replacing those jars in the modules directory how would I go about doing that? – Bandit Feb 06 '18 at 07:21