Jboss JMS Startup Project

R

reddeagle

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
 
K

kjc

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

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top