JBOSS4.2.2 Spring2.0.8 web中調用EJB異常__web

來源:互聯網
上載者:User

從容器外能夠正常調用EJB,但是web 應用中spring bean調用EJB出現下面異常       <bean id="secuContainerBo"            class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">            <property name="jndiName" value="oss.service.security.business.SecuContainerBo"/>           <property name="businessInterface" value="oss.service.security.business.ISecuContainerBo"/>           <property name="lookupHomeOnStartup" value="false"/>      </bean>

RemoteProxyFailureException: No matching RMI stub method found for: public abstract

從JSP頁面直接調用EJB   <%     Hashtable   hs   =   new   Hashtable();      hs.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");     hs.put("java.naming.provider.url","jnp://localhost:1099");      hs.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");     Context   iniCtx   =   new   InitialContext(hs);     Object   ref   =   iniCtx.lookup("oss.service.security.business.SecuContainerBo");        oss.service.security.business.SecuContainerBoEJBHome     ejbHomeObject   =   (oss.service.security.business.SecuContainerBoEJBHome)   PortableRemoteObject.narrow(ref,   oss.service.security.business.SecuContainerBoEJBHome.class);      out.print((ejbHomeObject.create()).loadAllAuth(new oss.service.security.domain.SysStaffMember()));     %>   java.rmi.ServerException: EJBException:; nested exception is: javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract

 

解決辦法:

1。修改 conf/jboss-service.xml 中NamingService 的CallByValue 參數值為'true'

 <mbean code="org.jboss.naming.NamingService"       name="jboss:service=Naming"       xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">        <!-- The call by value mode. true if all lookups are unmarshalled using          the caller's TCL, false if in VM lookups return the value by reference.       -->       <attribute name="CallByValue">true</attribute>       <!-- The listening port for the bootstrap JNP service. Set this to -1          to run the NamingService without the JNP invoker listening port.       -->

2。修改  deploy/ear-deployer.xml,中的Isloated和CallByValue 為 true

<server>     <!-- EAR deployer, remove if you are not using ear deployments -->    <mbean code="org.jboss.deployment.EARDeployer"       name="jboss.j2ee:service=EARDeployer">       <!-- A flag indicating if ear deployments should have their own scoped       class loader to isolate their classes from other deployments.       -->       <attribute name="Isolated">true</attribute>       <!-- A flag indicating if the ear components should have in VM call       optimization disabled.       -->       <attribute name="CallByValue">true</attribute>       <!-- A flag the enables the default behavior of the ee5 library-directory. If true,       the lib contents of an ear are assumed to be the default value for library-directory       in the absence of an explicit library-directory. If false, there must be an       explicit library-directory.       -->       <attribute name="EnablelibDirectoryByDefault">true</attribute>    </mbean> </server>

3。修改 deploy/jboss-web.deployer/META-INF/jboss-service.xml中的Java2ClassLoadingCompilance 和 UseJbossWebLoader為true

      <!-- Get the flag indicating if the normal Java2 parent first class            loading model should be used over the servlet 2.3 web container first            model.       -->       <attribute name="Java2ClassLoadingCompliance">true</attribute>       <!-- A flag indicating if the JBoss Loader should be used. This loader            uses a unified class loader as the class loader rather than the tomcat            specific class loader.            The default is false to ensure that wars have isolated class loading            for duplicate jars and jsp files.       -->       <attribute name="UseJBossWebLoader">true</attribute>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.