Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic


Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am following the book, EJB3 in Action
As i was running, chapter- 4 examples under eclipse:

i used to get some error like createActiveAdapter rar

in order to resolve this issue, i did two steps-

1) in glassfish server, i added additional property under

jms resources>> connection factories

Name- jms/QueueConnectionFactory

2) in my client code, i did initalcontext lookup for this jms/QueueConnectionFactory.

now i am able to run my code very well.

So my code now looks like-

InitialContext ctx = new InitialContext();
Destination destination = (Destination)ctx.lookup("ShippingRequestQueue");
InitialContext ctx1 = new InitialContext();
ConnectionFactory connectionFactory = (ConnectionFactory)ctx.lookup("jms/QueueConnectionFactory");
Connection connection = connectionFactory.createConnection();


So now i am doing jndi lookup for 2 jndi name's.

Question-1- if i remember correctly, somewhere in book, i read, that we can't do lookup for jndi name in 1 program 2 time's.

Question-1.1- As i have seen on other forum's, people doing jndi lookup for jms/QueueConnectionFactory,
they are actually adding these line's to code to do,

Hashtable properties = new Hashtable(2);
try {
ctx = new InitialContext(properties);
} catch (NamingException ex) {

But in my case, i didn't did this, instead- i added property under glassfish under jms/QueueConnectionFactory,

so is this my step manual replacement for adding above line's of code?

Question-2- in this program- /Chapter - 4 EJB Project/src/actionbazaar/buslogic/

@Resource(name = "jdbc/TurtleDS")

we are injecting the resource. but my question here is how this jdbc resource was created under glassfish server. I am unable to point out, how this magic is happening.

Question-3- i have run this program /Chapter - 4 Client Project/src/actionbazaar/buslogic/ 1 time only, but it seems that at eclipse console output,
Shipping Request Message Sent ..

i see in console output, this below message keep on updating after session time, what sort of this message represents info to us?

Oct 9, 2008 11:53:32 PM com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=10:xacId=5634316378208359168:Using xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverrideJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=true, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfiguredClientID=,, imqJMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http://localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostName=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefaultPassword=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=guest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavior=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimestamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsumerTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueueBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddressList=mq://rocky-PC:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophere Verre where are you now?
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!