当前位置: 技术问答>java相关
编译一个EJB小问题。
来源: 互联网 发布时间:2015-10-13
本文导语: 配置好weblogic7.0 和jbuilder7.0 服务器以后。 我创建了一个EJBbean 添加一个方法getTime 然后创建一个EJB test client.捕捉这个方法以后,编译出想以下错误。 C:beajdk131_02binjavaw -classpath "C:jbProjectyawen1classes;C:beaweblogic700server...
配置好weblogic7.0 和jbuilder7.0 服务器以后。
我创建了一个EJBbean 添加一个方法getTime
然后创建一个EJB test client.捕捉这个方法以后,编译出想以下错误。
C:beajdk131_02binjavaw -classpath "C:jbProjectyawen1classes;C:beaweblogic700serverlibweblogic.jar;C:beaweblogic700serverlibweblogic_sp.jar;C:beajdk131_02jrelibi18n.jar;C:beajdk131_02jrelibjaws.jar;C:beajdk131_02jrelibrt.jar;C:beajdk131_02jrelibsunrsasign.jar;C:beajdk131_02libdt.jar;C:beajdk131_02libhtmlconverter.jar;C:beajdk131_02libtools.jar" yawen1.TimeFunctionsTestClient1
-- Initializing bean access.
javax.naming.NameNotFoundException: Unable to resolve 'TimeFunctions' Resolved: '' Unresolved:'TimeFunctions' ; remaining name 'TimeFunctions'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)-- Failed initializing bean access.
//初始化访问权失败 ??
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at yawen1.TimeFunctionsTestClient1.(TimeFunctionsTestClient1.java:27)
at yawen1.TimeFunctionsTestClient1.main(TimeFunctionsTestClient1.java:155)
java.lang.NullPointerException
at yawen1.TimeFunctionsTestClient1.create(TimeFunctionsTestClient1.java:79)
at yawen1.TimeFunctionsTestClient1.main(TimeFunctionsTestClient1.java:161)
-- Calling create()
-- Failed: create(); //不能创建?
-- Return value from create(): null.
Error in getTime(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.
请指点,菜鸟上。
我创建了一个EJBbean 添加一个方法getTime
然后创建一个EJB test client.捕捉这个方法以后,编译出想以下错误。
C:beajdk131_02binjavaw -classpath "C:jbProjectyawen1classes;C:beaweblogic700serverlibweblogic.jar;C:beaweblogic700serverlibweblogic_sp.jar;C:beajdk131_02jrelibi18n.jar;C:beajdk131_02jrelibjaws.jar;C:beajdk131_02jrelibrt.jar;C:beajdk131_02jrelibsunrsasign.jar;C:beajdk131_02libdt.jar;C:beajdk131_02libhtmlconverter.jar;C:beajdk131_02libtools.jar" yawen1.TimeFunctionsTestClient1
-- Initializing bean access.
javax.naming.NameNotFoundException: Unable to resolve 'TimeFunctions' Resolved: '' Unresolved:'TimeFunctions' ; remaining name 'TimeFunctions'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)-- Failed initializing bean access.
//初始化访问权失败 ??
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at yawen1.TimeFunctionsTestClient1.(TimeFunctionsTestClient1.java:27)
at yawen1.TimeFunctionsTestClient1.main(TimeFunctionsTestClient1.java:155)
java.lang.NullPointerException
at yawen1.TimeFunctionsTestClient1.create(TimeFunctionsTestClient1.java:79)
at yawen1.TimeFunctionsTestClient1.main(TimeFunctionsTestClient1.java:161)
-- Calling create()
-- Failed: create(); //不能创建?
-- Return value from create(): null.
Error in getTime(): Remote interface reference is null. It must be created by calling one of the Home interface methods first.
请指点,菜鸟上。
|
很明显,这个可能是你发布的时候出问题了;对jbuild而言,对同一个ejb,你只能deploy一次,如果有改动,你需要把jbuild生成的你的xxxejb.jar删除,然后,你需要redeploy,而不是deploy.
当然你定义的方法需要是remote
当然你定义的方法需要是remote