javax.naming.InitialContext
getNamingContext()
Get the JNDI naming context for this component.
public static API getAPI(){
try{
// API. Because this is a Stateless Session Bean, we can cache the instance we are //using
if( __api != null ) return __api;
// Object obj = __iniCtx
InitialContext __iniCtx=javax.naming.InitialContext.getNamingContext();
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Wed, 27 May 2009 15:35:17 -0700
> From: glassfish_at_javadesktop.org
> To: users_at_glassfish.dev.java.net
> Subject: rmi Unmarshal exception trying to access ejb on a remote host/app server
>
> I am having problems accessing ejbs that reside on a Jboss server from a web application running on Glassfish v2.1
>
> I'm able to access the ejb and make updates using a command-line app, but have problems when trying to access it from a web app running in Glassfish V2. The class/method I am using works fine when I invoke it using junit, but when I invoke it from our web application. It gets the following errors when it tries to get the API. I am using the APISuppoprt class that came with the java/ejb example.
>
> I set the properties of the System class and then retrieve them using getProperties in the init method.
>
> Here's the system properties being set:
> Properties props = System.getProperties();
> props.setProperty("java.naming.provider.url", "192.168.1.206:1099");
> props.setProperty("java.naming.provider.port", "8080");
> props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
> props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client");
> props.setProperty("jnp.socketFactory", "org.jnp.interfaces.TimedSocketFactory");
> props.setProperty("jnp.timeout", "0");
> props.setProperty("jnp.sotimeout", "0");
> System.setProperties(props);
> APISupport.init();
> _api = APISupport.getAPI();
>
> Here's the APISupport.getAPI method, it appears there is a problem when it does the initial context lookup:
>
> public static API getAPI(){
> try{
> // API. Because this is a Stateless Session Bean, we can cache the instance we are using
> if( __api != null ) return __api;
> Object obj = __iniCtx.lookup(APIHome.JNDI_NAME);
> APIHome apiHome = (APIHome) PortableRemoteObject.narrow(obj, APIHome.class);
> __api = apiHome.create();
> return __api;
>
> And here is the stack trace:
> 2009-05-26 08:48:40,604 INFO (org.springframework.web.servlet.DispatcherServlet:250) - FrameworkServlet 'dispatch': initialization completed in 125 ms
> javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
> java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
> java.net.MalformedURLException: no protocol: and]
> at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)
> at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
> at javax.naming.InitialContext.lookup(InitialContext.java:392)
> at com.attask.api.APISupport.getAPI(APISupport.java:46)
> at com.lingosys.burnside.api.NameConverter.go(NameConverter.java:50)
> [Message sent by forum member 'mikephoenix' (mikephoenix)]
>
> http://forums.java.net/jive/thread.jspa?messageID=347983
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
_________________________________________________________________
Hotmail® has a new way to see what's up with your friends.
http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009