Myeclipse6.6+weblogic9.2开发EJB第一个Helloworld程序时出现这个问题:
javax.naming.NameNotFoundException: Unable to resolve 'HelloWorld'. Resolved '' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'HelloWorld'. Resolved '']; remaining name 'HelloWorld'
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(Unknown Source)
at com.ejb.TestEJB.main(TestEJB.java:24) TestEJB客户端程序是:
package com.ejb;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.interfaces.HelloWorldHome; public class TestEJB { /**
* @param args
* @throws NamingException
*/
public static void main(String[] args) throws NamingException {
// TODO Auto-generated method stub
Properties properties=new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL,"t3://localhost:7001");
try{
Context context=new InitialContext(properties);
HelloWorldHome home=(HelloWorldHome)context.lookup("HelloWorld");
HelloWorld hello=(HelloWorld) home.create();
System.out.println(hello.hello());
}
catch(Exception e)
{
e.printStackTrace();
}
javax.naming.NameNotFoundException: Unable to resolve 'HelloWorld'. Resolved '' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'HelloWorld'. Resolved '']; remaining name 'HelloWorld'
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(Unknown Source)
at com.ejb.TestEJB.main(TestEJB.java:24) TestEJB客户端程序是:
package com.ejb;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.interfaces.HelloWorldHome; public class TestEJB { /**
* @param args
* @throws NamingException
*/
public static void main(String[] args) throws NamingException {
// TODO Auto-generated method stub
Properties properties=new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL,"t3://localhost:7001");
try{
Context context=new InitialContext(properties);
HelloWorldHome home=(HelloWorldHome)context.lookup("HelloWorld");
HelloWorld hello=(HelloWorld) home.create();
System.out.println(hello.hello());
}
catch(Exception e)
{
e.printStackTrace();
}
解决方案 »
- input type=file 怎么赋初始值。客户的需求
- 这个s:hidden里面的属性是怎么设值的?
- EJB JAAS
- 请问:目前稳定的且流行的java实现Web Service的方案有哪些?能不能推荐一下?
- Tomcat Security Manager 设置
- EJB 的Jndi获取!!达人来
- eclipse+myeclipse+tomcat调试不通过,急死了,SOS
- 来拿分吧,有谁能介绍个项目我练习练习详情进来再说!好的必散!
- PDF在网页html中该如何控制显示模式
- 问一个mysql事物的问题,麻烦大家帮我解答下
- 如何在Hibernate *.hbm.xml 文件中定义关联查询
- spring中循环次数的问题
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ejb-jar (View Source for full doctype...)>
- <ejb-jar>
- <description>
- <![CDATA[ No Description.
]]>
</description>
<display-name>Generated by XDoclet </display-name>
- <enterprise-beans>
- <!-- Session Beans
-->
- <session>
- <description>
- <![CDATA[
]]>
</description>
<ejb-name>HelloWorld </ejb-name>
<home>com.interfaces.HelloWorldHome </home>
<remote>com.interfaces.HelloWorld </remote>
<local-home>com.interfaces.HelloWorldLocalHome </local-home>
<local>com.interfaces.HelloWorldLocal </local>
<ejb-class>com.ejb.HelloWorldSession </ejb-class>
<session-type>Stateless </session-type>
<transaction-type>Container </transaction-type>
</session>
- <!-- To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session> </session> up for those beans.
-->
- <!-- Entity Beans
-->
- <!-- To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity> </entity> up for those beans.
-->
- <!-- Message Driven Beans
-->
- <!-- To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven> </message-driven> up for those beans.
-->
</enterprise-beans>
- <!-- Relationships
-->
- <!-- Assembly Descriptor
-->
- <!-- To specify your own assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor> </assembly-descriptor> up.
-->
- <assembly-descriptor>
- <!-- To specify additional security-role elements, add a file in the merge
directory called ejb-security-roles.xml that contains them.
-->
- <!-- method permissions
-->
- <!-- To specify additional method-permission elements, add a file in the merge
directory called ejb-method-permissions.ent that contains them.
-->
- <!-- transactions
-->
- <!-- To specify additional container-transaction elements, add a file in the merge
directory called ejb-container-transactions.ent that contains them.
-->
- <!-- finder transactions
-->
- <!-- message destinations
-->
- <!-- To specify additional message-destination elements, add a file in the merge
directory called ejb-message-destinations.ent that contains them.
-->
- <!-- exclude list
-->
- <!-- To specify an exclude-list element, add a file in the merge directory
called ejb-exclude-list.xml that contains it.
-->
</assembly-descriptor>
</ejb-jar>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE weblogic-ejb-jar (View Source for full doctype...)>
- <weblogic-ejb-jar>
- <description>
- <![CDATA[ Generated by XDoclet
]]>
</description>
- <weblogic-enterprise-bean>
<ejb-name>HelloWorld </ejb-name>
<reference-descriptor />
<jndi-name>HelloWorld </jndi-name>
<local-jndi-name>HelloWorldLocal </local-jndi-name>
</weblogic-enterprise-bean>
- <!--
To add enterprise beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called weblogic-enterprise-beans.xml that contains
the <weblogic-enterprise-bean> </weblogic-enterprise-bean> up for those beans. -->
- <!--
To add a security-role-assignment section, add
a file to your XDoclet merge directory called weblogic-security-role-assignment.xml that contains
the <security-role-assignment> </security-role-assignment> up. -->
- <!--
To add a run-as-role-assignment section, add
a file to your XDoclet merge directory called weblogic-run-as-role-assignment.xml that contains
the <run-as-role-assignment> </run-as-role-assignment> up. -->
</weblogic-ejb-jar>