标题:[求助]有状态会话Bean出现的问题
取消只看楼主
xiaohui84
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-8-13
 问题点数:0 回复次数:1 
[求助]有状态会话Bean出现的问题
我运行客户端测试的时候出现这个提示信息,请问是何意思?
javax.naming.NameNotFoundException: Unable to resolve 'CountHome'. Resolved '' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'CountHome'. Resolved '']; remaining name 'CountHome'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:195)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_920_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:374)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:362)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at examples.CountClient.main(CountClient.java:19)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'CountHome'. Resolved ''
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403)
at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56)
at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
搜索更多相关主题的帖子: Bean 状态 会话 cluster java 
2006-12-19 14:39
xiaohui84
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-8-13
得分:0 

我做的是精通EJB(第三版)里面的例子,开发平台是JB2006+weblogic9.0
远程接口
package examples;

import javax.ejb.*;
import java.rmi.RemoteException;

public interface Count extends EJBObject {
public int count() throws RemoteException;
}

Bean类
package examples;

import javax.ejb.*;

public class CountBean implements SessionBean {
public int val;
public int count() {
System.out.println("count()");
return++val;
}

public void ejbCreate(int val) throws CreateException {
this.val = val;
System.out.println("ejbCreate()");
}

public void ejbRemove() {
System.out.println("ejbRemove()");
}

public void ejbActivate() {
System.out.println("ejbActivate()");
}

public void ejbPassivate() {
System.out.println("ejbPassivate()");
}

public void setSessionContext(SessionContext ctx) {
System.out.println("setSessionContext()");
}
}

Home接口
package examples;

import javax.ejb.*;
import java.rmi.RemoteException;

public interface CountHome extends EJBHome {
Count create(int val) throws RemoteException, CreateException;
}


weblogic-ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<weblogic-enterprise-bean>
<ejb-name>Count</ejb-name>
<jndi-name>CountHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>

ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
<display-name>EJBModule1</display-name>
<enterprise-beans>
<session>
<ejb-name>Count</ejb-name>
<home>examples.CountHome</home>
<remote>examples.Count</remote>
<ejb-class>examples.CountBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>



2006-12-19 15:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-110569-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.602865 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved