J2ee example in Jboss

F

Flex

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
 
K

kjc

The J2EE classes can't be found in your classpath

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

Flex

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
 
S

Sudsy

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.
 
F

Flex

Il Wed, 15 Dec 2004 13:24:19 -0500, Sudsy ha scritto:
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
 
S

Sudsy

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... ;-)
 
F

Flex

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 ?
 
S

Sudsy

Flex said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JBOSS problems - URGENT 4
errore con l'opzione -Xlint 0
aiuto j2me bluetooth 1

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top