这一段代码应该没有问题,但是ejb开发测试过程中可以出问题的地方太多了。
首先,你看看该SessionBean部署的时候jboss后台有没有报错,即一些exception和error。如果没有的话基本上可以肯定是client端的问题(针对上面的代码而言,因为只要部署没有问题是肯定可以得到远程接口的)
然后,有好几种方法可以查看jndi的绑定情况:1)察看jboss的jmx-console服务http://localhost:8080/jmx-console/index.jsp
2)eclipse有自带的jndi explorer可以查看所有的jndi绑定情况
3)这里当然还可以进程序调试看一看啦。先看一下有没有正常得到Context,如果有的话那就是你的jboss问题,可能没有正常启动,可能就是端口等设置不是正常情况;如果Context没有问题,ejb部署也没有问题,那么就肯定是jndi有问题了,那就仔细检查一下吧
最后,ejb是很搞,有的时候很简单的问题搞半天也不知道什么原因,最要细心拉!祝你好运!!
首先,你看看该SessionBean部署的时候jboss后台有没有报错,即一些exception和error。如果没有的话基本上可以肯定是client端的问题(针对上面的代码而言,因为只要部署没有问题是肯定可以得到远程接口的)
然后,有好几种方法可以查看jndi的绑定情况:1)察看jboss的jmx-console服务http://localhost:8080/jmx-console/index.jsp
2)eclipse有自带的jndi explorer可以查看所有的jndi绑定情况
3)这里当然还可以进程序调试看一看啦。先看一下有没有正常得到Context,如果有的话那就是你的jboss问题,可能没有正常启动,可能就是端口等设置不是正常情况;如果Context没有问题,ejb部署也没有问题,那么就肯定是jndi有问题了,那就仔细检查一下吧
最后,ejb是很搞,有的时候很简单的问题搞半天也不知道什么原因,最要细心拉!祝你好运!!
解决方案 »
- 怎样在filter里进行dispatcher
- 怎么去掉<s:actionerror/>自动生成的html列表
- tomahawk tree2的节点状态保持问题
- 关于调试项目的一个问题
- 高难度问题,高分求解
- 本人现急需一份兼职工作,大家帮帮忙
- 这三种方法获得EJB有何不同?
- javaWebStudio+tomcat+oracle的问题,感激
- 中文URL的问题,谢谢了。
- 有光驱的朋友 ,访问一下这个连接 http://202.114.65.66/~zwxia/cdromeject.jpg,它会将你的光驱自动弹出来??有谁知道这是怎么来实现的
- 请教各位大哥hibernate的问题!顶者有分啊!!!!!!
- 谁来帮帮我呢????
解决方法,放到classpath中,一切OK
1、JNDI Explorer有错误
如下配置:
Service provider=jboss
Initial contex factory=org.jnp.interfaces.NamingContextFactory
Provider URl=jnp://localhost:1099
Additional environment properties:(没有以下信息同样出错)
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=localhost:1099 java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
时出错
The initial context could not be created:
javax.naming.NoInitialContextException:cannot instantiate class:
org.jnp.interfaces.NamingContextFactory[Root exception is java.lang.ClassNotFoundException:....2、getContext()方法可以执行,问题就处在getHome()里。3、
我的jboss从新装了一遍,但一样有错。Eclipse+jboss需要配置jboss吗,java_home、jboss_home、classpath:..\tools.jar的环境变量都有阿,我参考的《Tutorial for building J2EE Applications using JBOSS and ECLIPSE 》,
CartBean右键Lomboz j2ee->Add EJB to module(CartEJB),CartEJB->j2ee Lomboz->Generate EJB class,Lomboz j2ee view中打开artEJB->Jboss3.2.1(右键)->Debug Server(控制台中有错),
console:
WARN [NamingService] Context.PROVIDER_URL in server jndi.properties, url=localhost:1099WARN [MainDeployer] The manifest entry in file:/E:/jboss-3.2.1/server/all/deploy/jboss-net.sar/commons-logging.jar references URL file:/E:/jboss-3.2.1/server/all/deploy/jboss-net.sar/log4j.jar which could not be opened, entry ignoredWARN [MainDeployer] The manifest entry in file:/E:/jboss-3.2.1/server/all/deploy/jboss-net.sar/commons-logging.jar references URL file:/E:/jboss-3.2.1/server/all/deploy/jboss-net.sar/log4j-core.jar which could not be opened, entry ignoredWARN [jbossweb] JSP compilation requires $JAVA_HOME/lib/tools.jar on your JBOSS_CLASSPATHWARN [ServiceController] Problem creating service jboss:service=HAJNDI
java.lang.NoClassDefFoundError: gnu/regexp/UncheckedREERROR [MainDeployer] could not create deployment: file:/E:/jboss-3.2.1/server/all/deploy/CartEJB.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@f82c4421{ url=file:/E:/jboss-3.2.1/server/all/deploy/CartEJB.jar, deployedLastModified=0 }
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.ERROR [URLDeploymentScanner] MBeanException: Exception in MBean operation 'checkIncompleteDeployments()'
Cause: Incomplete Deployment listing:
Packages waiting for a deployer:
<none>
Incompletely deployed packages:
[org.jboss.deployment.DeploymentInfo@f82c4421 { url=file:/E:/jboss-3.2.1/server/all/deploy/CartEJB.jar }
deployer: org.jboss.ejb.EJBDeployer@54cbb9
status: Deployment FAILED reason: Verification of Enterprise Beans failed, see above for error messages.
state: FAILED
watch: file:/E:/jboss-3.2.1/server/all/deploy/CartEJB.jar
lastDeployed: 1089785907607
lastModified: 1089785908000
mbeans:
]MBeans waiting for classes:
<none>
MBeans waiting for other MBeans:
[ObjectName: jboss:service=HAJNDI
state: FAILED
I Depend On: jboss:service=DefaultPartition Depends On Me: java.lang.NoClassDefFoundError: gnu/regexp/UncheckedRE]
CartEJB(右键)->Deploy(应该没什么问题)
ejb-jar:
[jar] Building jar: F:\eclipse2.1\workspace\Cart\CartEJB\META-INF\CartEJB.jardeploy:
[copy] Copying 1 file to E:\jboss-3.2.1\server\all\deploy
java.lang.NoClassDefFoundError: gnu/regexp/UncheckedRE这是jar文件找不到了。既然你说重新装了jboss还是有错,那么你有没有把需要的jar包放到eclipse的java build path里面阿(客户端也有很多jar哦),这些那本书上没有说吗?那本书我也看过,感觉太机械化了。刚开始学ejb最好所有的东西都自己试试看,包括xml编写,ejb打包等等。
我的java build path有:
j2ee.jar,jboss.jar,jbossall-client.jar,jboss-common.jar,jboss-transaction.jar,jnp-client.jar,log4j.jar,mysql-connector-..jar,servlet.jar
当然对于你来说不一定都需要拉。看来还是dropship(飞翔的年代) 说的直接阿! 呵呵
Never give up!
------------------- 我的java build path有:
j2ee.jar,jboss.jar,jbossall-client.jar,jboss-common.jar,jboss-transaction.jar,jnp-client.jar,log4j.jar,mysql-connector-..jar,servlet.jar
---------------------
java build path?不太明白,这些文件是建立j2ee project时加在Libraries里;还是加在环境变量里,classpath?推荐些j2ee方面的资料
能否六个email,[email protected];)太感谢两位大侠了
用户名:javadown
密码:javadown