Jboss JMS Startup Project

Discussion in 'Java' started by reddeagle@gmail.com, Feb 14, 2005.

  1. Guest

    Hi All,
    I appreciate this is a trivial task but any help would be appreciated.
    i am working on a college project that will be using jms and jboss. i
    have started my jboss server no problems
    I have opened my eclipse java project and create a simple class to get
    the connection factory.

    try {
    InitialContext ic;
    QueueConnectionFactory cf;

    ic = new InitialContext();
    cf = (QueueConnectionFactory)ic.lookup("ConnectionFactory");

    } catch (NamingException e) {
    System.out.println("JNDI lookup failed: " + e.toString());
    }

    No matter what i do i get an exception at ic.lookup.

    Am i missing something really fundamental here. Apologies in advance
    for this one.

    Thanks in advance.
    Redd
    , Feb 14, 2005
    #1
    1. Advertising

  2. kjc Guest

    wrote:
    > Hi All,
    > I appreciate this is a trivial task but any help would be appreciated.
    > i am working on a college project that will be using jms and jboss. i
    > have started my jboss server no problems
    > I have opened my eclipse java project and create a simple class to get
    > the connection factory.
    >
    > try {
    > InitialContext ic;
    > QueueConnectionFactory cf;
    >
    > ic = new InitialContext();
    > cf = (QueueConnectionFactory)ic.lookup("ConnectionFactory");
    >
    > } catch (NamingException e) {
    > System.out.println("JNDI lookup failed: " + e.toString());
    > }
    >
    > No matter what i do i get an exception at ic.lookup.
    >
    > Am i missing something really fundamental here. Apologies in advance
    > for this one.
    >
    > Thanks in advance.
    > Redd
    >

    The code above will only work if it is deployed inside the AppServer.
    From outside the appServer. You have to create a Properties instance
    like so,
    appServerProps.setProperty(
    Context.INITIAL_CONTEXT_FACTORY,
    "org.jnp.interfaces.NamingContextFactory"
    );

    appServerProps.setProperty(
    Context.PROVIDER_URL,
    "yourHostName"
    );

    InitialContext ic = new InitialContext(appServerProps);
    kjc, Feb 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mayor Curley

    JMS: JBoss to Weblogic messaging

    Mayor Curley, Aug 25, 2003, in forum: Java
    Replies:
    0
    Views:
    409
    Mayor Curley
    Aug 25, 2003
  2. Max

    Jboss JMS

    Max, Apr 19, 2004, in forum: Java
    Replies:
    0
    Views:
    450
  3. Affan
    Replies:
    0
    Views:
    423
    Affan
    Jun 24, 2004
  4. Thomas Stein
    Replies:
    0
    Views:
    749
    Thomas Stein
    Oct 18, 2004
  5. Replies:
    0
    Views:
    414
Loading...

Share This Page