jeudi 28 mai 2015

Java EE. Can't access XA resource

I am using a XA-data-source for the first time and I am a bit confused. I understood the concept theoretically, but I am not quite sure how to program it.

I have 3 databases with the following type of annotation on the data-access beans:

@DataSourceDefinition(name = "java:global/jdbc/DVI-P1",
        className = "org.apache.derby.jdbc.ClientXADataSource",
        serverName = "localhost",
        databaseName = "DVI-P1;create=true",
        user = "dvi",
        password = "1234",
        maxIdleTime = 600
)

I guess thats what I have to do to access the databases with the XA concept, right?

Furthermore I read somewhere on stackoverflow that I have to change my jta-data-source in my PU to this:

<jta-data-source>java:global/jdbc/DVI-P1</jta-data-source>

I cannot access the databases anymore. I get the following exception when I use a method that calls a method in the data-access beans that access its DB:

javax.ejb.EJBException: javax.transaction.InvalidTransactionException: CORBA INVALID_TRANSACTION 0 No; nested exception is: 
    org.omg.CORBA.INVALID_TRANSACTION:   vmcid: 0x0  minor code: 0  completed: No
    at business._ShopSessionBeanRemote_Wrapper.getAllBestellungFor(business/_ShopSessionBeanRemote_Wrapper.java)
    at access.DAO.getAllBestellungFor(DAO.java:185)
    at edu.whs.dvi.ui.ObservableDAO2.getAllBestellungFor(ObservableDAO2.java:51)
    at edu.whs.dvi.ui.view.OrderListView.searchOrders(OrderListView.java:417)
    at edu.whs.dvi.ui.view.OrderListView.confirmButtonActionPerformed(OrderListView.java:365)
    at edu.whs.dvi.ui.view.OrderListView.access$000(OrderListView.java:31)
    at edu.whs.dvi.ui.view.OrderListView$1.actionPerformed(OrderListView.java:96)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6525)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2739)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:719)
    at java.awt.EventQueue$4.run(EventQueue.java:717)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: javax.transaction.InvalidTransactionException: CORBA INVALID_TRANSACTION 0 No; nested exception is: 
    org.omg.CORBA.INVALID_TRANSACTION:   vmcid: 0x0  minor code: 0  completed: No
    at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:280)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:211)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:150)
    at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:226)
    at business.__ShopSessionBeanRemote_Remote_DynamicStub.getAllBestellungFor(business/__ShopSessionBeanRemote_Remote_DynamicStub.java)
    ... 43 more
Caused by: org.omg.CORBA.INVALID_TRANSACTION:   vmcid: 0x0  minor code: 0  completed: No
    at com.sun.jts.CosTransactions.CurrentTransaction.sendingRequest(CurrentTransaction.java:807)
    at com.sun.jts.CosTransactions.SenderReceiver.sending_request(SenderReceiver.java:141)
    at com.sun.jts.pi.InterceptorImpl.send_request(InterceptorImpl.java:338)
    at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeClientInterceptorStartingPoint(InterceptorInvoker.java:290)
    at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeClientPIStartingPoint(PIHandlerImpl.java:378)
    at com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl.beginRequest(ClientRequestDispatcherImpl.java:323)
    at com.sun.corba.ee.impl.protocol.ClientDelegateImpl.request(ClientDelegateImpl.java:220)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
    ... 46 more
Caused by: org.omg.CosTransactions.Unavailable: IDL:http://ift.tt/1LM7Y6x
    at com.sun.jts.CosTransactions.TopCoordinator.get_txcontext(TopCoordinator.java:2787)
    at com.sun.jts.CosTransactions.ControlImpl.getTXContext(ControlImpl.java:824)
    at com.sun.jts.CosTransactions.CurrentTransaction.sendingRequest(CurrentTransaction.java:799)
    ... 53 more

Aucun commentaire:

Enregistrer un commentaire