[jBPM Development] - JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env)
by gigazhang
gigazhang [https://community.jboss.org/people/gigazhang] created the discussion
"JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env)"
To view the discussion, visit: https://community.jboss.org/message/741178#741178
--------------------------------------------------------------
throw exception
javax.persistence.TransactionRequiredException: No local transaction to join
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.doJoinTransaction(ExtendedEntityManagerCreator.java:407)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:350)
at $Proxy32.joinTransaction(Unknown Source)
at org.drools.persistence.jpa.JpaPersistenceContext.joinTransaction(JpaPersistenceContext.java:29)
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:152)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:67)
at org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:122)
at com.baison.demo.jbpm.commons.JbpmHelper.createSession(JbpmHelper.java:255)
at com.baison.demo.jbpm.service.TaskProcessServiceImpl.saveProcess(TaskProcessServiceImpl.java:71)
at com.baison.demo.jbpm.service.TaskProcessServiceImpl.commitProcess(TaskProcessServiceImpl.java:125)
at com.baison.demo.jbpm.controller.TaskProcessController.getUserCommitProcess(TaskProcessController.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:722)
java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:143)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:67)
at org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:122)
at com.baison.demo.jbpm.commons.JbpmHelper.createSession(JbpmHelper.java:255)
at com.baison.demo.jbpm.service.TaskProcessServiceImpl.saveProcess(TaskProcessServiceImpl.java:71)
at com.baison.demo.jbpm.service.TaskProcessServiceImpl.commitProcess(TaskProcessServiceImpl.java:125)
at com.baison.demo.jbpm.controller.TaskProcessController.getUserCommitProcess(TaskProcessController.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)
... 38 more
Caused by: javax.persistence.TransactionRequiredException: No local transaction to join
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.doJoinTransaction(ExtendedEntityManagerCreator.java:407)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:350)
at $Proxy32.joinTransaction(Unknown Source)
at org.drools.persistence.jpa.JpaPersistenceContext.joinTransaction(JpaPersistenceContext.java:29)
at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:152)
... 43 more
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/741178#741178]
Start a new discussion in jBPM Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months
[JBoss AS 7 Development] - try-catch-finally control flow
by Alexey Loubyansky
Alexey Loubyansky [https://community.jboss.org/people/aloubyansky] created the document:
"try-catch-finally control flow"
To view the document, visit: https://community.jboss.org/docs/DOC-18731
--------------------------------------------------------------
The CLI implements a simplified analogue of Java's try-catch-finally control flow. It consists of three sets of operations and commands (with each set being a batch) corresponding to the try, catch and finally blocks. Both catch and finally blocks are optional but at least one of them should be present. Unlike in Java, only one catch block can be specified.
The control flow begins with execution of the try batch. If the try batch finished successfully (i.e. the outcome of the operation was success), then the catch batch is skipped and the finally batch is executed. If the try batch failed (i.e. the outcome of the operation was failure, in case of, e.g., a +java.io.IOException+ the whole try-catch-finally control flow will terminate immediately) then the catch batch (if it is present) will be executed. The finally batch (if it is present) will always execute at the end of the control flow no matter whether the try and catch batches succeeded or failed to execute.
There are four commands that define the try-catch-finally control flow: *try*, *catch*, *finally* and *end-try*.
*try* command starts the try batch. The try batch continues until one of *catch* or *finally* command is met.
*catch* command marks the end of the try batch (the try batch is then held back) and starts the catch batch.
*finally* command marks the end of the catch batch (if the current batch is a catch batch) or the try batch (if the catch batch was not specified) and starts the finally batch.
*end-try* is the command that ends either catch or finally batch (depending on which one was the last one) and runs the try-catch-finally control flow.
Here is an example that either creates or re-creates a datasource and enables it:
try
/subsystem=datasources/data-source=myds:add(connection-url=xxx,jndi-name=java:/myds,driver-name=h2)
catch
/subsystem=datasources/data-source=myds:remove
/subsystem=datasources/data-source=myds:add(connection-url=xxx,jndi-name=java:/myds,driver-name=h2)
finally
/subsystem=datasources/data-source=myds:enable
end-try
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-18731]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
12 years, 6 months
[JBoss Messaging Development] - How to make the JMS receiver client wait till the next message arrives in the queue?
by chithu21
chithu21 [https://community.jboss.org/people/chithu21] created the discussion
"How to make the JMS receiver client wait till the next message arrives in the queue?"
To view the discussion, visit: https://community.jboss.org/message/747708#747708
--------------------------------------------------------------
Hi,
I have a receiver client program and a sender program.
Receiver Program:
import java.io.BufferedReader;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.SQLException;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.NamingException;
import com.dcat2.common.Config;
import com.dcat2.common.Constants;
import com.dcat2.common.ReadConfig;
import com.dcat2.logger.LoggerFactory;
import com.dcat2.logger.LoggerImp;
import com.dcat2.datatransfer.DbConnection;
import EDU.oswego.cs.dl.util.concurrent.CountDown;
/**.
* This class contains methods to read messages from the Queue
* and inserts them to receiving DB
*
* This class needs to be updated after getting spec from XIB,
* and is just retained as place holder, it will not work on Jboss 6
*
* @author Chithra V S
*
*/
public class MessageReceiver implements MessageListener {
/**.
* Initialize the logger
*/
private static com.dcat2.logger.LogInterface log =
(LoggerImp) LoggerFactory.getLogger(MessageReceiver.class);
/**.
* Initialize the counter
*/
static final int N = 1;
/**.
* Initialize the CountDown which is used to
* notify a driver when all threads are complete.
*/
static CountDown done = new CountDown(N);
/**.
* Initialize the DCAT Centre Variable
*/
private static String strDcatCentre = "";
/**.
* Initialize the Rejection Table Name Variable.
*/
private String strRejectionTable = "";
/**.
* Initialize the Counter for DB.
*/
private static int count = 0 ;
/**.
* Initialize the ReadConfig
*/
private static ReadConfig readConfig = new ReadConfig();
/**.
* Read the properties file
*/
private static Config config = readConfig.readPropertiesFile();
static JMSConnector jmsConnector = new JMSConnector();
private boolean quit = false;
/**.
* Constructor
*/
public MessageReceiver() {
if (log == null) {
System.err.println(
"Failure Creating Logtrace Object!!!");
}
}
/**.
* Inner class which implements MessageListener
* and receives messages from the Queue
*
*/
public static class ExListener implements MessageListener {
DbConnection dbConnection = new DbConnection();
/**.
* @see javax.jms.MessageListener#onMessage(javax.jms.Message)
* @param msg - The JMS Message
*/
public void onMessage(Message msg) {
log.debug("Inside OnMessage");
//done.release();
try {
String strReceivedMsg = "";
if (msg instanceof TextMessage) {
strReceivedMsg = ((TextMessage) msg).getText();
} else {
strReceivedMsg = msg.toString();
}
log.debug("onMessage, recv text=" + strReceivedMsg);
if (strReceivedMsg.equalsIgnoreCase("quit")) {
synchronized (this) {
quit = true;
this.notifyAll(); // Notify main thread to quit
}
}
dbConnection.insertToReceivingDb(strReceivedMsg,
getStrDcatCentre(), config.getRecvMsgTable());
count++;
} catch (JMSException e) {
log.error(
"An exception occured while receiving from Queue : "
+ e);
}
finally {
try {
//MessageReceiver.done.acquire();
jmsConnector.closePTP();
}/* catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/ catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
/**.
* This methods throws an exception when an exception occurs in
* the onMessage method
* @param exception - Exception
*/
public void onException(final JMSException exception) {
log.error("An error occurred: " + exception);
}
/**.
* This method is used to receive messages from the in bound queue
* and insert them to the receiving database
* @param None
* @throws JMSException - JMS Exception
* @throws NamingException - Naming Exception
* @throws InterruptedException - Interrupted Exception
* @throws ClassNotFoundException - Class Not Found Exception
* @throws SQLException - SQL Exception
*/
public final void receiveMessage() throws JMSException, NamingException,
InterruptedException, ClassNotFoundException, SQLException {
log.debug("Begin receiveMessage method");
QueueObject queueObj = jmsConnector.setupPTP(config.getProviderUrl(),
config.getXibToCatQueue());
QueueSession session = queueObj.getQueueSession();
Queue xibToCatQueue = queueObj.getQueue();
log.debug("Queue Name : " + xibToCatQueue.getQueueName());
// Set the async listener for xibToCatQueue
QueueReceiver recv = session.createReceiver(xibToCatQueue);
log.info("************Receiver Is Ready To Receive Messages************");
recv.setMessageListener(new ExListener());
synchronized (recv) {
while (!quit) {
try {
recv.wait();
} catch (InterruptedException ie) {
}
}
}
recv.close();
//log.info(count + " row/rows inserted to " + config.getRecvMsgTable() + " table");
//log.info("************Receiving Of Messages Completed************");
//log.debug("End receiveMessage method");
}
/**.
* This method returns the value of Dcat Centre
* @param None
* @return strDcatCentre
* @exception None
*/
public static String getStrDcatCentre() {
return strDcatCentre;
}
/**.
* This method sets the value of Dcat Centre
* @param strDcatCentre = DCAT Centre Code
* @exception None
*/
public final void setStrDcatCentre(final String strDcatCentre) {
MessageReceiver.strDcatCentre = strDcatCentre;
}
public static void main(final String[] args) throws JMSException,
NamingException, InterruptedException, ClassNotFoundException,
SQLException {
MessageReceiver msgReceiver = new MessageReceiver();
msgReceiver.receiveMessage();
}
}
Sender:
package com.dcat2.messaging.sendreceive;
import java.util.ArrayList;
import java.util.Iterator;
import javax.jms.DeliveryMode;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.NamingException;
import com.dcat2.common.Config;
import com.dcat2.common.Constants;
import com.dcat2.common.ReadConfig;
import com.dcat2.logger.LoggerFactory;
import com.dcat2.logger.LoggerImp;
import com.dcat2.datatransfer.DbConnection;
/**
* This class has methods to send XML messages to the XIB Queue. Note:Once the
* XIB details are available, this class may need modification
*
* @author Chithra V S
*
*/
public class MessageSender {
/**.
* Initialize the logger
*/
private static com.dcat2.logger.LogInterface log =
(LoggerImp) LoggerFactory.getLogger(MessageSender.class);
/**.
* Constructor
*/
public MessageSender() {
if (log == null) {
System.err.println("Failure Creating Logtrace Object!!!");
}
}
/**.
* This method sends xml message to the out bound queue
* @param strKey - Key received at run time
* @param strDcatCentre - DCAT Center Code received at run time
* @throws JMSException - JMS Exception
* @throws NamingException - Naming Exception
*/
public final void sendMessage(final String strKey, final String strDcatCentre)
throws JMSException, NamingException {
log.debug("Begin sendMessage Method");
ReadConfig readValues = new ReadConfig();
Config config = readValues.readPropertiesFile();
JMSConnector jmsConnector = new JMSConnector();
String strStatus = "";
String strXMLMessage = "";
/*
* Read segments from SendMsg Db Table
* and sends to the Queue
*/
DbConnection dbConnection = new DbConnection();
/*QueueObject queueObj = jmsConnector.setupPTP(
config.getProviderUrlXib(),
config.getCatToXibQueue());*/
QueueObject queueObj = jmsConnector.setupPTP(
config.getProviderUrlXib(),
config.getXibToCatQueue());
QueueSession session = queueObj.getQueueSession();
Queue catToXibQueue = queueObj.getQueue();
log.debug("Queue Name: " + catToXibQueue.getQueueName());
QueueSender sender = session.createSender(catToXibQueue);
sender.setDeliveryMode(DeliveryMode.PERSISTENT);
try {
ArrayList<String> msgList = dbConnection.readFromSendMsgDb(
config.getSendMsgDb(), strKey, strDcatCentre);
Iterator<String> iterator = msgList.iterator();
log.info("************Sending Of Messages Started************");
while (iterator.hasNext()) {
strXMLMessage = iterator.next();
log.debug("XML Message to be sent : " + strXMLMessage);
TextMessage tm = session.createTextMessage(strXMLMessage);
sender.send(tm);
log.info("Sent Message =" + tm.getText());
strStatus = Constants.RETURN_CODE_OK;
}
} catch (JMSException e) {
// write to log file if the message was not sent
log.error("The message: " + strXMLMessage + " was not sent : " + e);
strStatus = Constants.RETURN_CODE_NOK;
} finally {
if (sender != null) {
sender.close();
}
jmsConnector.closePTP();
}
log.info("************Sending Of Messages Completed************");
log.debug("End sendMessage Method");
}
/**.
* Main method
* @param args - String array of command line arguments
* @throws JMSException - JMS Exception
* @throws NamingException - Naming Exception
*/
public static void main(final String[] args) throws JMSException,
NamingException {
String strKey = args[0];
String strDcatCentre = args[1];
MessageSender messageSender = new MessageSender();
messageSender.sendMessage(strKey, strDcatCentre);
}
}
JMSConnector:
package com.dcat2.messaging.sendreceive;
import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSession;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.dcat2.common.Config;
import com.dcat2.common.ReadConfig;
/**.
* This class contains methods to setup a point to point connection
* to a JMS Queue
*
* @author Chithra V S
*
*/
public class JMSConnector {
/**.
* Queue Connection Object
*/
private QueueConnection connection;
/**.
* Queue Session Object
*/
private QueueSession session;
/**.
* This method is used to setup a Point To Point Connection
* @param contextUrl - URL of the Queue Provider
* @param queueName - Name of the Queue
* @return QueueObject
* @throws JMSException - JMS Exception
* @throws NamingException - Naming Exception
*/
public final QueueObject setupPTP(
final String contextUrl, final String queueName)
throws JMSException, NamingException {
ReadConfig readValues = new ReadConfig();
Config config = readValues.readPropertiesFile();
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, config.getContextFactory());
env.put(Context.SECURITY_PRINCIPAL, config.getJmsUserName());
env.put(Context.SECURITY_CREDENTIALS, config.getJmsUserPwd());
env.put(Context.PROVIDER_URL, contextUrl);
InitialContext iniCtx = new InitialContext(env);
QueueConnectionFactory qcf = (QueueConnectionFactory)iniCtx.lookup(config.getJmsFactory());
connection = qcf.createQueueConnection();
String lookUpObj = "java:/" + queueName;
Queue xibToCatQueue = (Queue) iniCtx.lookup(lookUpObj);
session = connection.createQueueSession(
false, QueueSession.AUTO_ACKNOWLEDGE);
connection.start();
return new QueueObject(session, xibToCatQueue);
}
/**.
* This method is used to close the Point To Point Connection
* @param None
* @throws JMSException - JMS Exception
*/
public final void closePTP() throws JMSException {
if (session != null) {
session.close();
}
if (connection != null) {
connection.stop();
}
}
}
I ran the MessageReceiver & then ran the MessageSender. The receiver program didnt terminate. But it also didnt trigger the onMessage method to receive the messages.
Any idea what is wrong?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/747708#747708]
Start a new discussion in JBoss Messaging Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 6 months