[100]在oralcle application server10g中deploy CMP ejb成功,但在用java client调用时老是报如下错误:

zsq666 2004-08-11 05:43:57
client调用程序如下:
  package cc.mypackage;
import java.security.Permission;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import cc.mypackage.Aa11;
import cc.mypackage.Aa11Home;
import java.util.Collection;
import java.util.Iterator;
import javax.naming.NamingException;
import java.util.Hashtable;

public class Aa11Client
{
public static void main(String [] args)
{

Aa11Client aa11Client = new Aa11Client();
try
{
Context context = getInitialContext();


Aa11Home aa11Home = (Aa11Home)PortableRemoteObject.narrow(context.lookup("Aa11"), Aa11Home.class);
Aa11 aa11;

// Use one of the create() methods below to create a new instance
// aa11 = aa11Home.create( );
// aa11 = aa11Home.create( java.lang.String shancbz, java.lang.String xiwbz );

// Call any of the Remote methods below to access the EJB
// aa11.setXiwbz( java.lang.String xiwbz );
// aa11.getXiwbz( );
// aa11.getShancbz( );

// Retrieve all instances using the findAll() method
// (CMP Entity beans only)
Collection coll = aa11Home.findAll();
Iterator iter = coll.iterator();
while (iter.hasNext())
{
aa11 = (Aa11)iter.next();
System.out.println("shancbz = " + aa11.getShancbz());
System.out.println("xiwbz = " + aa11.getXiwbz());
System.out.println();
}
}
catch(Throwable ex)
{
ex.printStackTrace();
}

}

private static Context getInitialContext() throws NamingException
{

Hashtable env = new Hashtable();
// Oracle Application Server 10g connection details
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
env.put(Context.PROVIDER_URL, "ormi://zhangxj:23791/ejb1");

return new InitialContext(env);
}
}
...全文
106 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jimoren 2004-08-17
  • 打赏
  • 举报
回复
同意此人:
回复人: yeshucheng(叶澍成)
fwp0794 2004-08-12
  • 打赏
  • 举报
回复
也有可能是数据的并发连接数,以到最大了。
朋友别哭 2004-08-12
  • 打赏
  • 举报
回复
up
yeshucheng 2004-08-12
  • 打赏
  • 举报
回复
JNDI没有定位到(没有找到你相应的JNDI名称)
朋友别哭 2004-08-11
  • 打赏
  • 举报
回复
up
zsq666 2004-08-11
  • 打赏
  • 举报
回复
报错如下:
  D:\jdev9052\jdk\bin\javaw.exe -ojvm -classpath E:\Application1\Project\classes;D:\jdev9052\j2ee\home\lib\activation.jar;D:\jdev9052\j2ee\home\lib\ejb.jar;D:\jdev9052\j2ee\home\lib\jaas.jar;D:\jdev9052\j2ee\home\lib\jaxp.jar;D:\jdev9052\j2ee\home\lib\jcert.jar;D:\jdev9052\j2ee\home\lib\jdbc.jar;D:\jdev9052\j2ee\home\lib\jms.jar;D:\jdev9052\j2ee\home\lib\jndi.jar;D:\jdev9052\j2ee\home\lib\jnet.jar;D:\jdev9052\j2ee\home\lib\jsse.jar;D:\jdev9052\j2ee\home\lib\jta.jar;D:\jdev9052\j2ee\home\lib\mail.jar;D:\jdev9052\j2ee\home\lib\servlet.jar;D:\jdev9052\j2ee\home\oc4j.jar;D:\jdev9052\opmn\lib\optic.jar;D:\jdev9052\lib\xmlparserv2.jar;D:\jdev9052\lib\xmlcomp.jar cc.mypackage.Aa11Client
javax.naming.NamingException: Lookup error: java.net.ConnectException: Connection refused: connect; nested exception is:
java.net.ConnectException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]

at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:153)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at cc.mypackage.Aa11Client.main(Aa11Client.java:25)

Caused by: java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

at java.net.Socket.connect(Socket.java:452)

at java.net.Socket.connect(Socket.java:402)

at java.net.Socket.<init>(Socket.java:309)

at java.net.Socket.<init>(Socket.java:153)

at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java:2216)

at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.java:1692)

at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:678)

at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:134)

... 2 more

Process exited with exit code 0.
-- 首先,以超级管理员的身份登录oracle sqlplus sys/bjsxt as sysdba --然后,解除对scott用户的锁 alter user scott account unlock; --那么这个用户名就能使用了。 --(默认全局数据库名orcl) 1、select ename, sal * 12 from emp; --计算年薪 2、select 2*3 from dual; --计算一个比较纯的数据用dual表 3、select sysdate from dual; --查看当前的系统间 4、select ename, sal*12 anuual_sal from emp; --给搜索字段更改名称(双引号 keepFormat 别名有特殊字符,要加双引号)。 5、--任何含有空值的数学表达式,最后的计算结果都是空值。 6、select ename||sal from emp; --(将sal的查询结果转化为字符串,与ename连接到一起,相当于Java的字符串连接) 7、select ename||'afasjkj' from emp; --字符串的连接 8、select distinct deptno from emp; --消除deptno字段重复的值 9、select distinct deptno , job from emp; --将与这两个字段都重复的值去掉 10、select * from emp where deptno=10; --(条件过滤查询) 11、select * from emp where empno > 10; --大于 过滤判断 12、select * from emp where empno 10 --不等于 过滤判断 13、select * from emp where ename > 'cba'; --字符串比较,实际上比较的是每个字符的AscII值,与在Java字符串的比较是一样的 14、select ename, sal from emp where sal between 800 and 1500; --(between and过滤,包含800 1500) 15、select ename, sal, comm from emp where comm is null; --(选择comm字段为null的数据) 16、select ename, sal, comm from emp where comm is not null; --(选择comm字段不为null的数据) 17、select ename, sal, comm from emp where sal in (800, 1500,2000); --(in 表范围) 18、select ename, sal, hiredate from emp where hiredate > '02-2月-1981'; --(只能按照规定的格式写) 19、select ename, sal from emp where deptno =10 or sal >1000; 20、select ename, sal from emp where deptno =10 and sal >1000; 21、select ename, sal, comm from emp where sal not in (800, 1500,2000); --(可以对in指定的条件进行取反) 22、select ename from emp where ename like '%ALL%'; --(模糊查询) 23、select ename from emp where ename like '_A%'; --(取第二个字母是A的所有字段) 24、select ename from emp where ename like '%/%%'; --(用转义字符/查询字段本身就带%字段的) 25、select ename from emp where ename like '%$%%' escape '$'; --(用转义字符/查询字段本身就带%字段的) 26、select * from dept order by deptno desc; (使用order by desc字段 对数据进行降序排列 默认为升序asc); 27、sel

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧