Help getting started with JMS
I'm having some problems getting JMS up and running. I've activated the jms entry in the server.xml. I've checked the jms log file, and it seems to be getting started. I'm using the default port of 9127. Unfortunately, when I run my application client, I get the following exception: javax.jms.JMSException: Unable to connect to JMSServer (localhost:127.0.0.1:9127) I'm currently using a queue. My jms.xml configurations for this are: jms-server port="9127" host="localhost" queue-connection-factory location="jms/theQueueConnectionFactory"host="localhost"port="9127" / queue name="Demo Queue" location="jms/demoQueue" persistence-file="../persistence/jms/demoQueue.queue" descriptionA dummy queue/description/queue My jndi properties for my application are: java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactoryjava.naming.provider.url=ormi://localhost/java.naming.security.principal=admin accountjava.naming.security.credentials=admin password And last but not least, my application-client.xml is: ?xml version="1.0"?!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN" "http://java.sun.com/j2ee/dtds/application-client_1_2.dtd"application-client resource-ref res-ref-namejms/theQueueConnectionFactory/res-ref-name res-typejavax.jms.QueueConnectionFactory/res-type res-authContainer/res-auth /resource-ref resource-ref res-ref-namejms/demoQueue/res-ref-name res-typejavax.jms.Queue/res-type res-authContainer/res-auth /resource-ref/application-client My client program is very basic: public static void main(String [] argv) { try { Context context = new InitialContext(); QueueConnectionFactory qfactory = (QueueConnectionFactory)context.lookup("java:comp/env/jms/theQueueConnectionFactory"); Queue myqueue = (Queue)context.lookup("java:comp/env/jms/demoQueue"); QueueConnection qconn = qfactory.createQueueConnection(); qconn.start(); QueueSession qsess = qconn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); QueueSender qsend = qsess.createSender(myqueue); qsend.send(qsess.createTextMessage("Message")); System.out.println("sent message!"); qconn.close(); } catch (Exception e) { e.printStackTrace(); } } Any ideas as to what I'm doing wrong?? Obviously, something is hosed on my configuration. Thanks for any help. Joe
Bean managed Transactions Help
I'm trying to get a session bean that uses bean-managed transactions to work. Basically, I've got a transaction-type of 'Bean' in my ejb-jar.xml file. It's also a stateful session bean. Don't know if that makes a difference or not. In my code, I have the lines: try { if(context.getUserTransaction().getStatus() != javax.transaction.Status.STATUS_ACTIVE) throw new EJBException("Transaction is not active!"); context.getUserTransaction().begin(); context is an EJBContext I initialize during setSessionContext. Unfortunately, it never gets that far. There's never a transaction that is active. It blows up in the 'if' statement: javax.transaction.TransactionRolledBackException: javax.ejb.EJBException Is there something else that I need to be aware of inhandling bean-managed transactions?? Thanks for all your help. Joe
Transactions help - nevermind
Nevermind the last message I wrote on help with transactions. I got it. My mind is fluff today. :) Thanks anyways. Joe
More help for the newbie - javax.naming.NamingNotFoundException
I'm trying to learn ejb's using Orion's web server. I'm currently running 1.5.4. I appreciate all the help I've gotten so far. Basically, I'm trying to get the CabinBean example from O'Reilly publishings "Enterprise JavaBeans 2nd Edition" working. I think I'm pretty close. I just need to understand a couple things. I'm basically referencing the enterprise beans from an application outside the ejb container (a regualar class with a static void main method). I've got all the required things put together. I have the ejb-jar.xml in the META-INF of the cabin.jar. I have the application.xml in the META-INF of the cabin.ear. I have an application-client.xml in a META-INF of where my application is running. It seems to be looking at the application xml like it should. The problem is, when i do: Context jndiContext = new InitialContext();Object ref = jndiContext.lookup("java:comp/env/ejb/CabinHome"); The client fails on the lookup statement. I get the following error: javax.naming.NamingNotFoundException: ejb/CabinHome not found in Application Client Now, when I look at my beans in the orionconsole, it doesn't look like they are necessarily deployed under comp/env/ejb/. It looks like it's listed under comp. Maybe this doesn't matter. I've done some RMI programming in the past, and understand some things about the naming lookup. For starters, where is it specified where the beans actually get binded to?? For instance, with rmi, if I had a bean called 'whatever', I could explicitly bind it to "newbean/whatever", and then my lookup statement would be: lookup("newbean/whatever"). Could someone explain this to me a bit... Mostly, I'm just trying to get my beans located from my client program. Any insight on this would be greatly appreciated. Also, In my jndi.properties file, I'm using ApplicatonClientInitialContextFactory. When I tried using RMIInitialContextFactory, i got errors. Just curious as to what the differences are, and what the proper factory is, and where it should be used. Thanks again for all of your help. Joe
HELP! Newbie with orion and EJB's
I need some help understanding the configuration of Orion so that I canlearn EJB. I understand most of the concepts behind it, but am failing inconfiguring my server properly.Right now, I'm doing the Cabin bean example out of Enterprise JavaBeans (2ndEd) by O'Reilly publishing. I'm doing the first example with the basiccabin bean, and static application (I'm not looking up the entity beans froma servlet - I am looking them up from a static void main method in a class).Anyways, I'm getting the following error:"Error reading application-client descriptor: No location specified and notsuitable instance of the type 'com.titan.cabin.Cabin' found for the ejb-refejb/Cabin"I have the application being deployed properly. I have an ejb-jar.xml inthe META-INF directory in my cabin.jar. I have an application.jar in theMETA-INF directory of my cabin.ear file. I have an application-client.xmlfile in the META-INF directory where my application Client_1.class resides.When I invoke the client, I set the classpath to reference the directorywhere Client_1.class is, so that it can find the application-client.xmlfile, and it does. But I'm getting that error.Any help would be greatly appreciated.Thank you,Joe