在bin目录下有目录结构如下:
bin\j2ee_test\ejb\ebean\
\sbean\
在ebean目录下做了一个的Entity Bean的例子程序NodeBean(此时还没有建sbean目录)。打包为Node.jar部署到jboss后,运行成功。
然后再新建了sbean目录,在目录下新做了一个Session bean的例子程序CalculatorBean。在原来的基础上修改了ejb-jar.xml和jboss.xml,打包为Calculator.jar,在 \jboss\server\default\deploy目录下删除以前部署的Node.jar, 将Calculator.jar拷贝到 \jboss\server\default\deploy下,启动jboss,报错如下:
...
2004-11-16 23:10:32,000 INFO [org.jboss.naming.NamingService] Starting jnp server
2004-11-16 23:10:32,062 ERROR [org.jboss.naming.NamingService] Starting failed
java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Address already in use: JVM_Bind
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:243)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:178)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
...
Caused by: java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331)
at java.net.ServerSocket.bind(ServerSocket.java:318)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.jboss.net.sockets.DefaultSocketFactory.createServerSocket(DefaultSocketFactory.java:79)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:615)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:231)
... 46 more
...
org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NameNotFoundException: comp not bound)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:440)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
...
这是什么意思呢? 应该如何解决?
ejb-jar.xml和jboss.xml的具体内容如下:
1、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 >
<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session>
<description><![CDATA[CalculatorBean]]></description>
<display-name>CalculatorBean</display-name>
<ejb-name>Calculator</ejb-name>
<home>j2ee_test.ejb.sbean.CalculatorHome</home>
<remote>j2ee_test.ejb.sbean.Calculator</remote>