[JBossCache] - Exception occurred during commit of transaction -JBoss TreeC
by sesha.govindan
Hi,
Anyone face this problem, please help me out. I am using Treecache and transaction is controled by Weblogic container through stateless bean. I passed the value in config file as
com.csfb.opera.processLauncher.cache.TransactionManagerLookupImpl
and my class has implementaion to get Transaction Manager
public TransactionManager getTransactionManager() throws Exception {
Context ic = new InitialContext();
TransactionManager tm = (TransactionManager) ic.lookup("weblogic.transaction.TransactionManager");
return tm;
}
It dose everything very well but during commit I get following Exception.
I use Sleepycat org.jboss.cache.loader.bdbje.BdbjeCacheLoader as cacheloader and JBossCache1.4.1.SP3.
at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(TransactionImpl.java:504)
at org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(TxInterceptor.java:1154)
at org.jboss.cache.interceptors.OrderedSynchronizationHandler.beforeCompletion(OrderedSynchronizationHandler.java:75)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1010)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:115)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1216)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1990)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:275)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:246)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:299)
at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObject.java:140)
at com.csfb.opera.processLauncher.ejb.processLauncherSession_gxma9q_EOImpl.startByRegion(processLauncherSession_gxma9q_EOImpl.java:1863)
at com.csfb.opera.processLauncher.ejb.processLauncherSession_gxma9q_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061408#4061408
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061408
18Â years, 9Â months
[JBoss Messaging] - XA transaction
by relgames
Hi!
We have confronted with strange issue.
We have :
1) MDB1 that send JMS messages
2) MDB2 that receives message
Scenario is:
1. MDB1 persists entity and sends JMS message with ID of entity persisted
2. MDB2 received message and calls EntityManager.find() with id received.
Some times step 2 fails: entity manager doesn't contains entity!
It seems that MDB receives message earlier than entity manager fully persists entity.
We use JmsXA as Connection Factory.
Here is the code:
| // MDB 1
| public void onMessage(Message message) {
| try {
|
| ... some code...
|
| Domain d = new Domain("some name");
| manager.persist(d);
|
| list.add(d);
|
| .... some code
|
| MessageHelper.sendMessages(list, new String[]{
| Constants.JmsQueueNames.DOMAIN_OWNER_APPROVER,
| Constants.JmsQueueNames.TRADEMARK_APPROVER,
| Constants.JmsQueueNames.ADULT_APPROVER});
| } catch (JMSException e) {
| log.error(e);
| throw new EJBException(e);
| }
| log.debug("finished");
| }
|
| /// MDB 2
| public void onMessage(Message message) {
| .. some code ...
|
| Domain domain = MessageHelper.getObject(message, manager, Domain.class);
|
| .. some code ...
|
| }
|
|
| public class MessageHelper {
|
| private static Log log = LogFactory.getLog(MessageHelper.class);
|
| private static final String ID_KEY = "ENTITY_ID";
|
| public static <T> T getObject(Message message, EntityManager em, Class<T> objClass) throws JMSException {
| Long pk = message.getLongProperty(ID_KEY);
| if (pk==null) {
| StringBuffer str = new StringBuffer();
| str.append("PK is null!\n");
| Enumeration props = message.getPropertyNames();
| while (props.hasMoreElements()) {
| String prop = (String)props.nextElement();
| str.append(prop).append("=").append(message.getObjectProperty(prop).toString()).append('\n');
| }
| log.warn(str.toString());
| }
| T obj = em.find(objClass, pk);
| if (obj==null) {
| log.warn("Object is null!, pk = " + pk);
| }
| return obj;
| }
|
| public static void sendMessage(Long objectId, String queue) {
| List<Long> list = new ArrayList<Long>();
| list.add(objectId);
| sendMessages(list, new String[]{queue});
| }
|
| public static void sendMessages(List<Long> objectIds, String[] queues) {
| Connection connection = null;
| Session session = null;
| try {
| connection = getConnectionFactory().createConnection();
| connection.start();
|
| session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
| List<Message> messages = new ArrayList<Message>();
|
| for (Long id : objectIds) {
| Message message = session.createMessage();
| message.setLongProperty(ID_KEY, id);
| messages.add(message);
| }
|
| sendJMSMessages(queues, session, messages);
| } catch (JMSException ex) {
| log.error(ex);
| throw new EJBException("error sending message", ex);
| } catch (NamingException e) {
| log.error(e);
| throw new EJBException("error sending message", e);
| } finally {
| closeSession(session);
| closeConnection(connection);
| }
| }
|
| private static void sendListObjectMessage(List objects, String[] queues) {
| Connection connection = null;
| Session session = null;
| try {
| connection = getConnectionFactory().createConnection();
| connection.start();
|
| session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
| List<Message> messages = new ArrayList<Message>();
|
| for (Object object : objects) {
| ObjectMessage message = session.createObjectMessage();
| message.setObject((Serializable) object);
| messages.add(message);
| }
|
| sendJMSMessages(queues, session, messages);
| } catch (JMSException ex) {
| log.error(ex);
| throw new EJBException("error sending message", ex);
| } catch (NamingException e) {
| log.error(e);
| throw new EJBException("error sending message", e);
| } finally {
| closeSession(session);
| closeConnection(connection);
| }
| }
|
| private static void sendJMSMessages(String[] queues, Session session, List<Message> messages) throws JMSException, NamingException {
| MessageProducer producer = session.createProducer(null);
| try {
| for (String q : queues) {
| Destination dest = getQueue(q);
| for (Message message : messages) {
| producer.send(dest, message);
| }
| }
| } finally {
| if (producer!=null) {
| producer.close();
| }
| }
| }
|
| private static void sendObjectMessage(Serializable object, String[] queues) {
| ArrayList<Serializable> list = new ArrayList<Serializable>();
| list.add(object);
| sendListObjectMessage(list, queues);
| }
|
| public static void sendObjectMessage(Serializable object, String queue) {
| sendObjectMessage(object, new String[]{queue});
| }
|
| private static Queue getQueue(String name) throws NamingException {
| return (Queue) getContext().lookup(name);
| }
|
| private static Context _ctx;
|
| /**
| * http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHAJNDIUseCluster
| */
| private static Context getContext() throws NamingException {
| if (null == _ctx) {
| /*
| String partitionName = System.getProperty("jboss.partition.name");
| if (null != partitionName && partitionName.length() > 0) {
| Properties p = new Properties();
| p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
| p.put("jnp.partitionName", partitionName);
| _ctx = new InitialContext(p);
| } else {
| log.warn("can't find cluster partition name");
| _ctx = new InitialContext();
| }
| */
| _ctx = new InitialContext();
| }
| return _ctx;
| }
|
|
| /**
| * Closes the JMS connection.
| */
| private static void closeConnection(Connection connection) {
| try {
| if (connection != null)
| connection.close();
| } catch (JMSException e) {
| log.warn("Could not close JMS connection", e);
| }
| }
|
| /**
| * Closes the JMS session.
| */
| private static void closeSession(Session session) {
| try {
| if (session != null)
| session.close();
| } catch (JMSException e) {
| log.warn("Could not close JMS session", e);
| }
| }
|
| private static ConnectionFactory getConnectionFactory() throws NamingException {
| return (ConnectionFactory) getContext().lookup(Constants.JMS_CONNECTION_FACTORY_NAME);
| }
|
| public static void sendMessage(Long id, QueueConnectionFactory factory, String queue) {
| sendMessage(id, queue);
| }
|
| public static void sendMessages(List<Long> list, QueueConnectionFactory factory, String[] strings) {
| sendMessages(list, strings);
| }
|
| public static void sendObjectMessage(Serializable obj, QueueConnectionFactory factory, String queue) {
| sendObjectMessage(obj, queue);
| }
|
|
|
debug log is very big, but i've putted it here: http://tvpayrev.belhard.com/feeds/t.txt
you can see that MDB1 finished (first line), and last line informs us that MDB2 can't load entity.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061407#4061407
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061407
18Â years, 9Â months
[EJB/JBoss] - IIOP marshalling errors
by jstelzer
Hello, this is probably a self inflicted problem as I'm very new to corba. But, there doesn't seem to be many good places to look for examples that apply to what I'm doing.
Currently I'm working on getting an older application of ours to talk to our newer ejb servers via corba. We're using java 1.5 on the server side with jboss 4.0.5GA. On the client side, I'm using omniorb 4.1.0. At this point I've puzzled out how to get ejb3 beans registered with jacorb in jboss. So, at this point I can look up the remote interface to an ejb3 bean in the orb.
I can connect to the jboss server and lookup the remote name service on the C++ side.
I can lookup objects and create requests. However, I believe I'm either putting the request together wrong or need to declare things slightly differently.
The bean I'm talking to is a glorified hello world bean. It takes a string as an argument and returns a different string. The method never gets invoked. It looks like things are dying during the corba marshalling of input. All I see in the jboss log is:
| 12:12:40,052 ERROR sys : [STDERR] org.omg.CORBA.MARSHAL: unknown value tag: 0x6 (offset=0x88) vmcid: 0x0 minor code: 0 completed: No
| 12:12:40,052 ERROR sys : [STDERR] at org.jacorb.orb.CDRInputStream.read_value(CDRInputStream.java:2446)
| 12:12:40,053 ERROR sys : [STDERR] at org.jboss.iiop.rmi.marshal.CDRStream$StringReader.read(CDRStream.java:578)
| 12:12:40,053 ERROR sys : [STDERR] at org.jboss.iiop.rmi.marshal.strategy.SkeletonStrategy.readParams(SkeletonStrategy.java:128)
| 12:12:40,053 ERROR sys : [STDERR] at org.jboss.ejb3.iiop.BeanCorbaServant._invoke(BeanCorbaServant.java:193)
| 12:12:40,054 ERROR sys : [STDERR] at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:297)
| 12:12:40,054 ERROR sys : [STDERR] at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:596)
| 12:12:40,054 ERROR sys : [STDERR] at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:739)
| 12:12:40,054 INFO sys : [controller] rid: 4 opname: echoString invocation: system exception was thrown (org.omg.CORBA.MARSHAL: unknown value tag: 0x6 (offset=0x88) vmcid: 0x0 minor code: 0 completed: No)
|
Assuming I've looked up the right object, does this seem like a reasonable way to call a remote method as I've described on the C++ side? Appologies if this comes through mangled.
| CORBA::String_var arg = (const char*)"Echo!";
| CORBA::Request_var req = obj->_request("echoString");
| req->add_in_arg() <<= arg;
| req->set_return_type(CORBA::_tc_wstring);
|
| req->invoke();
|
| if( req->env()->exception() ) {
| CORBA::Exception *excP = req->env()->exception();
| cout << "echo_diiclt: An exception was thrown! " << excP->_name() << endl;
| return;
| }
|
| const char* ret;
| req->return_value() >>= ret;
| cout << "I said, \"" << (char*)arg << "\"." << endl
| << "The Echo object replied, \"" << ret <<"\"." << endl;
|
|
Thanks for your time.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061399#4061399
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061399
18Â years, 9Â months