-
1. Re: Using JMS in Jboss
mskonda May 5, 2006 5:02 AM (in response to chrischris)I am not sure whether I got your question right.
But, *-service.xml is used (one of the uses) to deploy your destinations (for an example, check under, deploy\jboss-messaging.sar\destination-service.xml)<service> .... <mbean code="org.jboss.jms.server.destination.Queue" name="jboss.messaging.destination:service=Queue,name=ex" xmbean-dd="xmdesc/Queue-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> </mbean> </service>
So, if your producer has to send messages to a queue ex, the above file deploys the respective queue in the messaging server.
Now,if you have a producer or consumer, all it has to do is to find the destination name from JNDI. So, for example,Destination queue = (Destination) initialContext.lookup("ex");
will look up the previously deployed queue and fire/consume messages respectively.
so, if I get your question right, you don't need *-service.xml in the classpath of the client. All the client needs is jndi.properties (if you don't want to hard code your jndi properties in the code).
Thanks
/K -
2. Re: Using JMS in Jboss
chrischris May 8, 2006 11:05 AM (in response to chrischris)Hey,
thank u for your answer. I did what u said, but I got another problem.
This is a part of my Code:
_____________________________________________________
...
...
...
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
properties.put(Context.PROVIDER_URL, "localhost");
ctx = new InitialContext(properties);
...
...
...
_____________________________________________________
and when I start it, than I get the following ecxeption, and I have noch clue what that realy mean, and what I can do...
_____________________________________________________
failed to start bundle JmsQueueStubBundle
[stderr] javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
[stderr] at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
[stderr] at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
[stderr] at javax.naming.InitialContext.init(Unknown Source)
[stderr] at javax.naming.InitialContext.(Unknown Source)
[stderr] at jmsQueueStubBundlePackage.Activator.start(Activator.java:67)
[stderr] at org.knopflerfish.framework.BundleImpl$1.run(BundleImpl.java:281)
...
...
...
_____________________________________________________ -
3. Re: Using JMS in Jboss
mskonda May 8, 2006 11:26 AM (in response to chrischris)It says the NamingContextFactory class is not found - add jnp-client.jar to your client classpath (it is found in $JBOSS_HOME/client directory)
Thanks
/K