Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java EJB2.1在集群中引发包装的远程异常_Java_Jakarta Ee_Weblogic_Weblogic12c_Ejb 2.x - Fatal编程技术网

Java EJB2.1在集群中引发包装的远程异常

Java EJB2.1在集群中引发包装的远程异常,java,jakarta-ee,weblogic,weblogic12c,ejb-2.x,Java,Jakarta Ee,Weblogic,Weblogic12c,Ejb 2.x,我们正在将Weblogic 10.3.6应用程序迁移到Weblogic 12.2.1.2。我们有许多EJB2.1bean,它们构成了应用程序的一部分。我们遇到了一个奇怪的问题,其中一些豆子 当我们有一个ejb调用另一个,并且这个bean抛出一个选中的异常(例如,RuleException extensed exception)时,它作为RemoteException(RemoteEJBInvokeException)抛出。仅当应用程序在群集中运行时才会发生这种情况。如果我针对独立的jvm进行部署

我们正在将Weblogic 10.3.6应用程序迁移到Weblogic 12.2.1.2。我们有许多EJB2.1bean,它们构成了应用程序的一部分。我们遇到了一个奇怪的问题,其中一些豆子

当我们有一个ejb调用另一个,并且这个bean抛出一个选中的异常(例如,
RuleException extensed exception
)时,它作为
RemoteException
RemoteEJBInvokeException
)抛出。仅当应用程序在群集中运行时才会发生这种情况。如果我针对独立的jvm进行部署,它可以正常工作

通用EJB模式是一种外观模式。在FacadeBean中,我们使用标准JNDI查找来定位Home,然后运行create方法来返回业务接口/impl

InitialContext ctx = new InitialContext();
ReportManagementHome reportManagementHome = (ReportManagementHome) ctx.lookup("ReportManagement");
ReportManagement reportManagement = reportManagementHome.create();
ReportManagement
bean运行业务逻辑并抛出规则异常

这是facade中调用第二个bean的示例方法:

public String doTest() {
    String s = null;
    try
    {
      s = reportManagement.doValidate();
    }
    catch ( RuleException re )
    {
      rollBack();
    } catch (RemoteException e)
    {
      e.printStackTrace();
    }

    return s;
  }
public String doValidate( )
      throws RuleException, CustomException
  {

    int test = 1;

    if (test == 1)
    {
      throw new RuleException();
    }

    return "Hello";

  }
下面是第二个bean中的
doValidate()
方法:

public String doTest() {
    String s = null;
    try
    {
      s = reportManagement.doValidate();
    }
    catch ( RuleException re )
    {
      rollBack();
    } catch (RemoteException e)
    {
      e.printStackTrace();
    }

    return s;
  }
public String doValidate( )
      throws RuleException, CustomException
  {

    int test = 1;

    if (test == 1)
    {
      throw new RuleException();
    }

    return "Hello";

  }
尽管正确地到达并抛出了
RuleException
,但当facade捕捉到它时,它是一个
RemoteException

这是EJB/接口的示例列表:

ReportManagement
ReportManagementBean
ReportManagementFacade
ReportManagementFacadeBean
ReportManagementFacadeHome
ReportManagementFacadeLocal
ReportManagementFacadeLocalHome
ReportManagementHome
ReportManagementLocal
ReportManagementLocalHome
以下是
ejbjar.xml

    <?xml version='1.0' encoding='UTF-8'?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
         version="2.1">
<enterprise-beans>
    <session>
      <display-name>ReportManagementFacade</display-name>
      <ejb-name>ReportManagementFacade</ejb-name>
      <home>com.ejb.ReportManagementFacadeHome</home>
      <remote>com.ejb.ReportManagementFacade</remote>
      <local-home>com.ejb.ReportManagementFacadeLocalHome</local-home>
      <local>com.ejb.ReportManagementFacadeLocal</local>
      <ejb-class>com.ejb.ReportManagementFacadeBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
    <session>
      <display-name>ReportManagement</display-name>
      <ejb-name>ReportManagement</ejb-name>
      <home>com.ejb.ReportManagementHome</home>
      <remote>com.ejb.ReportManagement</remote>
      <local-home>com.ejb.ReportManagementLocalHome</local-home>
      <local>com.ejb.ReportManagementLocal</local>
      <ejb-class>com.ejb.ReportManagementBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>
  <assembly-descriptor>
    <container-transaction>
      <method>
        <ejb-name>ReportManagementFacade</ejb-name>
        <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
      <method>
        <ejb-name>ReportManagement</ejb-name>
        <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
</ejb-jar>
在此问题上的任何指导都将不胜感激。

这:

 <enable-call-by-reference>true</enable-call-by-reference>
true

使同一JVM中的远程调用具有本地调用语义,包括异常处理。

这是Oracle根据我的请求在修补程序中修复的。该补丁的链接在这里。您需要Oracle支持登录才能访问它。

谢谢,但更改此设置并不能解决我的问题。请确保完全取消部署,然后重新部署应用程序。WebLogic历来不善于注意部署描述符的更改重新启动和删除应用程序/清除的缓存,但仍然存在相同的错误。我认为,在您的系统中的某个地方,有一些配置导致了这一错误,因为您看到的行为不符合规范。实际上,我已经与2.1创建了一场简单的战争EJB并部署到具有相同问题的新域。
RuleException
serializable吗?
公共类RuleException extends Exception implements serializable
Exception extends Throwable实现serializable,因此它肯定是可序列化的。同样,在我的测试类中,它没有额外的属性。@andyfinch我们也面临同样的问题,你能告诉我们你是如何解决的吗?@RameshKotha我们有一个与Oracle有关的bug,谢谢@andyfinch我无法查看链接,你能发布内容吗?您好,我很久以来就遇到了同样的问题,但为了访问Oracle解决方案,您需要提供一个支持标识符,您是从哪里获得的?Amira您需要登录才能查看此信息。但是,它描述了12.2.1.2.0的补丁。这将在.3或.4的后续版本中得到修复,因此您可以升级到最新版本吗?@andyfish谢谢您的帮助:),我使用我的Oracle occount登录,但它需要一个支持标识符,我不知道从哪里可以获得它:/@Amira修补程序id是25729346,但是您提到的支持标识符可能是您需要与Oracle签订支持合同。@andyfish非常感谢,我将与Oracle支持团队一起查看:)