JMS Sessions
Just a followup on a previous post. We have a requirement to control where exactly a CEP application commits ( acknowledges ) a JMS message.
My question is: If I use <session-transacted> of the jms adapter config, where does the commit actually happen? Does the CEP app recover messages that are in transit coming from the jms adapter during unexpected failure?
One reason we are foregoing this option is, the client ID is required for a Weblogic durable subscription and there is no other way to input it in the configuration.
Our current solution is to create plain JMS subscribers using lowlevel JMS API and embed the JMS session in the message and push it down the stream as a CEP event.
Seeking advice as to what is the most elegant solution if there are other options possible. Thank you!
I apologize for the late response on this.
For the first part of your question - The commit happens after the event is sent downstream from the jms adapter. So, if there is any error before a thread switch, the txn will be rolled back and it will retry the message. However, if you have a multithreaded channel downstream, the transaction will be commited after the event is put in the channel's queue.
As for durable subscriptions - As of now we don't expose durable subscriptions through CEP configuration. This is something we will look into for a future release.
Manju.
Similar Messages
-
JMS session is not closed even after calling close()
Hi All,
I am using JMS to receive and publish topics for a process,in my java code i
am creating new JMS Session on demand(ie., whenever a new topic is
received) after processing the topic i am closing the session with close(),but
still the session is not closed.In a period of time more sessions are created
and FD leaks occurs which stops the process functionality.
Later i moved the on demand session code to a static block, its working fine
and no FD leak occurs.
Is this a known behavior or any java bug is there to point this issue,please
help me regarding this.
Thanks,
Ants BalajeiYou should try avoid creating sessions on demand but cache/pool them...
http://activemq.apache.org/how-do-i-use-jms-efficiently.html
James
http://www.iona.com/
Open Source the Enterprise Way -
The pooled JMS session is enlisted in another transaction error
I have an MDB with pool size 2 deployed in weblogic 9.2.3(linux). I see the following error in server logs.
<May 27, 2009 7:32:26 AM CDT> <Error> <EJB> <BEA-010079> <An error occurred while attempting to receive a message from JMS for processing by a message-driven bean: javax.jms.JMSException: [J2EE:160054]The pooled JMS session is enlisted in another transaction and may not be used elsewhere
The exception is : javax.jms.JMSException: [J2EE:160054]The pooled JMS session is enlisted in another transaction and may not be used elsewhere
at weblogic.deployment.jms.JMSExceptions.getJMSException(JMSExceptions.java:22)
at weblogic.deployment.jms.WrappedTransactionalSession.enlistInTransaction(WrappedTransactionalSession.java:196)
at weblogic.deployment.jms.WrappedMessageConsumer.receive(WrappedMessageConsumer.java:198)
at weblogic.ejb.container.internal.JMSMessagePoller.processOneMessage(JMSMessagePoller.java:297)
at weblogic.ejb.container.internal.JMSMessagePoller.pollContinuously(JMSMessagePoller.java:394)
at weblogic.ejb.container.internal.JMSMessagePoller.pollForParent(JMSMessagePoller.java:517)
at weblogic.ejb.container.internal.JMSMessagePoller.run(JMSMessagePoller.java:533)
at java.lang.Thread.run(Thread.java:595)
>
any idea why this error is coming??Looks it is like a bug, you can ask patch for from support.
-
Enlisting a JMS session as part of a distributed tx in SFSB
Consider the following method in a SFSB (Seam 2.1.2, JBoss 4.2 AS, EJB 3.0, JPA 1.0, Hibernate as persistence provider). I am trying to enlist the JMS session as part of the distributed tx and testing this using both local-tx-datasource and xa-datasource (JBoss specific datasources). Apparently the JMS session is not joining the distributed tx because everything is working fine using local-tx-datasource, which it should not. I'm guessing that there are two separate tx's that are happening here instead of one distributed tx. Also, note the following:
//topicSession = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
topicSession = conn.createTopicSession(true, TopicSession.AUTO_ACKNOWLEDGE); The first param in the createTopicSession() method marks it as transacted, which may be used to commit all or none of multiple JMS messages in a tx (e.g. publishing multiple topics to a message queue and guaranteeing atomicity). But I was thinking that would make JTA enlist it in the distributed tx and apparently it does not.
As per section 13.2.2 of JSR220-core:
"Behind the scenes, the EJB server enlists the session on the connection to the JMS provider
and the database connections as part of the transaction. When the transaction commits, the EJB
server and the messaging and database systems perform a two-phase commit protocol to ensure atomic
updates across all the three resources."
Somebody please explain what/how the transactional semantics are in this case when enlisting a db resource mgr and a JMS session resource mgr in a distributed tx (with or w/o Seam). thx.
SFSB:
@Name("startConversation")
@AutoCreate
@Install(true)
@Stateful
public class TestStartConversation implements TestStartConversationLocal{
@Logger
private Log log;
@In
private EntityManager em;
@In
private EntityManager em2;
private transient TopicPublisher topicPublisher;
private transient TopicSession topicSession;
private transient TopicConnection conn;
private transient Topic topic;
public void startup(){
log.info("in startup()");
List<Hotel> list = em.createQuery("from Hotel").getResultList();
log.info("list.size() = "+list.size());
Hotel hotel = null;
if (list != null && list.size() > 0) {
hotel = list.get(0);
hotel.setAddress("arbi's house1");
try{
InitialContext iniCtx = new InitialContext();
Object tmp = iniCtx.lookup("ConnectionFactory");
TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
conn = tcf.createTopicConnection();
topic = (Topic) iniCtx.lookup("topic/chatroomTopic");
//topicSession = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
topicSession = conn.createTopicSession(true, TopicSession.AUTO_ACKNOWLEDGE);
topicPublisher = topicSession.createPublisher(topic);
topicPublisher.publish( topicSession.createObjectMessage(new ChatroomEvent("connect", "arbime")) );
topicSession.commit();
catch(Exception e){
//noop
finally {
try {
topicSession.close();
conn.close();
catch(Exception e) {
//noop
}MDB:
@MessageDriven(activationConfig={
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"),
@ActivationConfigProperty(propertyName="destination", propertyValue="topic/chatroomTopic")
@Name("logger")
public class LoggerBean implements MessageListener
@Logger Log log;
public void onMessage(Message msg)
try
ChatroomEvent event = (ChatroomEvent) ( (ObjectMessage) msg ).getObject();
log.info( "#0: #1", event.getUser(), event.getData()==null ? event.getAction() : event.getData() );
catch (JMSException jmse)
throw new RuntimeException(jmse);
}I am using the following code now with the same results. It works w/o enlistment exception which is not what I'm expecting. So apparently there's no distributed tx? How can I check to see if there is a distributed tx and what resources (if any) have been enlisted?
private transient TopicPublisher topicPublisher;
private transient XATopicSession topicSession;
private transient XATopicConnection conn;
private transient Topic topic;
/******************************* begin methods *******************************/
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void startup(){
log.info("in startup()");
List<Hotel> list = em.createQuery("from Hotel").getResultList();
log.info("list.size() = "+list.size());
try{
InitialContext iniCtx = new InitialContext();
XATopicConnectionFactory tcf = (XATopicConnectionFactory) iniCtx.lookup("XAConnectionFactory");
conn = tcf.createXATopicConnection();
topic = (Topic) iniCtx.lookup("topic/chatroomTopic");
topicSession = conn.createXATopicSession();
topicPublisher = topicSession.getTopicSession().createPublisher(topic);
topicPublisher.publish( topicSession.createObjectMessage(new ChatroomEvent("connect", "arbime")) );
catch(Exception e){
//noop
finally {
try {
topicSession.close();
conn.close();
catch(Exception e) {
//noop
} -
JMS Session and Container Managed Tx
Hello,
We have encountered the following problem:
1) A Transaction was initiaited by the Container on EJB1.a() ("Required"-in CMT)
2) a topic jms session was initiated by: cSession = connection.createTopicSession(
false, TopicSession.AUTO_ACKNOWLEDGE );
3) When I rollback the tx, all but the jms sendings roolback. Meaning the jms
session was not a part of the tx.
How do I relate between a jms session and a container transaction. Do I necessarily
have to use user transaction to solve this problem?
Many thanks in advance,
Danger. Please read in-line comment.
David Maddison wrote:
> Hi Daniel,
>
> The topic session you've created isn't a transactional one, (you supplied
> false to the transactional parameter)
>
> You need to use :
>
> cSession = connection.createTopicSession(true,
> TopicSession.AUTO_ACKNOWLEDGE );
>
> To create a transactional session which will be enrolled in the CMT
> transaction.
>
This is 100% wrong. Making a session transacted specifically causes JMS
to ignore any existing transaction in favor the session's internal transaction,
as required by the JMS specification. You need to use a connection
that specifically checks for JTA (user) transactions. Either use an
XAConnection
or use a connection factory with the "user transactions enabled" flag set.
There are number of transaction
questions answered in the FAQ, they should point you in the right
direction:
http://e-docs.bea.com/wls/docs61/faq/jms.html
The JMS programmer's guide also has this information.
Tom, BEA
>
> David Maddison
>
> "Daniel Gordon" <[email protected]> wrote in message
> news:[email protected]...
> >
> > Hello,
> >
> > We have encountered the following problem:
> >
> > 1) A Transaction was initiaited by the Container on EJB1.a()
> ("Required"-in CMT)
> > 2) a topic jms session was initiated by: cSession =
> connection.createTopicSession(
> > false, TopicSession.AUTO_ACKNOWLEDGE );
> >
> > 3) When I rollback the tx, all but the jms sendings roolback. Meaning the
> jms
> > session was not a part of the tx.
> >
> > How do I relate between a jms session and a container transaction. Do I
> necessarily
> > have to use user transaction to solve this problem?
> >
> > Many thanks in advance,
> >
> >
-
Non-durable subscribers persists after the end of their JMS session
Hi all,
I'm using OAQ as my JMS Provider.
I have created code for publishing and recieving messages to/from topics. Messaging works fine, but I have one problem:
All my non-durable subscribers persists after the end of their JMS session. I always perform unsubscribe operation in code and then closing session and connection.
When I subscribe to topic, there's one more line in DB table ( etc. NAME: TSUB_1_24E6DB98A2EB7712E040A8C, TYPE: 65). I have expected that subscribers will be deleted after performing unsubscribe operation, but they don't...
Can you help me with this problem? Thanks for any answer.
Best Regards,
JurajHave you found a solution to this yet - because I face the same problem
-
Unable to create a transacted JMS Session
We have some code that worked perfectly under wls7.0 and earlier, but refuses to
work under wls8.1. In our situation, we are unable to create a JMS Session with
internal transactions.
The result of the following code
System.out.println("transacted_=" + transacted_);
tsession=tcon.createTopicSession(transacted_, Session.AUTO_ACKNOWLEDGE);
System.out.println("session.getTransacted()=" + tsession.getTransacted());
is the following
transacted_=true
session.getTransacted()=false
We have tried using xa true and false; but commonly use false.
//from config.xml
<JMSConnectionFactory JNDIName="corej2ee.jms.JMSConnectionFactory"
Name="CoreJMSConnectionFactory" Targets="myserver"/>
thanks,
jim
An alternative is to modify the servlet code to use global (user)
transactions instead of local (transacted session)
transactions - the performance will likely be the same in your case -
or may actually improve due to the activation of the pooling code.
jim stafford wrote:
> You were correct about us using the resource-ref. The documentation seemed to indicate
> that our servlet code should have worked as initially developed, however the new
> changes work
>
> //replace resource-ref lookup with env-entry to allow transacted JMS
> //sessions. This is new with wls8.1
> //tconFactory = (TopicConnectionFactory)
> // ctx.lookup("java:comp/env/jms/topicFactory");
> String factoryName =
> (String)ctx.lookup("java:comp/env/jms/myConnectionFactory");
> System.out.println("using global jndi name:" + factoryName);
> tconFactory = (TopicConnectionFactory)
> ctx.lookup(factoryName);
> tcon = tconFactory.createTopicConnection();
>
> System.out.println("transacted_=" + transacted_);
> tsession=tcon.createTopicSession(transacted_, Session.AUTO_ACKNOWLEDGE);
> System.out.println("session.getTransacted()=" + tsession.getTransacted());
>
> --- output
> Looking up topic connection factory
> using global jndi name:corej2ee.jms.JMSConnectionFactory
> transacted_=true
> session.getTransacted()=true
>
> Tom Barnes <[email protected]> wrote:
>
>>Hi Jim,
>>
>>My first thought is that the app is running
>>on the WL server and that the app is using EJB "resource
>>references" to indirectly access its JMS resources.
>>Stricter J2EE compliance in 8.1 causes JMS resources
>>accessed via resource references to ignore the transacted flag.
>>
>>See "J2EE Compliance" under:
>>http://edocs.bea.com/wls/docs81/jms/j2ee_components.html#1033768
>>
>>The work-around is to directly specify the JNDI name
>>of the CF in the app directly instead of looking it up
>>via a resource reference.
>>
>>Please let me know if this helps.
>>
>>Tom
>>
>>jim stafford wrote:
>>
>>
>>>We have some code that worked perfectly under wls7.0 and earlier, but
>>
>>refuses to
>>
>>>work under wls8.1. In our situation, we are unable to create a JMS
>>
>>Session with
>>
>>>internal transactions.
>>>
>>>The result of the following code
>>>
>>>System.out.println("transacted_=" + transacted_);
>>>tsession=tcon.createTopicSession(transacted_, Session.AUTO_ACKNOWLEDGE);
>>>System.out.println("session.getTransacted()=" + tsession.getTransacted());
>>>
>>>is the following
>>>
>>>transacted_=true
>>>session.getTransacted()=false
>>>
>>>We have tried using xa true and false; but commonly use false.
>>>
>>>//from config.xml
>>><JMSConnectionFactory JNDIName="corej2ee.jms.JMSConnectionFactory"
>>> Name="CoreJMSConnectionFactory" Targets="myserver"/>
>>>
>>>thanks,
>>>jim
>>
>
-
J2EE.6.6 One JMS session per connection and code portability
Hello,
Section J2EE.6.6 of the J2EE 1.4 spec states that "Application
components in the web and EJB containers must not attempt to
create more than one active (not closed) Session object per connection."
This is contrary to the API documentation for javax.jms.Connection that
states "Because the creation of a connection involves setting up
authentication and communication, a connection is a relatively
heavyweight object. Most clients will do all their messaging with a
single connection." (Indeed I found that e.g. JBoss creates seven
threads for each connection that I create in a client).
I want to provide a library that encapsulates the required calls to
setup several JMS sessions. Given the above, this library must act
differently when run within and outside an EJB container. Is there a
portable way to determine in one's code whether the code is running
inside or outside an EJB container?
Regards,
Michael LippThanks very much for your responses. You miss, however, a very important point. Maybe I didn't emphasize this point enough in my original posting.
I want to write a client library with a "SomeServiceFactory" that creates a "SomeService". "SomeService" happens to require several concurrent topic sessions. But this requirement is to be hidden from the user of the service. And the supplied library should be usable both in a "client container" (i.e. a stand-alone client) and in an EJB or web container (with an EJB or Servlet making use of "SomeService").
So "SomeService" must behave differently when creating sessions, depending on whether it runs in the client container or an EJB or web container. Of course I can request the user/developer to specify some configuration file/option depending on the environment -- and then I can pray not to get too much problem reports because developers will simply forget to specify the environment as required or get things wrong.
Or I can find a way to automatically find out about the environment my library is used in and everybody is happy -- hence my original question. -
Concurrent access to JMS session in servlet
We have a servlet that accepts a request from a browser,
retrieves info from the request, places it in a JMS message and
then sends the msg to a JMS Queue. We create all the JMS
objects (connection, session, etc.) at init time (all these
objects have class scope). There is only one session and I was
wondering because servlets are multithreaded, while a request is
being handled for one client, if there is a context switch in
the middle of that client's send in order to handle another
client's request, two different threads will be accessing the
same session concurrently. I know the spec advises against
this. Am I thining too much on this one????? All I have to do
is synchronize the send call however I was just wondering if it
was truely necessary.
How are other people doing this out there?
Let me know,
Mark
Hi Mark,
You are definitely not thinking too much on this one! Multi-threading
session access is unsafe and is definitely against spec. Either
synchronize
access, or, if performance is an issue, make sure each simultaneous
sender has its
own session.
The WebLogic JMS Performance white paper on dev2dev.bea.com
contains an example of a producer pool that looks like it should map
well to your use case.
Tom, BEA
Mark Drifdon wrote:
> We have a servlet that accepts a request from a browser,
> retrieves info from the request, places it in a JMS message and
> then sends the msg to a JMS Queue. We create all the JMS
> objects (connection, session, etc.) at init time (all these
> objects have class scope). There is only one session and I was
> wondering because servlets are multithreaded, while a request is
> being handled for one client, if there is a context switch in
> the middle of that client's send in order to handle another
> client's request, two different threads will be accessing the
> same session concurrently. I know the spec advises against
> this. Am I thining too much on this one????? All I have to do
> is synchronize the send call however I was just wondering if it
> was truely necessary.
> How are other people doing this out there?
>
> Let me know,
> Mark
-
JMS Sessions/Pooling on Solaris
We have an application that uses XML events to kick off our workflow. We open
a single QueueSession and QueueSender and send multiple messages to the workflow.
We've observed fine behavior on Windows, but on Solaris the process that sends
these messages appears to get hung...
We changed over to WLQueueSession so that we could send the messages with NO_ACKNOWLEDGEMENT,
but still we see the problem on Solaris.
One thing I would like to try is setting up a JMSSessionPool; but I'm having problems
setting it up. When I specify
ConnectionFactory="weblogic.jms.ServerSessionPoolFactory"
ListenerClass="javax.jms.QueueReceiver"
WLS complains on startup, that the ServerSessionPoolFactory cannot be resolved
(although it is clearly in weblogic.jar in c:\bea\wlserver\lib) and that the listener
does not have a constructor. Alternatively I've tried setting the ListenerClass
to "weblogic.jms.extensions.ServerSessionPoolListener" and I get the same problem.
Please help!I apologize for the late response on this.
For the first part of your question - The commit happens after the event is sent downstream from the jms adapter. So, if there is any error before a thread switch, the txn will be rolled back and it will retry the message. However, if you have a multithreaded channel downstream, the transaction will be commited after the event is put in the channel's queue.
As for durable subscriptions - As of now we don't expose durable subscriptions through CEP configuration. This is something we will look into for a future release.
Manju. -
Javax.jms.JMSException: Not supported in XA-backed session outside globaltx
I am trying to setup OracleOJMS provider and tries to access queue and post to queue from a normal jsp for testing.
I am getting the following
code:
javax.jms.JMSException: Not supported in XA-backed session outside global transaction
at oracle.j2ee.ra.jms.generic.RAUtils.make(RAUtils.java:525)
at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:199)
at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:210)
at oracle.j2ee.ra.jms.generic.CommonProducerWrapper.prepareForSend(CommonProducerWrapper.java:350)
at oracle.j2ee.ra.jms.generic.CommonProducerWrapper.send(CommonProducerWrapper.java:159)
at ResourceProvider.jspService(_ResourceProvider.java:112)
at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.1.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:453)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:591)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:515)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:711)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Steps i have done
ResourceProvider.jsp
code:
<!-- JSP Imports -->
<%@ page import="javax.jms.QueueConnectionFactory "%>
<%@ page import="javax.jms.XAQueueConnectionFactory "%>
<%@ page import="javax.jms.QueueConnection "%>
<%@ page import="javax.jms.QueueSession "%>
<%@ page import="javax.jms.Queue "%>
<%@ page import="javax.jms.QueueSender "%>
<%@ page import="javax.jms.Message "%>
<%@ page import="javax.jms.Session "%>
<%@ page import="javax.naming.Context "%>
<%@ page import="javax.naming.InitialContext "%>
<html>
<head>
<title>
Configuration of ResourceProvider for Advanced Queueing
</title>
</head>
<body>
<form name="TestResourceProvider" method="GET">
<%
// Check if the message has to be enqueued
if (request.getParameter("Message") != null){
Context jndiContext = new InitialContext();
XAQueueConnectionFactory queueCF = (XAQueueConnectionFactory)jndiContext.lookup
("java:comp/env/jms/InQueueCF");
Queue queue = (Queue)jndiContext.lookup("java:comp/env/jms/InQueue");
QueueConnection queueConnection = queueCF.createQueueConnection();
// Start the Connection
queueConnection.start();
QueueSender sender = queueSession.createSender(queue);
Message msg = queueSession.createTextMessage(request.getParameter("Message"));
sender.send(msg);
queueSession.commit();
sender.close();
queueSession.close();
queueConnection.close();
%>
<%
}else{
// User can enter the message to be enqueued through here
%>
Enter the message to be enqueued
<INPUT type="text" name="Message">
<br><br>
<input type="Submit" value="Enqueue Message">
<%
%>
</form>
</body>
</html>
My Steps for OJMS PRovider
1. Creating AQ queue in DB
2. configuration of resource adapter and provider
3. configuration of connection factories for resourceadapter[jmsconnector]
code:
1. Created the Queue table in DB using the sql
DROP USER jmsuser CASCADE;
GRANT connect, resource,AQ_ADMINISTRATOR_ROLE TO jmsuser IDENTIFIED BY jmsuser;
GRANT execute ON sys.dbms_aqadm TO jmsuser;
GRANT execute ON sys.dbms_aq TO jmsuser;
GRANT execute ON sys.dbms_aqin TO jmsuser;
GRANT execute ON sys.dbms_aqjms TO jmsuser;
connect jmsuser/jmsuser;
-- Create table to hold the queue, then create queue.
-- For topics multiple_consumers must be true
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE( Queue_table => 'SMSCP_INQTBL', Queue_payload_type => 'SYS.AQ$_JMS_MESSAGE',
sort_list => 'PRIORITY,ENQ_TIME', multiple_consumers => false, compatible => '8.1.5');
DBMS_AQADM.CREATE_QUEUE( Queue_name => 'SMSCP_INQ', Queue_table => 'SMSCP_INQTBL');
DBMS_AQADM.START_QUEUE(queue_name => 'SMSCP_INQ');
END;
quit;
Now our queue Name is queue Name : SMSCP_INQ table Name: SMSCP_INQTBL
2. Creating the Cp and datasource for the db [jmsuser] to make java to access queue
Creating ConnectionPool jmsDBPool
Creating DataSource jmsDBDataSource
Jndi jdbc jdbc/JMSDBDS
After creating, i got the following data-sources.xml
DATASOURCES.XML
<?xml version = '1.0' encoding = 'UTF-8'?>
<data-sources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/data-sources-10_1.xsd" schema-major-version="10" schema-minor-version="1">
<!-- default one comes with oracle shipping -->
<managed-data-source connection-pool-name="Example Connection Pool" jndi-name="jdbc/OracleDS" name="OracleDS"/>
<!-- New one Created -->
<managed-data-source connection-pool-name="jmsDBPool" jndi-name="jdbc/JMSDBDS" name="jmsDBDataSource"/>
<!-- default one comes with oracle shipping -->
<connection-pool name="Example Connection Pool">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="scott" password="tiger" url="jdbc racle:thin:@//localhost:1521/ORCL"/>
</connection-pool>
<!-- New one Created -->
<connection-pool name="jmsDBPool">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="jmsuser" password="jmsuser" url="jdbc racle:thin:@//localhost:1521/xe"/>
</connection-pool>
</data-sources>
3. JMS Connector Task. Customising the ra.xml
ra.xml
<!-- resourceadapter -->
<resourceadapter>
<resourceadapter-class>oracle.j2ee.ra.jms.generic.JMSResourceAdapter</resourceadapter-class>
<config-property>
<config-property-name>lookupMethod</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>resourceProvider</config-property-value>
</config-property>
<config-property>
<config-property-name>resourceProviderName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>testResourceProvider</config-property-value>
</config-property>
<!-- adminobject configuration -->
<adminobject>
<adminobject-interface>javax.jms.Queue</adminobject-interface>
<adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectQueueImpl</adminobject-class>
<config-property>
<config-property-name>jndiName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>Queues/MY_QUEUE</config-property-value>
</config-property>
<config-property>
<config-property-name>resourceProviderName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>testResourceProvider</config-property-value>
</config-property>
</adminobject>
<!--
<adminobject>
<adminobject-interface>javax.jms.Topic</adminobject-interface>
<adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
<config-property>
<config-property-name>jndiName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>Topics/MY_TOPIC</config-property-value>
</config-property>
<config-property>
<config-property-name>resourceProviderName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>testResourceProvider</config-property-value>
</config-property>
</adminobject>
-->
<adminobject>
<adminobject-interface>javax.jms.Queue</adminobject-interface>
<adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectQueueImpl</adminobject-class>
<config-property>
<config-property-name>resourceProviderName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>testResourceProvider</config-property-value>
</config-property>
</adminobject>
<adminobject>
<adminobject-interface>javax.jms.Topic</adminobject-interface>
<adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
<config-property>
<config-property-name>resourceProviderName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>testResourceProvider</config-property-value>
</config-property>
</adminobject>
</resourceadapter>
4. Create a JMS Connector INstance
oc4j-connectors.xml
<connector name="testResourceAdapter" path="testResourceAdapter.rar">
<config-property name="lookupMethod" value="resourceProvider"/>
<config-property name="resourceProviderName" value="testResourceProvider"/>
<!-- Default element generated by OC4J. Please uncomment and modify to suit your configuration needs.
<adminobject-config location="">
<adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectQueueImpl</adminobject-class>
<config-property name="jndiName" value="Queues/MY_QUEUE"/>
<config-property name="resourceProviderName" value="ojmsRP"/>
</adminobject-config>
-->
<!-- Default element generated by OC4J. Please uncomment and modify to suit your configuration needs.
<adminobject-config location="">
<adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
<config-property name="jndiName" value="Topics/MY_TOPIC"/>
<config-property name="resourceProviderName" value="ojmsRP"/>
</adminobject-config>
-->
</connector>
5. RA Connection Factories
<?xml version="1.0" encoding="UTF-8"?>
<oc4j-connector-factories xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/oc4j-connector-factories-10_0.xsd"
schema-major-version="10"
schema-minor-version="0">
<connector-factory location="resourceAdapterXAQCF/MYXAQCF" connector-name="testResourceAdapter">
<config-property name="jndiLocation" value="XAQueueConnectionFactories/XAQCF"/>
<connection-pooling use="private">
<property name="waitTimeout" value="300" />
<property name="scheme" value="fixed_wait" />
<property name="maxConnections" value="50" />
<property name="minConnections" value="0" />
</connection-pooling>
<connectionfactory-interface>javax.jms.XAQueueConnectionFactory</connectionfactory-interface>
</connector-factory>
</oc4j-connector-factories>
orion-web.xml
<?xml version="1.0"?>
<orion-web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd" deployment-version="10.1.3.1.0"
deployment-time="1218369811921"
jsp-cache-directory="./persistence"
jsp-cache-tlds="standard"
temporary-directory="./temp"
context-root="/smscpReceiver"
schema-major-version="10" schema-minor-version="0" >
<!-- Uncomment this element to control web application class loader behavior.
<web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true" />
-->
<resource-ref-mapping name="jms/InQueueCF" location="resourceAdapterXAQCF/MYXAQCF" />
<message-destination-ref-mapping location="resourceAdapterInQ/MYINQ" name="jms/InQueue">
</message-destination-ref-mapping>
<web-app>
</web-app>
</orion-web-app>
web.xml
<resource-ref>
<res-ref-name>jms/InQueueCF</res-ref-name>
<res-type>javax.jms.XAQueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>jms/InQueue</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-usage>Produces</message-destination-usage>
<message-destination-link>jms/InQueue</message-destination-link>
</message-destination-ref>
<message-destination>
<message-destination-name>jms/InQueue</message-destination-name>
</message-destination>Sorry for the jammed one
Neat one.
am trying to setup OracleOJMS provider and tries to access queue and post to queue from a normal jsp for testing.
I am getting the following
javax.jms.JMSException: Not supported in XA-backed session outside global transaction
at oracle.j2ee.ra.jms.generic.RAUtils.make(RAUtils.java:525)
at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:199)
at oracle.j2ee.ra.jms.generic.RAUtils.toJMSException(RAUtils.java:210)
at oracle.j2ee.ra.jms.generic.CommonProducerWrapper.prepareForS
INVOCATION
<form name="TestResourceProvider" method="GET">
<%
// Check if the message has to be enqueued
if (request.getParameter("Message") != null){
Context jndiContext = new InitialContext();
XAQueueConnectionFactory queueCF = (XAQueueConnectionFactory)jndiContext.lookup
("java:comp/env/jms/InQueueCF");
Queue queue = (Queue)jndiContext.lookup("java:comp/env/jms/InQueue");
QueueConnection queueConnection = queueCF.createQueueConnection();
// Start the Connection
queueConnection.start();
QueueSender sender = queueSession.createSender(queue);
Message msg = queueSession.createTextMessage(request.getParameter("Message"));
sender.send(msg);
queueSession.commit();
sender.close();
queueSession.close();
queueConnection.close();
%>
<%
}else{
// User can enter the message to be enqueued through here
%>
Enter the message to be enqueued
<INPUT type="text" name="Message">
<br><br>
<input type="Submit" value="Enqueue Message">
<%
%>
</form>
</body>
</html>
--------------------- -
Transactional Session JMS Adapter
Hi,
i'm using a JMS sender and receiver adapter. Everything works but i can't understand if it'could be better to use a Transactional Session in Jms setting. I've found a lot of documentation about jms adapter configuration, but not so much information about Transactional Session field.
Could somebody explain me something more??
When can i use transactional session?
Thanks a lot.
Bye, bye..Hi,
The Transactional Session in JMS is used to persist the messages or may get roll back if in case of failure.
The JMS adapter (Java Message Service) enables you to connect messaging systems to the Integration Engine or the PCK. The messages will be processed in Queue i.e WebSphere MQ series, SonicMQ and others...
Suppose in case of failure of the connectivity the messages maintained in queue may lost. That would be serious problem if the queue is maintained with the messages having important data from production landscape.
If you enable a transactional JMS session, set the indicator. The processing of a message will be safe, a transactional session ends either with a COMMIT, or in the case of an error, with a ROLLBACK. So there will not be any chance of loss of the messages in queue.
If the session is not transactional, there can be duplicates or lost messages.
I hope now it will pretty clear to you the purpose of Transactional session.
Thanks
Swarup -
Problem to send a message with JMS
Hi
I'm doing some tests with the api JMS to know how works. I have got some problems. I have been looking for some information but i don't find so much. I have got too doubts.
I am usinng Netbeans 5.5 with Sun Java System Application Server Platform Edition 9.0_01 (build b14).
I am trying to do it with ejb. Because in the future the application can have got so many connection in the same time.
The server shows me the next errors.
Starting Sun Java System Application Server Platform Edition 9.0_01 (build b14) ...
CORE5098: AS Socket Service Initialization has been completed.
CORE5076: Using [Java HotSpot(TM) Client VM, Version 1.6.0_03] from [Sun Microsystems Inc.]
SEC1002: Security Manager is OFF.
ADM0001:MBeanServer initialized successfully
SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
sgmt.service_initialized
DPL5400:Exception occurred : error in opening zip file.
ADM1079: Initialization of AMX MBeans successful
ADM1504: Here is the JMXServiceURL for the Standard JMXConnectorServer: [service:jmx:rmi:///jndi/rmi://t1:8686/jmxrmi]. This is where the remote administrative clients should connect using the standard JMX connectors
ADM1506: Status of Standard JMX Connector: Active = [true]
JTS5014: Recoverable JTS instance, serverId = [3700]
About to load the system app: MEjbApp
LDR5010: All ejb(s) of [MEjbApp] loaded successfully!
About to load the system app: __ejb_container_timer_app
EJB5109:EJB Timer Service started successfully for datasource [jdbc/__TimerPool]
LDR5010: All ejb(s) of [__ejb_container_timer_app] loaded successfully!
NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
appId=Chat-ejb moduleName=Chat-ejb ejbName=publicarBean
LDR5004: UnExpected error occured while creating ejb container
javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]
at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:485)
at com.sun.ejb.containers.BaseContainer.setupEnvironment(BaseContainer.java:2628)
at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:629)
at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:163)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:515)
at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:490)
at com.sun.enterprise.server.EJBModuleLoader.load(EJBModuleLoader.java:158)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:206)
at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:198)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:326)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
at com.sun.enterprise.server.PEMain.run(PEMain.java:326)
at com.sun.enterprise.server.PEMain.main(PEMain.java:260)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)
Caused by: javax.naming.NameNotFoundException
at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:255)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:178)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:469)
... 17 more
CORE5021: Application NOT loaded: [Chat-ejb]
WEB0302: Starting Sun-Java-System/Application-Server.
WEB0100: Loading web module [__default-admingui] in virtual server [__asadmin] at [/]
WEB0100: Loading web module [adminapp] in virtual server [__asadmin] at [/web1]
WEB0100: Loading web module [admingui] in virtual server [__asadmin] at [/asadmin]
WEB0100: Loading web module [amserver] in virtual server [server] at [/amserver]
Initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context ''
Completed initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context ''
Initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/asadmin'
Completed initializing Sun's JavaServer Faces implementation (1.2_02-b03-FCS) for context '/asadmin'
WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 8080
WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 8181
WEB0712: Starting Sun-Java-System/Application-Server HTTP/1.1 on 4848
About to load the system app: __JWSappclients
WEB0100: Loading web module [__JWSappclients:sys.war] in virtual server [server] at [/__JWSappclients]
Using MQ RA for Broker lifecycle control
JMS Service Connection URL is :mq://t1:7676/
MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...
EB-start:brokerProps={imq.instancename=imqbroker, imq.jmx.rmiregistry.port=8686, BrokerArgs=-port 7676 -name imqbroker -imqhome D:\Sun\AppServer\imq\bin\.. -varhome D:/sun/AppServer/domains/domain1\imq -useRmiRegistry -rmiRegistryPort 8686, imq.jmx.rmiregistry.use=true, imq.portmapper.port=7676}
[07/nov/2007:18:35:03 CET]
================================================================================
Sun Java(tm) System Message Queue 4.0
Sun Microsystems, Inc.
Version: 4.0 (Build 27-a)
Compile: Thu 03/02/2006
Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
This product includes code licensed from RSA Data Security.
================================================================================
Java Runtime: 1.6.0_03 Sun Microsystems Inc. D:\sun\Java\jdk1.6.0_03\jre
[07/nov/2007:18:35:03 CET] IMQ_HOME=D:\sun\AppServer\imq
[07/nov/2007:18:35:03 CET] IMQ_VARHOME=D:\sun\AppServer\domains\domain1\imq
[07/nov/2007:18:35:03 CET] Windows XP 5.1 x86 t1 (1 cpu) pepepc
[07/nov/2007:18:35:03 CET] Java Heap Size: max=506816k, current=46944k
[07/nov/2007:18:35:03 CET] Arguments: -port 7676 -name imqbroker -imqhome D:\Sun\AppServer\imq\bin\.. -varhome D:/sun/AppServer/domains/domain1\imq -useRmiRegistry -rmiRegistryPort 8686
[07/nov/2007:18:35:04 CET] [B1060]: Loading persistent data...
[07/nov/2007:18:35:04 CET] Using built-in file-based persistent store: D:\sun\AppServer\domains\domain1\imq\instances\imqbroker\
[07/nov/2007:18:35:04 CET] [B1189]: Cluster Service feature is not available
[07/nov/2007:18:35:04 CET] [B1039]: Broker "imqbroker@t1:7676" ready.
MQJMSRA_EB1101: run:EMBEDDED broker started with code =0
MQJMSRA_RA1101: SJSMQ JMS ResourceAdaapter configuration=
raUID =null
brokerType =EMBEDDED
brokerInstanceName =imqbroker
brokerBindAddress =null
brokerPort =7676
brokerHomeDir =D:\Sun\AppServer\imq\bin\..
brokerVarDir =D:/sun/AppServer/domains/domain1\imq
brokerJavaDir =D:/sun/Java/jdk1.6.0_03
brokerArgs =null
brokerStartTimeout =60000
adminUsername =admin
adminPassFile =E:\tempWin\asmq21980.tmp
useJNDIRmiServiceURL =true
rmiRegistryPort =8686
startRmiRegistry =false
useSSLJMXConnector =true
brokerEnableHA =false
clusterId =null
brokerId =null
jmxServiceURL =null
dbType =null
dbProps ={}
dsProps ={}
ConnectionURL =
UserName =guest
ReconnectEnabled =true
ReconnectInterval =5000
ReconnectAttempts =3
AddressListBehavior =RANDOM
AddressListIterations =3
InAppClientContainer =false
InClusteredContainer =false
GroupName =null
MQJMSRA_RA1101: start:SJSMQ JMSRA Connection Factory 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=false, imqConnectionFlowCount=100, imqAddressListBehavior=PRIORITY, 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=localhost:7676, imqOverrideJMSHeadersToTemporaryDestinations=false}
MQJMSRA_RA1101: SJSMQ JMSRA Started
endpoint.determine.destinationtype
NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
appId=Chat moduleName=Chat-ejb_jar ejbName=publicarBean
LDR5004: UnExpected error occured while creating ejb container
javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]
at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:485)
at com.sun.ejb.containers.BaseContainer.setupEnvironment(BaseContainer.java:2628)
at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:629)
at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:163)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:515)
at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:490)
at com.sun.enterprise.server.ApplicationLoader.load(ApplicationLoader.java:184)
at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:113)
at com.sun.enterprise.server.AbstractManager.load(AbstractManager.java:206)
at com.sun.enterprise.server.ApplicationLifecycle.onStartup(ApplicationLifecycle.java:204)
at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:326)
at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:112)
at com.sun.enterprise.server.PEMain.run(PEMain.java:326)
at com.sun.enterprise.server.PEMain.main(PEMain.java:260)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)
Caused by: javax.naming.NameNotFoundException
at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:255)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:178)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:469)
... 18 more
Registering ad hoc servlet: WebPathPath: context root = "/Chat", path = "/Chat-app-client'
Java Web Start services started for application com.sun.enterprise.appclient.jws.ApplicationContentOrigin@aabc2d registration name=Chat
[email protected]56b4 registration name=Chat, context root=/Chat/Chat-app-client, module name=
, parent=Chat
CORE5021: Application NOT loaded: [Chat]
SMGT0007: Self Management Rules service is enabled
Application server startup complete.
JBISE6013: JavaEEServiceEngine : Java EE Service Engine started successfully.
CORE5024: EJB module [Chat-ejb] unloaded successfully!
DeployedItemRef postDeregistration failed. Load Balancer Monitoring MBeans might be lying around if this application is being load balanced
BPEL service engine started
ADM1064:The upload file at [E:\tempWin\s1astempdomain1server-162970426\Chat-ejb.jar] exists and will be overwritten.
ADM1006:Uploading the file to:[E:\tempWin\s1astempdomain1server-162970426\Chat-ejb.jar]
deployed with moduleid = Chat-ejb
ADM1041:Sent the event to instance:[ModuleDeployEvent -- enable ejb/Chat-ejb]
endpoint.determine.destinationtype
NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
appId=Chat-ejb moduleName=D__sun_AppServer_domains_domain1_applications_j2ee-modules_Chat-ejb ejbName=publicarBean
LDR5004: UnExpected error occured while creating ejb container
javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]
at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:485)
at com.sun.ejb.containers.BaseContainer.setupEnvironment(BaseContainer.java:2628)
at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:629)
at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:163)
at com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:515)
at com.sun.enterprise.server.AbstractLoader.loadEjbs(AbstractLoader.java:490)
at com.sun.enterprise.server.EJBModuleLoader.load(EJBModuleLoader.java:158)
at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleDeployed(StandAloneEJBModulesManager.java:219)
at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleDeployed(StandAloneEJBModulesManager.java:174)
at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleDeployed(StandAloneEJBModulesManager.java:406)
at com.sun.enterprise.server.StandAloneEJBModulesManager.moduleEnabled(StandAloneEJBModulesManager.java:500)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:960)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:941)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
at com.sun.enterprise.admin.server.core.AdminNotificationHelper.sendNotification(AdminNotificationHelper.java:128)
at com.sun.enterprise.admin.server.core.ConfigInterceptor.postInvoke(ConfigInterceptor.java:109)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:97)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:56)
at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:142)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:109)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:174)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: javax.naming.NameNotFoundException
at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:255)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:178)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:98)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:309)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:469)
... 54 more
CORE5020: Error while loading ejb module
{code}
I know it is very large. I think the error it is in this line.
{code}
NAM0008 : Invalid Destination: jndi/Topic for java:comp/env/jms/Topic
EJB5090: Exception in creating EJB container [javax.naming.NamingException [Root exception is javax.naming.NameNotFoundException]]
{code}
also I am going to put the code.
file PublicarBean.java
{code}
package org.pepes;
import com.sun.tools.ws.processor.model.java.JavaArrayType;
import javax.annotation.Resource;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.jms.ConnectionFactory;
import javax.jms.QueueConnectionFactory;
import javax.jms.Topic;
import javax.naming.NamingException;
* @author pepes
@Stateless(mappedName="ejb/publicar")
public class publicarBean implements org.pepes.publicarRemote {
/** Creates a new instance of publicarBean */
@Resource(name="jms/QueueConnectionFactory")
private QueueConnectionFactory connectionFactory;
@Resource(name="jms/Topic", mappedName="jndi/Topic")
private Topic topic;
private javax.naming.InitialContext ctx;
public publicarBean() {
public void creaMensaje() throws javax.naming.NamingException , javax.jms.JMSException {
try {
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
this.connectionFactory = (javax.jms.QueueConnectionFactory)ctx.lookup("jms/QueueConnectionFactory");
this.topic = (javax.jms.Topic)ctx.lookup("jms/Topic");
javax.jms.Connection connection = this.connectionFactory.createConnection();
javax.jms.TopicSession ts = (javax.jms.TopicSession)connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
javax.jms.TopicPublisher tp = ts.createPublisher(this.topic);
javax.jms.TextMessage msg = ts.createTextMessage();
for (int i = 0; i<3;i++) {
msg.setText("Prueba: " + i);
tp.publish(msg);
catch (javax.jms.JMSException jmex) {
throw jmex;
{code}
the file publicarRemote.java
{code}
package org.pepes;
import javax.ejb.Remote;
* This is the business interface for publicar enterprise bean.
@Remote
public interface publicarRemote {
public void creaMensaje() throws javax.naming.NamingException , javax.jms.JMSException;
{code}
file mensaje.java
{code}
package org.pepes;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.Message;
import javax.jms.MessageListener;
* Entity class Mensaje
* @author pepes
@MessageDriven(mappedName = "jms/Mensaje", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
public class Mensaje implements MessageListener {
/** Creates a new instance of Mensaje */
@Resource
private MessageDrivenContext mdc;
public Mensaje() {
public void onMessage(Message message) {
javax.jms.TextMessage msg = null;
try {
if (message instanceof javax.jms.TextMessage) {
msg = (javax.jms.TextMessage) message;
System.out.println(msg.getText());
} else {
System.out.println("Message of wrong type: "
+ message.getClass().getName());
} catch (javax.jms.JMSException e) {
e.printStackTrace();
mdc.setRollbackOnly();
} catch (Throwable te) {
te.printStackTrace();
{code}
the file prueba.jsp
{code}
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>JSP Page</h1>
<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello ${param.name}!
</c:if>
--%>
<%
try {
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
org.pepes.publicarRemote publisher = (org.pepes.publicarRemote)ctx.lookup("ejb/publicar");
if (publisher==null) {
System.out.println("INFO: Es null");
else {
System.out.println("INFO: No es null");
publisher.creaMensaje();
} catch (javax.naming.NamingException ex) {
System.out.println("ERROR naming: " + ex.getMessage());
catch (javax.jms.JMSException jmex) {
System.out.println("ERROR jms: " + jmex.getMessage());
catch (java.lang.NullPointerException nullex) {
System.out.println("ERROR null: " + nullex.getMessage());
%>
</body>
</html>
{code}
I think the problem is because i don't put destination address. if it is so, the true where do I put this address?. if not where is the problem?
I hope your help.
Thanks you in advanced.Hi,
Did you create your destinations in your application server? It seems that the destinations such as topics and queues are not created. First you should create them and then start using them.
For example, in here, it says that jndi/Topic is not valid. To check if the destinations are valid or not; you can do it either through the graphical user interface or the command line console. -
JMS Client disconnects often randomly in Weblogic10.3 cluster setup
Hi,
It would be very helpful for us if someone can suggest the way to overcome the below jms issue.
Our application recently migrated to Weblogic 10.3 from Weblogic8.1, It is a clustered set up with two managed servers each on different solaris machine.
Client connects to jms using wljmsclient.jar and wlclient.jar with t3 protocol.
When client starts jms connection, it is getting connected to server with no errors, however we often see that client jms connection disconnects in between,
It sometimes calls onException() and some times we do not even see any error message in console log when it disconnects,
When onException() is called, we can see below exception stack trace:
==========================
JMS exception class = weblogic.messaging.dispatcher.DispatcherException: java.rmi.MarshalException: CORBA COMM_FAILURE 1398079697 No; nested exception is:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 209 completed: No
weblogic.jms.common.JMSException: weblogic.messaging.dispatcher.DispatcherException: java.rmi.MarshalException: CORBA COMM_FAILURE 1398079697 No; nested exception is:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 209 completed: No
at weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:116)
at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSyncNoTran(DispatcherAdapter.java:61)
at weblogic.jms.client.JMSSession.acknowledge(JMSSession.java:2191)
at weblogic.jms.client.JMSSession.acknowledge(JMSSession.java:2120)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4588)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:4233)
at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3709)
JMS exception class = java.rmi.MarshalException: CORBA COMM_FAILURE 1398079697 No; nested exception is:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 209 completed: No
weblogic.jms.common.LostServerException: java.rmi.MarshalException: CORBA COMM_FAILURE 1398079697 No; nested exception is:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 209 completed: No
at weblogic.jms.client.JMSConnection.dispatcherPeerGone(JMSConnection.java:1436)
at weblogic.messaging.dispatcher.DispatcherWrapperState.run(DispatcherWrapperState.java:692)
at weblogic.messaging.dispatcher.DispatcherWrapperState.timerExpired(DispatcherWrapperState.java:617)
at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
=======================
When onException() is triggered, TopicConnection and TopicSession gets recreated in program, however jms is not getting reconnected once onException() is called. Some times jms session is lost in between with out any errors in log. We did not see this issue when our app used Weblogic8.1.
We greatly appreciate if someone can help to resolve this issue.Hi,
This is a common issue if you use wljmsclient.jar and wlclient.jar at client side. Many times we get "org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 209 completed: No" Please try using weblogic.jar at client end or even there is a better option to create the "*wlfullclient.jar*" using the jarBuilder utility provided as part of WebLogic.
To create the "wlfullclient.jar" please refer to the following link:
[http://download-llnw.oracle.com/docs/cd/E11035_01/wls100/client/jarbuilder.html#wp1077742|http://download-llnw.oracle.com/docs/cd/E11035_01/wls100/client/jarbuilder.html#wp1077742]
Thanks
Jay SenSharma
http://jaysensharma.woardpress.com -
i m new to java,,, running one simple code in JMS Topic... using weblogic.... server.. please help me as it is givng me the error.. that i have pasted below. thanx in advance
Deepali
my publisher code i m giving below :
***************************************88
import javax.naming.*;
import javax.naming.InitialContext;
import javax.jms.JMSException;
import javax.jms.Topic;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.TopicPublisher;
import javax.jms.DeliveryMode;
import javax.jms.TopicSession;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.*;
public class Publisher
public static void main(String[] args) throws Exception
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
// get the initial context
InitialContext ctx = new InitialContext(env);
//InitialContext ctx = getInitialContext("t3://localhost:7001");
// lookup the topic object
Topic topic = (Topic) ctx.lookup("topic0");
// lookup the topic connection factory
TopicConnectionFactory connFactory = (TopicConnectionFactory) ctx.
lookup("topic/connectionFactory");
// create a topic connection
TopicConnection topicConn = connFactory.createTopicConnection();
// create a topic session
TopicSession topicSession = topicConn.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
// create a topic publisher
TopicPublisher topicPublisher = topicSession.createPublisher(topic);
topicPublisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// create the "Hello World" message
TextMessage message = topicSession.createTextMessage();
message.setText("Hello World");
// publish the messages
topicPublisher.publish(message);
// print what we did
System.out.println("published: " + message.getText());
// close the topic connection
topicConn.close();
it is givng following error?.. can some one explaine me y?...
Exception in thread "main" javax.naming.NameNotFoundException: Unable to resolve 'topic0' Resolved: '' Unresol
ved:'topic0' ; remaining name 'topic0'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at Publisher.main(Publisher.java:33)Could you tell me how the error was resolved, I am getting same error>
Thanks
i m new to java,,, running one simple code in JMS Topic... using weblogic.... server.. please help me as it is givng me the error.. that i have pasted below. thanx in advance
Deepali
my publisher code i m giving below :
***************************************88
import javax.naming.*;
import javax.naming.InitialContext;
import javax.jms.JMSException;
import javax.jms.Topic;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.TopicPublisher;
import javax.jms.DeliveryMode;
import javax.jms.TopicSession;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.*;
public class Publisher
public static void main(String[] args) throws Exception
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
// get the initial context
InitialContext ctx = new InitialContext(env);
//InitialContext ctx = getInitialContext("t3://localhost:7001");
// lookup the topic object
Topic topic = (Topic) ctx.lookup("topic0");
// lookup the topic connection factory
TopicConnectionFactory connFactory = (TopicConnectionFactory) ctx.
lookup("topic/connectionFactory");
// create a topic connection
TopicConnection topicConn = connFactory.createTopicConnection();
// create a topic session
TopicSession topicSession = topicConn.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
// create a topic publisher
TopicPublisher topicPublisher = topicSession.createPublisher(topic);
topicPublisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// create the "Hello World" message
TextMessage message = topicSession.createTextMessage();
message.setText("Hello World");
// publish the messages
topicPublisher.publish(message);
// print what we did
System.out.println("published: " + message.getText());
// close the topic connection
topicConn.close();
it is givng following error?.. can some one explaine me y?...
Exception in thread "main" javax.naming.NameNotFoundException: Unable to resolve 'topic0' Resolved: '' Unresol
ved:'topic0' ; remaining name 'topic0'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at Publisher.main(Publisher.java:33)
Maybe you are looking for
-
Font Size is not correct in the exported PDF-File
In the Report is the Font Arial Size 8, but in the exported PDF-Fildethe size is only 7,15. The Fontsize in the PDF-File is always smaller then in the Report. I use Crystal Report XI. With Version 9 is everythink ok.
-
Comboboxes are not set on the 1st time a row is clicked in the dataTable
I have somewhat the following setup: I have a DataTable that is filled with a listof objects, a actionListener is handeled when a row is clicked. Under the Table there are two ComboBoxes (lets call them Category and Item) that get their values from l
-
I recently aquired an iphone 4s due to the fact that our parent corporation requires us to use either a blackberry or iphone in order to have the protection needed to use their email. In MS Exchange, when I recieve an email, I read it once, then it's
-
How to restore my backed up photos from iCloud on new hard drive?
My hard drive failed on my first mac book pro, I have a time machine which has restored all my data on to the new hard drive. However all my photos/videos have not been restored. Can i access these through my backup on iCloud and how ? Why have my ph
-
Hello, Does anyone know any report out there that will show payment that were made by payment method or even a combined payment method within a particular time frame? Thank you