Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/379.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.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 新部署后EJB未重新连接_Java_Spring_Ejb_Weblogic_Reconnect - Fatal编程技术网

Java 新部署后EJB未重新连接

Java 新部署后EJB未重新连接,java,spring,ejb,weblogic,reconnect,Java,Spring,Ejb,Weblogic,Reconnect,我们有两个Java应用程序在两个不同的服务器上通过EJB相互通信 EJB在Spring中定义,EJB名称设置为web逻辑中的外部JNDI <bean id="codingRemote" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean"> <property name="jndiName" value="ejb/myEjb" /> <p

我们有两个Java应用程序在两个不同的服务器上通过EJB相互通信

EJB在Spring中定义,EJB名称设置为web逻辑中的外部JNDI

<bean id="codingRemote" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
    <property name="jndiName" value="ejb/myEjb" />
    <property name="businessInterface" value="com.my.ej.binterface" />
    <property name="refreshHomeOnConnectFailure" value="true" />
</bean>

这是客户端日志还是远程服务器日志中的错误?您还设置了
Home>DomainName>安全性
,并在两个域上都选中了
跨域安全性启用
?这将同步两个域上的weblogic用户密码,这样他们就可以在没有您在上面看到的错误的情况下进行对话。错误在服务器上。即使删除了域,也要重新创建它,并在客户端运行时应用跨域设置。我找到了两种可能的解决方案,但我不完全确定哪一种是最好的,以及这样做是否有任何问题。
<Aug 28, 2014 11:20:23 AM CAT> <Warning> <RMI> <WL-080003> <A RuntimeException was generated by the RMI server: weblogic.jndi.internal.AdminRoleBasedDispatchServerRef@9, implementation: 'weblogic.jndi.internal.RootNamingNode@ac24b13', oid: '9', implementationClassName: 'weblogic.jndi.internal.RootNamingNode'
 java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators].
java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]
    at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:833)
    at weblogic.security.service.SecurityServiceManager.getSealedSubjectFromWire(SecurityServiceManager.java:522)
    at weblogic.rjvm.MsgAbbrevInputStream.getSubject(MsgAbbrevInputStream.java:355)
    at weblogic.rmi.internal.BasicServerRef.acceptRequest(BasicServerRef.java:1022)
    at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:350)
    Truncated. see log file for complete stacktrace
<bean id="codingRemote" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
    <property name="jndiName" value="ejb/myEjb" />
    <property name="businessInterface" value="com.my.ej.binterface" />
    <property name="refreshHomeOnConnectFailure" value="true" />
    <property name="jndiTemplate">
        <ref local="myProcessJndiTemplate" />
    </property>
</bean>

<bean id="myProcessJndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">${specify.the.context}</prop>
            <prop key="java.naming.provider.url">${specify.the.url}</prop>
             <prop key="java.naming.security.authentication">none</prop>
        </props>
    </property>
</bean>
public class WebLogicSimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteStatelessSessionProxyFactoryBean {

    @Override protected Object create() throws NamingException, InvocationTargetException {

        try {

            return getJndiTemplate().execute(new JndiCallback() {
                public Object doInContext(final Context context) throws NamingException {
                    try {
                        return WebLogicSimpleRemoteStatelessSessionProxyFactoryBean.super.create();
                    } catch (final InvocationTargetException ite) {
                        throw new RuntimeException(ite);
                    }
                }
            });

        } catch (final RuntimeException re) {

            throw (InvocationTargetException) re.getCause();

        }

    }

    protected void removeSessionBeanInstance(final EJBObject ejbObject) {

        try {

            getJndiTemplate().execute(new JndiCallback() {
                public Object doInContext(final Context context) throws NamingException {
                    WebLogicSimpleRemoteStatelessSessionProxyFactoryBean.super.removeSessionBeanInstance(ejbObject);
                    return null;
                }
            });

        } catch (final NamingException e) {

            throw new RuntimeException(e);

        }

    }

    protected Object doInvoke(final MethodInvocation methodInvocation) throws Throwable {

        try {

            return getJndiTemplate().execute(new JndiCallback() {
                public Object doInContext(final Context context) throws NamingException {
                    try {
                        return WebLogicSimpleRemoteStatelessSessionProxyFactoryBean.super.doInvoke(methodInvocation);
                    } catch (final Throwable t) {
                        if (t instanceof NamingException) {
                            throw (NamingException) t;
                        } else {
                            throw new RuntimeException(t);
                        }
                    }
                }
            });

        } catch (final RuntimeException re) {

            throw re.getCause();

        }

    }

}