Your client xml has an error, you have to use the same jndi name as you set
up in your ejb-jar.xml, see under.
<ejb-ref>
<ejb-ref-name>Stamp</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>stamp.ejb.StampHome</home>
<remote>stamp.ejb.Stamp</remote>
</ejb-ref>
If this dont work, you have to add your application to the classpath of the
webapplication.
Klaus Myrseth
Telenor Mobil AS
-----Opprinnelig melding-----
Fra: z2211829 [mailto:[EMAIL PROTECTED]]
Sendt: 18. september 2000 09:57
Til: Orion-Interest
Emne:
Hi all,
I have a urgent problem regarding EJB and servlet, I cannot find the
home interface of the bean from the servlet (whereas a standalone
client works very well)...Can anyone pls give me some hint as to what
maybe be wrong here? Below is the background info, sorry, it is kind
of long...
My bean is called Stamp, the classes are
stamp.ejb.Stamp - remote
stamp.ejb.StampHome - home
stamp.ejb.StampBean - bean class
java.lang.String - primaryKey
There are two applications deployed.
stamps - the EJBs
test - the servlets.
My problem, I CANNOT get the bean in servlet :((
Here is my ejb-jar.xml
<ejb-jar>
<description></description>
<enterprise-beans>
<entity>
<description></description>
<ejb-name>Stamp</ejb-name>
<home>stamp.ejb.StampHome</home>
<remote>stamp.ejb.Stamp</remote>
<ejb-class>stamp.ejb.StampBean</ejb-class>
<primkey-class>java.lang.String</primkey-
class>
<reentrant>True</reentrant>
<persistence-type>Bean</persistence-type>
</entity>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<description>Users</description>
<role-name>users</role-name>
</security-role>
<method-permission>
<description>Restricted</description>
<role-name>users</role-name>
<method>
<ejb-name>Stamp</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
</assembly-descriptor>
</ejb-jar>
It works when I used standalone client, having this..
<application-client>
<display-name>Stamp</display-name>
<description>Example Bank</description>
<ejb-ref>
<ejb-ref-name>StampHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>stamp.ejb.StampHome</home>
<remote>stamp.ejb.Stamp</remote>
</ejb-ref>
</application-client>
However, it doesn't work when using servlets, I have this..
<web-app>
<display-name>Testing app</display-name>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<description>Servlet that calls the Stamp bean</description>
<servlet-class>vc.web.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<!--
<ejb-ref>
<ejb-ref-name>Stamp</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>stamp.ejb.StampHome</home>
<remote>stamp.ejb.Stamp</remote>
</ejb-ref>
-->
</web-app>
Note that I have ejb-ref commented out, i had been told not to use
ejb-ref in web.xml for my case, and I do a lookup on the global name
of the bean, which is Stamp
Object boundObject = context.lookup("Stamp");
but resulted in "javax.naming.NameNotFoundException: Stamp not found"
I have also been told that maybe it is because I hace the
EJB/servlets deployed sepearately as two apps.
I initialised the context using...
env.put
(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.ApplicationIniti
alContextFactory");
env put
(Context.PROVIDER_URL,"ormi://p500.cheapdull.mine.nu/stamp");
env.put(Context.SECURITY_PRINCIPAL,"admin");
env.put(Context.SECURITY_CREDENTIALS,"123");
context = new InitialContext(env);
(similar in the client as well, but use
ApplicationClientInitialContextFactory instead)
so does any one has any suggestion as to what amI doing wrong here?
Thanks heaps in advance. :)
Regards, James.