J2ee example in Jboss

Discussion in 'Java' started by Flex, Dec 15, 2004.

  1. Flex

    Flex Guest

    I'd like to run SimpleQueueReceiver and Sender () under Jboss.
    I create a queue to add these lines in
    default/deploy/jms/jbossmq-destinations-service.xml :

    <mbean
    code="org.jboss.mq.server.jmx.Queue"
    name="jboss.mq.destination:service=Queue,name=myQueue"> <depends
    optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
    </mbean>

    after that I run the server , but when I run :
    java SimpleQueueReceiver
    I receive:
    myQueue Exception in thread "main" java.lang.NoClassDefFoundError:
    javax/jms/JMSException

    What can I do ?

    --
    Ciao Flex
    [X contattarmi togli NONSPAMM RE dall'indirizzo Per SPAM scrivete a: /dev/null]
    ________________________________________________
    Chi sa ascoltare non solo è simpatico a tutti ,
    ma prima o poi finisce con l'imparare qualcosa
    Flex, Dec 15, 2004
    #1
    1. Advertising

  2. Flex

    kjc Guest

    The J2EE classes can't be found in your classpath

    use
    java -cp "Classpath To All required classes" SimpleQueueReceiver

    Flex wrote:
    > I'd like to run SimpleQueueReceiver and Sender () under Jboss.
    > I create a queue to add these lines in
    > default/deploy/jms/jbossmq-destinations-service.xml :
    >
    > <mbean
    > code="org.jboss.mq.server.jmx.Queue"
    > name="jboss.mq.destination:service=Queue,name=myQueue"> <depends
    > optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
    > </mbean>
    >
    > after that I run the server , but when I run :
    > java SimpleQueueReceiver
    > I receive:
    > myQueue Exception in thread "main" java.lang.NoClassDefFoundError:
    > javax/jms/JMSException
    >
    > What can I do ?
    >
    kjc, Dec 15, 2004
    #2
    1. Advertising

  3. Flex

    Flex Guest

    Il Wed, 15 Dec 2004 16:22:00 +0000, kjc ha scritto:

    > The J2EE classes can't be found in your classpath
    >
    > use
    > java -cp "Classpath To All required classes" SimpleQueueReceiver
    >

    Good , Now the error changes , now when I digit java
    SimpleQueueReceiver myQueue the error is :

    Queue name is myQueue
    JNDI API lookup failed: javax.naming.NoInitialContextException:
    Need to specify class name in environment or system property, or as an
    applet parameter, or in an application resource file:
    java.naming.factory.initial

    It's strange because , like I wrote
    > Flex wrote:
    >> I create a queue to add these lines in
    >> default/deploy/jms/jbossmq-destinations-service.xml :
    >>
    >> <mbean
    >> code="org.jboss.mq.server.jmx.Queue"
    >> name="jboss.mq.destination:service=Queue,name=myQueue"> <depends
    >> optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
    >> </mbean>
    >>


    --
    Ciao Flex
    Flex, Dec 15, 2004
    #3
  4. Flex

    Sudsy Guest

    > Good , Now the error changes , now when I digit java
    > SimpleQueueReceiver myQueue the error is :
    >
    > Queue name is myQueue
    > JNDI API lookup failed: javax.naming.NoInitialContextException:
    > Need to specify class name in environment or system property, or as an
    > applet parameter, or in an application resource file:
    > java.naming.factory.initial
    >
    > It's strange because , like I wrote


    So now you have to look at the source for SimpleQueueReceiver and
    find out where it obtains the initial naming context. Dig through
    the archives at <http://groups.google.com> for some examples. Use
    "+initialcontext +jboss" as your search string.
    Sudsy, Dec 15, 2004
    #4
  5. Flex

    Flex Guest

    Il Wed, 15 Dec 2004 13:24:19 -0500, Sudsy ha scritto:

    >> Good , Now the error changes , now when I digit java
    >> SimpleQueueReceiver myQueue the error is :
    >>
    >> Queue name is myQueue
    >> JNDI API lookup failed: javax.naming.NoInitialContextException:
    >> Need to specify class name in environment or system property, or as an
    >> applet parameter, or in an application resource file:
    >> java.naming.factory.initial
    >>
    >> It's strange because , like I wrote

    >
    > So now you have to look at the source for SimpleQueueReceiver and
    > find out where it obtains the initial naming context. Dig through
    > the archives at <http://groups.google.com> for some examples. Use
    > "+initialcontext +jboss" as your search string.


    I try to find a solution there , but I find only questions not reply, I
    read Jboss documentation , and ,perhaps , I had to add something into
    jndi.properties, but I don't' know other.
    I'm very confusing, if I read again I became more confuse, I need to sleep,
    I hope to solve this problem tomorrow :)

    --
    Ciao Flex
    [X contattarmi togli NONSPAMM RE dall'indirizzo Per SPAM scrivete a: /dev/null]
    ________________________________________________
    Chi sa ascoltare non solo è simpatico a tutti ,
    ma prima o poi finisce con l'imparare qualcosa
    Flex, Dec 15, 2004
    #5
  6. Flex

    Sudsy Guest

    <snip>
    > I try to find a solution there , but I find only questions not reply, I
    > read Jboss documentation , and ,perhaps , I had to add something into
    > jndi.properties, but I don't' know other.
    > I'm very confusing, if I read again I became more confuse, I need to sleep,
    > I hope to solve this problem tomorrow :)


    Sorry, but I'm all out of spoons!
    If you weren't able to find solutions with the search string I so
    generously provided then you weren't trying very hard.
    I'll purchase a spoon as soon as you remit project funding via
    PayPal... ;-)
    Sudsy, Dec 16, 2004
    #6
  7. Flex

    Flex Guest

    Il Wed, 15 Dec 2004 21:34:54 -0500, Sudsy ha scritto:

    > <CUT>
    > I'll purchase a spoon as soon as you remit project funding via
    > PayPal... ;-)


    It isn't a good idea :)
    This is the code that it generates exception :

    try {
    queueConnectionFactory = (QueueConnectionFactory)
    jndiContext.lookup("QueueConnectionFactory");
    queue = (Queue) jndiContext.lookup(queueName);
    } catch (NamingException e) {
    System.out.println("JNDI API lookup failed: " +
    e.toString());
    System.exit(1);
    }

    It's strange , I digit to run :
    java -cp
    ..:/opt/jboss/client/jboss-j2ee.jar:/opt/jboss/client/jbossall-client.jar
    SimpleQueueSender MyQueue 3

    And this is the error message :
    Queue name is MyQueue
    JNDI API lookup failed: javax.naming.NoInitialContextException: Need to
    specify class name in environment or system property, or as an applet
    parameter, or in an application resource file:
    java.naming.factory.initial

    does Someone have got an idea ?

    --
    Ciao Flex
    Flex, Dec 16, 2004
    #7
  8. Flex

    Sudsy Guest

    Flex wrote:
    > does Someone have got an idea ?


    You're in luck! Someone just returned one of my spoons. Here you go:

    Properties p = new Properties();
    props.setProperty( "java.naming.factory.initial",
    "org.jnp.interfaces.NamingContextFactory" );
    props.setProperty( "java.naming.provider.url", "127.0.0.1:1099" );
    props.setProperty( "java.naming.factory.url.pkgs", "org.jboss.naming" );
    Context ctx = new InitialContext( props );
    queueConnectionFactory = (QueueConnectionFactory)
    ctx.lookup( "QueueConnectionFactory" );
    ...

    Feeling better now?
    Sudsy, Dec 16, 2004
    #8
  9. Andrew Thompson, Dec 16, 2004
    #9
    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. Ryan Boder
    Replies:
    0
    Views:
    469
    Ryan Boder
    Sep 3, 2003
  2. Raydog
    Replies:
    1
    Views:
    392
    Sudsy
    Nov 12, 2004
  3. han
    Replies:
    0
    Views:
    476
  4. Jubz
    Replies:
    0
    Views:
    2,256
  5. LprzemekL
    Replies:
    0
    Views:
    520
    LprzemekL
    Apr 10, 2008
Loading...

Share This Page