我快疯了,找不出问题,各位帮帮忙。。。。。

JBuilder X 开发一个EJB,我的JBOSS.XML 为:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>Account</ejb-name>
<jndi-name>Account</jndi-name>
</entity>
</enterprise-beans>
</jboss>

当跑到这条语句时出错
Object ref = context.lookup("Account");


错误:

javax.naming.NameNotFoundException: Account not bound

at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)

at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)

at org.jnp.server.NamingServer.getObject(NamingServer.java:509)

at org.jnp.server.NamingServer.lookup(NamingServer.java:282)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)

at sun.rmi.transport.Transport$1.run(Transport.java:148)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:144)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)

at java.lang.Thread.run(Thread.java:534)

at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)

at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)

at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)

at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:500)

at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:479)

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

at accounts.AccountTestClient.initialize(AccountTestClient.java:37)

at accounts.AccountTestClient.<init>(AccountTestClient.java:22)

at accounts.AccountTestClient.main(AccountTestClient.java:558)


明明有定义JNDI 啊,为什么找不到呢,
我把改为
Object ref = context.lookup("java:comp/env/ejb/Account");

还是不行????请教了,


我想把整个文件都放到这里:

zhangzhaoh07tk5cRan8.rar

请支持一下,有空的可以帮我看看,用的是jbuilder x + jboss 3.2.2

lookup("java:comp/env/ejb/Account");

-- Initializing bean access.

javax.ejb.CreateException: javax.naming.NameNotFoundException: OracleDS not bound

你使用EJB designer 看一下你的Account 中的HOME JNDI name的定义
是不是Account

如果是的话就没问题了

lookup 为 Account 即可

你使用EJB designer 看一下你的Account 中的HOME JNDI name的定义
是不是Account???

EJB designer 中怎么看JNDI name啊,这不只有field,method,finder吗??

我改为
lookup("java:comp/env/ejb/Account");
也不行

这是基础问题,买本书看看就可以了。

布署的时候都出错了。。
你没有看Jboss的Log吗?

can you compile answer this question,please?