3

グラスフィッシュのトランザクションと CORBA に関して奇妙な問題があります。問題を解決できましたが、このエラーが発生する理由はまだわかりません:

私は 2 つのクラスを取得しました。それらをClientRemoteImplと呼びましょう。クライアントはあるサーバーにあり、リモートは別のサーバーにあります。

クライアントは次のようになります (実際のコードではなく、より単純な例):

@Stateless
public class Client {

    @EJB(name = "TheRemoteEJB")
    protected Remote remoteEJB;

    @Schedule(hour = "*", minute = "*/5", persistent = false)
    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public void doSomeStuff() {
      for(int i=0;i<300000;i++){
        remoteEJB.theMethodToCall(i);
        ... other code that may take a bit longer...
      }
    }
}

RemoteImplは次のようになります。

@Stateless
@Remote(RemoteInterface.class)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class RemoteImpl {

  @EJB
  private SomeJPAFacade facade;

  @Override
  public int theMethodToCall(int param) throws SomeException {
    Bean products = facade.findBySomeSelect(param);
    return bean.getAValue();
  }
}

他の使用されるクラスは次のとおりです。

SomeException :

public class SomeException extends Exception {
 public SomeException() {
   super();
 }
 public SomeException(String message) {
   super(message);
 }
}

およびRemoteInterface

public interface RemoteInterface {
  public int theMethodToCall() throws SomeException
}

問題は、doSomeStuffに時間がかかりすぎると、CORBA 例外が発生することです。

[#|2012-12-22T03:10:03.327+0100|INFO|glassfish3.1.2|com.foo.bar.Client|_ThreadID=47;_ThreadName=Thread-2;|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 com.foo.bar.Client._Remote_Wrapper.theMethodToCall(com/foo/bar/_RemoteInterface_Wrapper.java)
    at com.foo.bar.Client.doSomeStuff(Client.java:73)
    at sun.reflect.GeneratedMethodAccessor3162.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
    at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:49)
    at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundTimeout(SystemInterceptorProxy.java:149)
    at sun.reflect.GeneratedMethodAccessor371.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
    at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)
    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)
    at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:4058)
    at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1832)
    at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:108)
    at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:2646)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
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:281)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:213)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
    at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:227)
    at com.foo.bar.__RemoteInterface_Remote_DynamicStub.matchByParityId(com/foo/bar/__RemoteInterface_Remote_DynamicStub.java)
    ... 39 more
Caused by: org.omg.CORBA.INVALID_TRANSACTION:   vmcid: 0x0  minor code: 0  completed: No
    at com.sun.jts.CosTransactions.CurrentTransaction.sendingRequest(CurrentTransaction.java:812)
    at com.sun.jts.CosTransactions.SenderReceiver.sending_request(SenderReceiver.java:138)
    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:376)
    at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:304)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:228)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:194)
    ... 42 more
Caused by: org.omg.CosTransactions.Unavailable: IDL:omg.org/CosTransactions/Unavailable:1.0
    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:804)
    ... 49 more
|#]

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)トランザクションにまたがりたくないので、明示的に ApllicationServer に伝えました。しかし、例外はトランザクションがあったようです。別のグラスフィッシュ インスタンスへのリモート呼び出しにトランザクションをまたがることはできないといつも思っていましたか?

@TransactionAttributeを削除し、代わりに@TransactionManagement(TransactionManagementType.BEAN)in Clientクラスを追加することで問題を解決できました。

それでも、このエラーが発生する理由を知りたいです。

返信ありがとうございます。

更新: バグレポートは以下に提出されています: https://java.net/jira/browse/GLASSFISH-17535

4

1 に答える 1

1

NOT_SUPPORTEDThe container invokes an enterprise bean method whose transaction attribute NOT_SUPPORTED with an unspecified transaction context.

不特定のコンテキストが無効なトランザクション例外を引き起こしているようです。

Bean管理のトランザクションを使用することで、トランザクションコンテキストを提供しないようにコンテナに指示し、その例外を防止します。

これは私にとってバグのように感じます、私は私の腸の感覚によってグラスフィッシュにあまり精通していないので、これはうまくいくはずだったと私に言います。

于 2012-12-24T11:52:46.610 に答える