-
1. Re: Can ejb's be accessible only through java:comp/env/ejb..
marc.fleury Oct 8, 2001 4:22 PM (in response to bskrypnyk)yes, see documentation
-
2. Re: Can ejb's be accessible only through java:comp/env/ejb..
marc.fleury Oct 8, 2001 4:23 PM (in response to bskrypnyk)I guess I could be more precise, set a relative jndi reference in the ejb-jar.xml there are tons of examples everywhere, including our documentation
-
3. Re: Can ejb's be accessible only through java:comp/env/ejb..
bskrypnyk Oct 9, 2001 2:04 AM (in response to bskrypnyk)I probably wasn't clear in my posting... I understand that I can access my ejbs through relative references -- my question is whether I can restrict ejb access to these ejbs ONLY through these relative references and disallow global JNDI lookups on them.
In example below EJB2 should only be accessed by EJB1 thorugh its java:comp/env/ejb/ context and must be be accessible by an outside client through global JNDI tree. If I use examples in your documentation, EJB2 will stay visible. (Username, password permissions on EJB2 methods do not apply in my case, they must be the same as in EJB1).
<!-- EJB1 part -->
<ejb-name>EJB1</ejb-name>
EJB1Home
EJB1
<ejb-class>EJB1Bean</ejb-class>
<session-type>Stateless</session-type>
<ejb-ref>
<ejb-ref-name>ejb/EJB2</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
EJB2Home
EJB2
<ejb-link>EJB2</ejb-link>
</ejb-ref>
<!-- EJB2 -->
<ejb-name>EJB2</ejb-name>
EJB2Home
EJB2
<ejb-class>EJB2Bean</ejb-class>
<session-type>Stateless</session-type>
Cheers,
--Bill. -
4. Re: Can ejb's be accessible only through java:comp/env/ejb..
bskrypnyk Oct 9, 2001 7:09 PM (in response to bskrypnyk)Please disregard the above posting.
I figured I can hook up a bean in jboss.xml to java: space and make it visible only within jvm. My only question is: how portable such an approach would be? Do other containers support this? -
5. Re: Can ejb's be accessible only through java:comp/env/ejb..
p_d_austin Oct 10, 2001 5:05 AM (in response to bskrypnyk)All J2EE containers must support this. WebLogic has a very similar method to jboss (weblogic-ejb-jar.xml), WebSphere uses a more complex approach but use their application assembley tool to do it via a GUI which is easier.
-
6. Re: Can ejb's be accessible only through java:comp/env/ejb..
p_d_austin Oct 10, 2001 5:48 AM (in response to bskrypnyk)I miss read your last posting about prefixing the jndi name with java: not sure if this works on other platforms.
Paul -
7. Re: Can ejb's be accessible only through java:comp/env/ejb..
erik777 Oct 11, 2001 5:27 PM (in response to bskrypnyk)My problem is different, but involves getting the same basic ejb-jar.xml descriptor to work. I have the following:
<!-- Course EJB -->
<display-name>CourseEJB</display-name>
<ejb-name>CourseEJB</ejb-name>
net.openstandards.tutorial.enroller.CourseHome
net.openstandards.tutorial.enroller.Course
<ejb-class>net.openstandards.tutorial.enroller.CourseBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
False
<ejb-ref>
<ejb-ref-name>ejb/Enroller</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
EnrollerHome
Enroller
<ejb-link>EnrollerEJB</ejb-link>
</ejb-ref>
<security-identity>
<use-caller-identity></use-caller-identity>
</security-identity>
<resource-ref>
MySQL Database
<res-ref-name>jdbc/MySQLDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- Enroller EJB -->
<display-name>EnrollerEJB</display-name>
<ejb-name>EnrollerEJB</ejb-name>
net.openstandards.tutorial.enroller.EnrollerHome
net.openstandards.tutorial.enroller.Enroller
<ejb-class>net.openstandards.tutorial.enroller.EnrollerBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<security-identity>
<use-caller-identity></use-caller-identity>
</security-identity>
<resource-ref>
MySQL Database
<res-ref-name>jdbc/MySQLDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Yet when I try to deploy, I get the following:
[AutoDeployer] org.jboss.deployment.J2eeDeploymentException: Error
...
Cause:org.jboss.ejb.DeploymentException: ejb-ref e
jb/Enroller, expected either ejb-link in ejb-jar.xml or jndi-name in jboss.xml
Can someone please tell me what I am missing. The examples I have had up until now have worked fine, but haven't had an <ejb-ref> tag in them. Also, the ejb-jar.xml I coped this from, the first in the tutorial to use the ejb-ref tag, didn't include an <ejb-link> tag. Yet, as you can see, even with the tag added, it still doesn't work.