| 发表于:2007-08-21 04:05:23 楼主 |
jboss 4.0.4上运行ejb3+jsf的工程。 ejb部分分层为:实体bean,dao和manager,jsf分层为backing bean和展示层。 在manager层有interface entitymanager,并entitymanagerbean实现他,在entitymanagerbean中通过 @ejb注入dao,manager层则通过storeobject(object)--> dao.storeobject(object)完成中间的过度操作 ,dao中用函数storeobject(object){em.persist()}持久化对象。 具体有定义一个stateless的bean, @stateless @remote({employeemanager.class}) @local({employeemanager.class}) public class employeemanagerbean implements employeemanager { 在jsf的backing bean层,通过lookup查找jndi。 employeemanager em = (employeemanager)ctx.lookup( "log/employeemanagerbean/remote ");可以确定 的是,这个查找已经成功返回了。 但问题出现了, 当我用通过查找并cast的employeemanager em来em.storeobject()会出现异常: caused by: java.lang.classcastexception: org.jboss.remoting.invokerlocator at org.jboss.aspects.remoting.invokeremoteinterceptor.invoke (invokeremoteinterceptor.java:47) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:101) at org.jboss.aspects.tx.clienttxpropagationinterceptor.invoke (clienttxpropagationinterceptor.java:61) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:101) at org.jboss.aspects.security.securityclientinterceptor.invoke (securityclientinterceptor.java:55) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:101) at org.jboss.ejb3.remoting.islocalinterceptor.invoke(islocalinterceptor.java:65) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:101) at org.jboss.ejb3.stateless.statelessremoteproxy.invoke (statelessremoteproxy.java:102) at $proxy311.storeobject(unknown source) 花了很多时间去google,大都讲到和class loader相关。但,试的结果都还不行。 在http://www.jboss.org/index.html? module=bb&op=viewtopic&t=101108&postdays=0&postorder=asc&start=0上,有这样的回答: you probably have a classloader issue. looks like the code that does the casting is in a servlet. you do not, by any chance, have the aplentityfacade class in both the ejb jar file and in a jar file (or in the classes directory) in your war file? 还有: peter- nice catch... that was indeed the problem. i forgot about that whole "class identity = class + classloader " thing, and was lazy about how i had configured ant. there are also some useful wiki pages on this and other potential classloader issues: http://wiki.jboss.org/wiki/wiki.jsp?page=classloadingoverview 因为对jboss刚接触不久,对于上面的e文理解不透彻?希望达人帮下忙,我要怎样解决呢? |
|
|
|
|