Mahesh,
I have just remembered the code below is for accessing the ejb from a stand
alone client. So will
have to update my codes soon. But when I run the project from Netbeans 5.5
as 'Run project', the loads my default or index jsp so I assumn it works as
an application client component too.
I will look into this again and let you know of the progress.
eve
>From: "Eve Pokua" <gorgeous65_at_msn.com>
>Reply-To: ejb_at_glassfish.dev.java.net
>To: ejb_at_glassfish.dev.java.net
>Subject: Re: Sun Webserver can't bind to EJB on Sun App Server?
>Date: Thu, 19 Apr 2007 11:54:42 +0100
>
>Hi,
>
>If I understand what you are trying to do. I am also using Sun Application
>server 9. And in my
>implementation bean class, I have the following codes:
>
>try{
> InitialContext ctx=new InitialContext();
>
>Iteamdetails iteamdetails=(Iteamdetails)ctx.lookup("IteamdetailsBeanJNDI");
>
>iteamdetailhlp=iteamdetails.DescriptItem("red table");
>
>//then codes to display data
>
>}catch(Exception ex){
> System.err.println("Can not access DB");
> }
>
>'Iteamdetails' being my interface and 'iteamdetailhlp' being a helper class
>for my entity class and
>I am using the following codes to mapped the JNDI to my implementation
>class as followings:
>
>@Stateful(name="itemdetails", mappedName="IteamdetailsBeanJNDI")
>
>public class IteamdetailsBean implements Iteamdetails{
>.......
>
>}
>
>I am also using
>
>@PersistenceContext(name="STOCKDETAILS-ejbPU")
>
> EntityManager em;
>
>The PersistenceContext with the STOCKDETAILS-ejbPU persistence unit.
>
>Question, did you set up the connection to the database from the admin
>console under JDBC connection pool?
>
>And after pinging successfully, did you also set up the ejb reference
>connection?
>
>After all these, it is easy to set up a Persistence Unit by retrieving it
>from you Application server.
>
>So in my clients I tell the context lookup to access the appropriate
>mappednamed
>mappedName="IteamdetailsBeanJNDI"
>which then access the Perssitence unit.
>
>
>
>Your code is a little be too complicated and I am not sure why it is.
>
>The above codes are very simple and if you go through the Jee5 tutorial,
>you will understand it a little more.
>
>Does this help?
>
>>From: "Mahesh.Kannan" <Mahesh.Kannan_at_Sun.COM>
>>Reply-To: ejb_at_glassfish.dev.java.net
>>To: ejb_at_glassfish.dev.java.net
>>Subject: Re: Sun Webserver can't bind to EJB on Sun App Server?
>>Date: Wed, 18 Apr 2007 13:57:15 -0700
>>
>>
>>
>>Orest Guran wrote:
>
>eve
>>
>>>Hi,
>>>
>>>I seem to be having a problem accessing EJB's (EJB3.0) from a servlet
>>>running on a remote Sun Java Systems Webserver (6.1). I am using the Sun
>>>App Server (sun-appserver-pe9.0). Although the webserver connects to the
>>>JNDI service on the Sun App Server, if fails to bind to the ejb. I
>>>followed the directions from the EJB FAQ as shown on
>>>"https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html"
>>>
>>>I tried the same code running as a standalone class and had no problems
>>>accessing the bean. For kicks, I deployed the same EJB on a JBOSS App
>>>Server (4.0.5) and was able to bind to the EJB without any problems using
>>>the same servlet running on the remote Sun Java Systems Webserver!
>>>
>>>It appears to be some kind of interaction between the Sun App Server/Sun
>>>Webserver and the JNDI lookup. The only difference between the servlet
>>>code used to access the bean on the Sun App Server and the JBOSS
>>>Appserver is in the properties settings used to instantiate the
>>>InitialContext object in the servlet:
>>>
>>>SunAppServer Props:
>>> props.put("java.naming.provider.url", "iiop://localhost:3700");
>>> props.put("java.naming.factory.initial",
>>>"com.sun.enterprise.naming.SerialInitContextFactory");
>>>
>>>props.put("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
>>
>>Did you also have the following:
>> props.setProperty("java.naming.factory.state",
>>
>>"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
>>
>>Thanks,
>>--Mahesh
>>
>>>
>>>JBOSS Props:
>>> props.put("java.naming.factory.initial",
>>>"org.jnp.interfaces.NamingContextFactory");
>>> props.put("java.naming.provider.url", "jnp://localhost:1099");
>>> props.put("java.naming.factory.url.pkgs","org.jboss.naming.client");
>>>
>>>Also, I had to use a different lookup string. The JBOSS App Server found
>>>the bean using the following naming format (
>>>ic.lookup("CalculateBean/remote") ). The standalone class was only able
>>>to access the bean running on the Sun App Server using the fully
>>>qualified Remote Interface path (
>>>ic.lookup("entapp1.ejb.CalculateRemote") ).
>>>
>>>
>>>Any ideas what I may be doing wrong when I try to access a bean running
>>>on the Sun App Server from the Sun Web Server? Any help you can give
>>>would be appreciated.
>>>
>>>Thanks,
>>>Orest
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>>>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>>
>
>_________________________________________________________________
>The average US Credit Score is 675. The cost to see yours: $0 by Experian.
>http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
_________________________________________________________________
Get Hotmail, News, Sport and Entertainment from MSN on your mobile.
http://www.msn.txt4content.com/