jboss3.2.1下部署BMP都需要配置哪些文件 ? (救命啊~!)

kucao 2003-08-10 09:45:46
看精通EJB第二版中BMP的例子,试着做了一些但就是不行:
我做了如下部署
ejb-jar.xml

<?xml version="1.0"?>

<!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>
<entity>
<ejb-name>Account</ejb-name>
<home>my.AccountHome</home>
<remote>my.Account</remote>
<local-home>my.AccountLocalHome</local-home>
<local>my.AccountLocal</local>
<ejb-class>my.AccountBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>my.AccountPK</prim-key-class>
<reentrant>False</reentrant>

<resource-ref>
<res-ref-name>java:/MySqlDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>

<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Account</ejb-name>
<method-intf>Local</method-intf>
<method-name>*</method-name>
</method>
<method>
<ejb-name>Account</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

////////////////////////////////////

import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import java.util.*;

public class AccountClient
{

public static void main(String[] args) throws Exception
{

Account account = null;

try
{
Properties p=new Properties();

p.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
p.setProperty("java.naming.provider.url",
"localhost:1099");

//out print jndi配置
p.list(System.out);

Context ctx = new InitialContext(p);
System.out.println("Got context");

// Context ctx = new InitialContext(System.getProperties());

Object obj = ctx.lookup("Account");
AccountHome home = (AccountHome) javax.rmi.PortableRemoteObject.narrow(obj, AccountHome.class);

..............
........

抛出如下错误:

Caught exception!
javax.naming.NameNotFoundException: Account not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
60)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:701)
at java.lang.Thread.run(Thread.java:536)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at my.AccountClient.main(AccountClient.java:34)
Destroying account..

请教各位大侠,到底jboss中的BMP中要配置哪些文件啊 ?
...全文
22 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
snake_eye 2003-10-06
  • 打赏
  • 举报
回复
Jboss-service.xml
记住不是<session>啊!
Teixeira 2003-10-06
  • 打赏
  • 举报
回复
我也遇到同样的问题,!
xiaoyuzi 2003-09-11
  • 打赏
  • 举报
回复
嗯,就是这样子,ejb-jar.xml和jboss.xml就够了
你的问题是jndi没有绑定
bbdeng 2003-08-11
  • 打赏
  • 举报
回复
写一个jboss.xml放在.jar的META-INF文件夹里

<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<enterprise-beans>
<session>
<ejb-name>your ejb-name</ejb-name>
<jndi-name>jndi name</jndi-name>
</session>
</enterprise-beans>
</jboss>

ejb-name定义在ejb-jar.xml中
jndi-name传到context.lookup()里去

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧