3 Replies Latest reply on Feb 24, 2014 7:00 PM by Peter Hirsch

    UnknownURISchemeException: No connection provider for URI scheme "http-remoting" is installed

    Peter Hirsch Newbie

      I'm getting an UnknownURISchemeException when creating an InitialContext. What I'm trying to do is to initialize a JMS MessageProducer within the init() of an HttpServlet and bind it to the JNDI context so that it can be looked up and used elsewhere in my application. The reason I'm doing it this way is so that I can start the JMS Connection on the initialization of the servlet, and (primarily) so that I can close the connection on the destruction of the servlet. The MessageProducer will be used within a MessageListener so that I can forward certain messages to a secondary JMS Queue. What I want is to only start and close the connection once within the lifespan of the application, and I have been unable to think of other ways to do so within the MessageListener class that I can be sure will properly close the connection.

       

      I have seen a few other posts about this exception, but have been unable to make any of the solutions work for me. I am running my app as standalone on Wildfly 8.0.0.Final.

       

      If you have an idea as to how to do this securely without having to use JNDI, I would happily entertain them and provide any additional info you need about my application. However, I'm fairly satisfied with my current design - I just need to get the JNDI working properly.

       

      Here's the end of the exception stack trace: (I can post the entire stack trace if necessary, but I figure this will be sufficient)

       

      Caused by: org.jboss.remoting3.UnknownURISchemeException: No connection provider for URI scheme "http-remoting" is installed

              at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:265) [jboss-remoting-3.2.2.GA.jar:3.2.2.GA]

              at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251) [jboss-remoting-3.2.2.GA.jar:3.2.2.GA]

              at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349) [jboss-remoting-3.2.2.GA.jar:3.2.2.GA]

              at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333) [jboss-remoting-3.2.2.GA.jar:3.2.2.GA]

              at org.jboss.naming.remote.client.cache.EndpointCache$EndpointWrapper.connect(EndpointCache.java:110) [jboss-remote-naming-1.0.1.Final.jar:1.0.1.Final]

              at org.jboss.naming.remote.client.cache.ConnectionCache.get(ConnectionCache.java:41) [jboss-remote-naming-1.0.1.Final.jar:1.0.1.Final]

              at org.jboss.naming.remote.client.InitialContextFactory.createConnection(InitialContextFactory.java:153) [jboss-remote-naming-1.0.1.Final.jar:1.0.1.Final]

              at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateConnection(InitialContextFactory.java:126) [jboss-remote-naming-1.0.1.Final.jar:1.0.1.Final]

              at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:106) [jboss-remote-naming-1.0.1.Final.jar:1.0.1.Final]

              ... 37 more

       

       

      The code for creating the initial context:

       

      private static final String INITIAL_CONTEXT_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory";

      private static final String PROVIDER_URL = "http-remoting://localhost:8080";

      .....

      public void init() throws ServletException {

        try {

           Destination destination = queue;

           connection = connectionFactory.createConnection();

           session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

           producer = session.createProducer(destination);

           connection.start();

           final Properties env = new Properties();

           env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);

           env.put(Context.PROVIDER_URL, PROVIDER_URL);

           Context ctx;

           try {

              ctx = new InitialContext(env);

           } catch (NamingException e) {

              logger.error("Exception while creating InitialContext");

              logger.error(e);

              throw new RuntimeException(e);

        }

       

       

      I'm using Maven for dependencies, and I did see the documentation about setting the dependencies for jboss-client.jar. However, README-EJB-JMS doesn't specify a version, and Eclipse complained when I left the version out. I wasn't able to satisfy eclipse using 8.0.0.Final or 8.0.0.CR1. I figure this may potentially be the source of my problem, but all of my searching provided no answers with regard to the version. Here is my pom.xml:

       

      <dependency>

              <groupId>org.jboss.as</groupId>

              <artifactId>jboss-as-ejb-client-bom</artifactId>

              <type>pom</type>

              <version>7.1.0.Final</version>

      </dependency>

      <dependency>

              <groupId>org.jboss.as</groupId>

              <artifactId>jboss-as-jms-client-bom</artifactId>

              <type>pom</type>

              <version>7.1.0.Final</version>

      </dependency>

       

       

      This is my first time posting on this forum, and I'm not sure how to put my code in boxes. I tried [CODE] and [/CODE] to no avail. I'd greatly appreciate it if anyone could tell me how to do so.

       

      Thanks in advance for any help.