謝謝大家!
17 个解决方案
#1
這是ejb-jar.xml中的片段:
<session>
<description>Session Bean ( Stateless )</description>
<display-name>UserSession</display-name>
<ejb-name>UserSession</ejb-name>
<home>com.fiti.ejb.UserSessionHome</home>
<remote>com.fiti.ejb.UserSession</remote>
<local-home>com.fiti.ejb.UserSessionLocalHome</local-home>
<local>com.fiti.ejb.UserSessionLocal</local>
<ejb-class>com.fiti.ejb.UserSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/Userentity</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.fiti.ejb.UserentityHome</home>
<remote>com.fiti.ejb.Userentity</remote>
<ejb-link>Userentity</ejb-link>
</ejb-ref>
</session>
哪個是設定jndi的屬性?
怎麼呼叫啊?lookup("java:comp/env/ejb/UserSessionBean");
<session>
<description>Session Bean ( Stateless )</description>
<display-name>UserSession</display-name>
<ejb-name>UserSession</ejb-name>
<home>com.fiti.ejb.UserSessionHome</home>
<remote>com.fiti.ejb.UserSession</remote>
<local-home>com.fiti.ejb.UserSessionLocalHome</local-home>
<local>com.fiti.ejb.UserSessionLocal</local>
<ejb-class>com.fiti.ejb.UserSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/Userentity</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.fiti.ejb.UserentityHome</home>
<remote>com.fiti.ejb.Userentity</remote>
<ejb-link>Userentity</ejb-link>
</ejb-ref>
</session>
哪個是設定jndi的屬性?
怎麼呼叫啊?lookup("java:comp/env/ejb/UserSessionBean");
#2
還有啊,上面的問題是不是和具體的開發和運行環境有關? 多謝大家!
#3
up!
#4
首先应该选个运行环境把,
用weblogic的话,jndi名字是在weblogic-ejb-jar.xml中的,不在ejb-jar.xml
用weblogic的话,jndi名字是在weblogic-ejb-jar.xml中的,不在ejb-jar.xml
#5
是的,与具体的产品有关系。
一般在****-ejb-jar.xml中。
一般在****-ejb-jar.xml中。
#6
lookup("java:comp/env/ejb/UserSessionBean");
java:comp/env/這一句是身麼意思?
java:comp/env/這一句是身麼意思?
#7
用的什么开发工具?在JBuilder中有图形化界面可以设定。
客户端通过这个JNDI名查找Home接口
客户端通过这个JNDI名查找Home接口
#8
lookup("java:comp/env/ejb/UserSessionBean");
java:comp/env/這一句是身麼意思?
----------------------------------------------
这应该是书上的例程,被楼主一并抄了上来
java:comp/env/這一句是身麼意思?
----------------------------------------------
这应该是书上的例程,被楼主一并抄了上来
#9
我这边有jboss配置,打包到ejb中
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the <session></session>, <entity></entity> and <message-driven></message-driven>
markup for those beans.
-->
<entity>
<ejb-name>Product</ejb-name>
<jndi-name>ProductBean</jndi-name>
<local-jndi-name>ProductLocal</local-jndi-name>
</entity>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the <session></session>, <entity></entity> and <message-driven></message-driven>
markup for those beans.
-->
<entity>
<ejb-name>Product</ejb-name>
<jndi-name>ProductBean</jndi-name>
<local-jndi-name>ProductLocal</local-jndi-name>
</entity>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
#10
用weblogic的话,jndi名字是在config.xml中
#11
假設JNDI的名字是ProductBean 那麼呼叫的時候就應該是:lookup("ProductBean")?
還是lookup("ejb/ProductBean")?
還是lookup("ejb/ProductBean")?
#12
還有JNDI location 是做身麼的?
#13
lookup("ProductBean")
#14
orion-ejb-jar.xml的文件(我用的開發工具是jDeveloper):
大家給看看怎麼配,然後在客戶端怎麼調用?謝謝了!小弟實在愚昧
<?xml version = '1.0' encoding = 'Big5'?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
<orion-ejb-jar>
<enterprise-beans>
<session-deployment name="UserSession" location="UserSessionBean"/>
<entity-deployment name="Userentity" data-source="jdbc/oraldb1DS" table="SCOTT.USERENTITY" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="username" persistence-name="USERNAME" persistence-type="VARCHAR2(12)"/>
<cmp-field-mapping name="password" persistence-name="PASSWORD" persistence-type="VARCHAR2(26)"/>
</entity-deployment>
<entity-deployment name="Supplier" data-source="jdbc/oraldb1DS" table="SCOTT.SUPPLIER" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="name" persistence-name="NAME" persistence-type="VARCHAR2(30)"/>
<cmp-field-mapping name="email" persistence-name="EMAIL" persistence-type="VARCHAR2(40)"/>
</entity-deployment>
</enterprise-beans>
</orion-ejb-jar>
大家給看看怎麼配,然後在客戶端怎麼調用?謝謝了!小弟實在愚昧
<?xml version = '1.0' encoding = 'Big5'?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
<orion-ejb-jar>
<enterprise-beans>
<session-deployment name="UserSession" location="UserSessionBean"/>
<entity-deployment name="Userentity" data-source="jdbc/oraldb1DS" table="SCOTT.USERENTITY" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="username" persistence-name="USERNAME" persistence-type="VARCHAR2(12)"/>
<cmp-field-mapping name="password" persistence-name="PASSWORD" persistence-type="VARCHAR2(26)"/>
</entity-deployment>
<entity-deployment name="Supplier" data-source="jdbc/oraldb1DS" table="SCOTT.SUPPLIER" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="name" persistence-name="NAME" persistence-type="VARCHAR2(30)"/>
<cmp-field-mapping name="email" persistence-name="EMAIL" persistence-type="VARCHAR2(40)"/>
</entity-deployment>
</enterprise-beans>
</orion-ejb-jar>
#15
up
#16
up
#17
我也用JDeveloper,交个朋友
10204315
10204315
#1
這是ejb-jar.xml中的片段:
<session>
<description>Session Bean ( Stateless )</description>
<display-name>UserSession</display-name>
<ejb-name>UserSession</ejb-name>
<home>com.fiti.ejb.UserSessionHome</home>
<remote>com.fiti.ejb.UserSession</remote>
<local-home>com.fiti.ejb.UserSessionLocalHome</local-home>
<local>com.fiti.ejb.UserSessionLocal</local>
<ejb-class>com.fiti.ejb.UserSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/Userentity</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.fiti.ejb.UserentityHome</home>
<remote>com.fiti.ejb.Userentity</remote>
<ejb-link>Userentity</ejb-link>
</ejb-ref>
</session>
哪個是設定jndi的屬性?
怎麼呼叫啊?lookup("java:comp/env/ejb/UserSessionBean");
<session>
<description>Session Bean ( Stateless )</description>
<display-name>UserSession</display-name>
<ejb-name>UserSession</ejb-name>
<home>com.fiti.ejb.UserSessionHome</home>
<remote>com.fiti.ejb.UserSession</remote>
<local-home>com.fiti.ejb.UserSessionLocalHome</local-home>
<local>com.fiti.ejb.UserSessionLocal</local>
<ejb-class>com.fiti.ejb.UserSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/Userentity</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.fiti.ejb.UserentityHome</home>
<remote>com.fiti.ejb.Userentity</remote>
<ejb-link>Userentity</ejb-link>
</ejb-ref>
</session>
哪個是設定jndi的屬性?
怎麼呼叫啊?lookup("java:comp/env/ejb/UserSessionBean");
#2
還有啊,上面的問題是不是和具體的開發和運行環境有關? 多謝大家!
#3
up!
#4
首先应该选个运行环境把,
用weblogic的话,jndi名字是在weblogic-ejb-jar.xml中的,不在ejb-jar.xml
用weblogic的话,jndi名字是在weblogic-ejb-jar.xml中的,不在ejb-jar.xml
#5
是的,与具体的产品有关系。
一般在****-ejb-jar.xml中。
一般在****-ejb-jar.xml中。
#6
lookup("java:comp/env/ejb/UserSessionBean");
java:comp/env/這一句是身麼意思?
java:comp/env/這一句是身麼意思?
#7
用的什么开发工具?在JBuilder中有图形化界面可以设定。
客户端通过这个JNDI名查找Home接口
客户端通过这个JNDI名查找Home接口
#8
lookup("java:comp/env/ejb/UserSessionBean");
java:comp/env/這一句是身麼意思?
----------------------------------------------
这应该是书上的例程,被楼主一并抄了上来
java:comp/env/這一句是身麼意思?
----------------------------------------------
这应该是书上的例程,被楼主一并抄了上来
#9
我这边有jboss配置,打包到ejb中
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the <session></session>, <entity></entity> and <message-driven></message-driven>
markup for those beans.
-->
<entity>
<ejb-name>Product</ejb-name>
<jndi-name>ProductBean</jndi-name>
<local-jndi-name>ProductLocal</local-jndi-name>
</entity>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the <session></session>, <entity></entity> and <message-driven></message-driven>
markup for those beans.
-->
<entity>
<ejb-name>Product</ejb-name>
<jndi-name>ProductBean</jndi-name>
<local-jndi-name>ProductLocal</local-jndi-name>
</entity>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
#10
用weblogic的话,jndi名字是在config.xml中
#11
假設JNDI的名字是ProductBean 那麼呼叫的時候就應該是:lookup("ProductBean")?
還是lookup("ejb/ProductBean")?
還是lookup("ejb/ProductBean")?
#12
還有JNDI location 是做身麼的?
#13
lookup("ProductBean")
#14
orion-ejb-jar.xml的文件(我用的開發工具是jDeveloper):
大家給看看怎麼配,然後在客戶端怎麼調用?謝謝了!小弟實在愚昧
<?xml version = '1.0' encoding = 'Big5'?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
<orion-ejb-jar>
<enterprise-beans>
<session-deployment name="UserSession" location="UserSessionBean"/>
<entity-deployment name="Userentity" data-source="jdbc/oraldb1DS" table="SCOTT.USERENTITY" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="username" persistence-name="USERNAME" persistence-type="VARCHAR2(12)"/>
<cmp-field-mapping name="password" persistence-name="PASSWORD" persistence-type="VARCHAR2(26)"/>
</entity-deployment>
<entity-deployment name="Supplier" data-source="jdbc/oraldb1DS" table="SCOTT.SUPPLIER" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="name" persistence-name="NAME" persistence-type="VARCHAR2(30)"/>
<cmp-field-mapping name="email" persistence-name="EMAIL" persistence-type="VARCHAR2(40)"/>
</entity-deployment>
</enterprise-beans>
</orion-ejb-jar>
大家給看看怎麼配,然後在客戶端怎麼調用?謝謝了!小弟實在愚昧
<?xml version = '1.0' encoding = 'Big5'?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
<orion-ejb-jar>
<enterprise-beans>
<session-deployment name="UserSession" location="UserSessionBean"/>
<entity-deployment name="Userentity" data-source="jdbc/oraldb1DS" table="SCOTT.USERENTITY" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="userid" persistence-name="USERID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="username" persistence-name="USERNAME" persistence-type="VARCHAR2(12)"/>
<cmp-field-mapping name="password" persistence-name="PASSWORD" persistence-type="VARCHAR2(26)"/>
</entity-deployment>
<entity-deployment name="Supplier" data-source="jdbc/oraldb1DS" table="SCOTT.SUPPLIER" copy-by-value="false" exclusive-write-access="false">
<primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
</primkey-mapping>
<cmp-field-mapping name="id" persistence-name="ID" persistence-type="NUMBER(22)"/>
<cmp-field-mapping name="name" persistence-name="NAME" persistence-type="VARCHAR2(30)"/>
<cmp-field-mapping name="email" persistence-name="EMAIL" persistence-type="VARCHAR2(40)"/>
</entity-deployment>
</enterprise-beans>
</orion-ejb-jar>
#15
up
#16
up
#17
我也用JDeveloper,交个朋友
10204315
10204315