javax.naming.NameNotFoundException [英] javax.naming.NameNotFoundException

查看:124
本文介绍了javax.naming.NameNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JBoss5 Container运行ejb示例。我正在使用示例
从这里(第一部分)

在示例中,我在JBoss中部署了bean,在Tomcat中部署了一个应用程序(从JBoss访问bean)。我在tomcat服务器的屏幕上收到错误

javax.naming.NameNotFoundException:greetJndi未绑定

I am running an example of ejb using JBoss5 Container. I am using an example from here(Part one).
In the example I deployed bean in JBoss and an application in Tomcat(to acces the bean from JBoss). I am getting the error in the screen of tomcat server
javax.naming.NameNotFoundException: greetJndi not bound

(greetJndi是jboss.xml文件中的jndi-name)
是否有任何特定的目录结构要在JBoss中部署?

( greetJndi is the jndi-name in jboss.xml file ) Is there any specific directory structure to deploy in JBoss?

谢谢

推荐答案


我收到错误(...)javax.naming.NameNotFoundException:greetJndi未绑定

I am getting the error (...) javax.naming.NameNotFoundException: greetJndi not bound

这意味着没有任何东西绑定到jndi名称 greetJndi ,很可能是因为鉴于本教程的极低质量(检查服务器日志),部署问题。我将回过头来看看。

This means that nothing is bound to the jndi name greetJndi, very likely because of a deployment problem given the incredibly low quality of this tutorial (check the server logs). I'll come back on this.


是否有任何特定的目录结构要在JBoss中部署?

Is there any specific directory structure to deploy in JBoss?

ejb-jar 的内部结构应该是这样的(使用糟糕的命名约定以及上述链接中的默认包

The internal structure of the ejb-jar is supposed to be like this (using the poor naming conventions and the default package as in the mentioned link):


.
├── greetBean.java
├── greetHome.java
├── greetRemote.java
└── META-INF
    ├── ejb-jar.xml
    └── jboss.xml

但如前所述,本教程充满了错误:

But as already mentioned, this tutorial is full of mistakes:


  • 还有一个额外字符(< enterprise-beans>] < - HERE)在 ejb-jar.xml (!)

  • PUBLIC ejb-jar.xml jboss.xml (!!)

  • jboss.xml 不正确,它应包含 session 元素而不是实体(!!!)

  • there is an extra character (<enterprise-beans>] <-- HERE) in the ejb-jar.xml (!)
  • a space is missing after PUBLIC in the ejb-jar.xml and jboss.xml (!!)
  • the jboss.xml is incorrect, it should contain a session element instead of entity (!!!)

这是<$ c的固定版本$ c> 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>
  <enterprise-beans>
    <session>
      <ejb-name>greetBean</ejb-name>
      <home>greetHome</home>
      <remote>greetRemote</remote>
      <ejb-class>greetBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>
</ejb-jar>

jboss.xml

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

执行这些更改并重新打包ejb-jar后,我能够成功部署它:

After doing these changes and repackaging the ejb-jar, I was able to successfully deploy it:


21:48:06,512 INFO  [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@5060868{vfszip:/home/pascal/opt/jboss-5.1.0.GA/server/default/deploy/greet.jar/}
21:48:06,534 INFO  [EjbDeployer] installing bean: ejb/#greetBean,uid19981448
21:48:06,534 INFO  [EjbDeployer]   with dependencies:
21:48:06,534 INFO  [EjbDeployer]   and supplies:
21:48:06,534 INFO  [EjbDeployer]    jndi:greetJndi
21:48:06,624 INFO  [EjbModule] Deploying greetBean
21:48:06,661 WARN  [EjbModule] EJB configured to bypass security. Please verify if this is intended. Bean=greetBean Deployment=vfszip:/home/pascal/opt/jboss-5.1.0.GA/server/default/deploy/greet.jar/
21:48:06,805 INFO  [ProxyFactory] Bound EJB Home 'greetBean' to jndi 'greetJndi'

该教程需要重大改进;我建议远离roseindia.net。

That tutorial needs significant improvement; I'd advise from staying away from roseindia.net.

这篇关于javax.naming.NameNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆