users@glassfish.java.net

RE: Remote Slsb Look up Failure

From: Jason Lee <lee_at_iecokc.com>
Date: Tue, 9 May 2006 11:50:56 -0500

Well, here's something strange: it's automagically working, and I can't
tell you why, though maybe it's my client config, as that's the only
thing that is consistent across my test. Locally, I removed and
reinstalled Glassfish to create a "clean" domain config, then added my
JDBC connection pool and resource. In my client, I removed
jndi.properties and any System properties changes, grabbing the no-arg
InitialContext, and it worked. I then took the same .ear and deployed
it to our production box (leaving that domain config alone), and it
worked there as well (after I added the System.setProperty() calls to
point it to the remote box). Pretty odd. I guess it could be the way I
packaged the application, but I don't think that changed at all.
 
At any rate, thanks everyone that gave advice. In one way or another,
the advice was or most likely will be helpful. :)
 
--
Jason Lee
Programmer/Analyst
 
  _____  
From: Kenneth.Saks_at_Sun.COM [mailto:Kenneth.Saks_at_Sun.COM] 
Sent: Tuesday, May 09, 2006 10:05 AM
To: ejb_at_glassfish.dev.java.net; Jason Lee
Subject: Re: Remote Slsb Look up Failure
Jason Lee wrote:
	I'll need to specify properties if the bean is on a remote
machine, won't I?
Yes, there are properties for setting target host and port 
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemote
EJB.
But those are independent of jndi.properties.   You might want to try
running
the stand-alone client outside of the IDE first to help isolate the
issue. 
	 
	For what it's worth, I'm running my client from inside Eclipse.
At the moment, that's the only client, and it's only for testing.  Once
we have the bean up and running, we'll start pointing other applications
at it.
	 
	--
	Jason Lee
	Programmer/Analyst
	 
  _____  
	From: Kenneth.Saks_at_Sun.COM [mailto:Kenneth.Saks_at_Sun.COM] 
	Sent: Tuesday, May 09, 2006 9:54 AM
	To: Jason Lee
	Cc: ejb_at_glassfish.dev.java.net
	Subject: Re: Remote Slsb Look up Failure
	
	
	Jason Lee wrote:
	
		Since that original message, I did simplify the test
quite a bit.  Here's the current code:
		 
		package com.iecokc.products;
		 
		import javax.naming.InitialContext;
		 
		public class BrandNameProductClient {
		 public static void main (String args[]) {
		  String jndiName = 
		   IBrandNameProduct.class.getName();
		  
		  try {
		   InitialContext ic = new InitialContext();
		   System.out.println ("Looking up " + jndiName);
		   IBrandNameProduct bnpr =  (IBrandNameProduct)
ic.lookup(jndiName);
		   bnpr.getBrandNameProduct("id", "nd", "FXY");
		  } catch (Exception e) {
		   e.printStackTrace();
		  }
		 }
		}
		
		In jndi.properties, I commented out the entries
attempting to see if the defaults would work, but I get the same error. 
	Which jndi.properties are you referring to?  You shouldn't have
to provide any jndi.properties yourself.
	As long as appserv-rt.jar is in the classpath of the client, it
will handle the bootstrapping.   The idea is to try as much as possible
to hide these kinds of details from the developer, for the very reason
that they are error-prone to configure.   Can you post the command
you're using to start the client?
	
	 --ken
	
		For what it's worth, here's what I was setting, based on
what Google could find for me:
		 
	
java.naming.factory.initial=com.sun.appserv.naming.S1ASCtxFactory
		java.naming.provider.url=iiop://localhost:3700
		 
		--
		Jason Lee
		Programmer/Analyst
		 
  _____  
		From: Kenneth.Saks_at_Sun.COM [mailto:Kenneth.Saks_at_Sun.COM]
		Sent: Monday, May 08, 2006 3:20 PM
		To: dev_at_glassfish.dev.java.net; Jason Lee
		Cc: users_at_glassfish.dev.java.net
		Subject: Re: Remote Slsb Look up Failure
		
		
		Jason Lee wrote:
		
			I hate to be a bother, but does anyone have any
thoughts on this?  I'm completely stumped.  Thanks!
		Hi Jason,
		
		First try following the stand-alone client guidelines in
	
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemote
EJB.
		
		We recommend relying on the defaults to bootstrap the
appserver's naming
		service rather than programmatically setting system
properties.   You can set the target host/port
		when starting the cilent JVM.   If that doesn't work,
you can follow-up at
		ejb_at_glassfish.dev.java.net.  Thanks.
		
		 --ken
		
			 
			--
			Jason Lee
			Programmer/Analyst
			 
  _____  
			From: Jason Lee 
			Sent: Monday, April 24, 2006 11:23 AM
			To: 'users_at_glassfish.dev.java.net'
			Subject: Remote Slsb Look up Failure
			
			
			When trying to get a reference to a remote
session bean, I get the follow stack trace from my client:
			 
			javax.naming.NamingException: ejb ref resolution
error for remote business interfacecom.iecokc.products.IBrandNameProduct
[Root exception is java.lang.NullPointerException]
			 at
com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:313)
			 at
com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(Rem
oteBusinessObjectFactory.java:61)
			 at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
			 at
com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
			 at
javax.naming.InitialContext.lookup(InitialContext.java:351)
			 at
com.iecokc.products.BrandNameProductClient.main(BrandNameProductClient.j
ava:20)
			Caused by: java.lang.NullPointerException
			 at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
			 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
			 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
			 at
java.lang.reflect.Method.invoke(Method.java:585)
			 at
com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:305)
			 ... 5 more
			 
			The client code looks basically like this:
			 
			String jndiName =
IBrandNameProduct.class.getName();
	
System.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
	
System.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
	
System.setProperty("com.sun.appserv.iiop.endpoints", "localhost:3700");
	
System.setProperty("com.sun.CORBA.connection.ORBSocketFactory",
"com.sun.enterprise.iiop.IIOPSSLSocketFactory");
			InitialContext ic = new InitialContext();
			System.out.println ("Looking up " + jndiName);
			IBrandNameProduct bnpr =
(IBrandNameProduct)ic.lookup(jndiName);
			 
			Glassfish shows that the bean deployed.  If I
view the JNDI tree, I can see the names there.  For the record, my
interface has @Remote, and the implementing class has @Stateless on it.
The confusing thing is that this code used to work, but, obviously,
something changed.  I have no clue what it might be.
			 
			Here's what my deployment archive looks like:
			 
			BrandNameProductSessionBean.ear
			    lib/
			        <bunch of supporting jars>
			    META-INF/
			        <ant-generated manifest>
			    BrandNameProductSessionBean.jar <-- with
interface and class
			 
			Does anybody have any idea what I'm missing?
I'm completely stumped. :|
			 
			--
			Jason Lee
			Programmer/Analyst