• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

MDB's

 
Ranch Hand
Posts: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
connection.start();

------------------------------------------------------------------------

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);
properties.put(Context.PROVIDER_URL,"iiop://127.0.0.1:3700");
properties.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
try {
ctx = new InitialContext(properties);
} catch (NamingException ex) {
ex.printStackTrace();
}
------------------------------------------

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/ShippingRequestProcessorMDB.java

@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/ShippingRequestJMSProducer.java 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=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, 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: 856
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Christophere Verre where are you now?
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic