users@glassfish.java.net

Re: IIOP and SSL

From: Dies Koper <dies_at_jp.fujitsu.com>
Date: Wed, 16 Jan 2008 17:35:44 +0900

You could use the equivalent ejb-jar.xml definitions instead of
annotations. But that is not why your lookup fails.

The problem with the code you posted (assuming there is no ejb-jar.xml),
is that the <ejb-name> in sun-ejb-jar.xml should specify the bean's
name, which defaults to the unqualified class name. So use
<ejb-name>MyServerImpl</ejb-name>

In the server instance's JNDI browser you can see what name the bean is
registered in JNDI. That name should be used in your lookup code. (I
think that code is correct).

Regards,
Dies


Gerald Holl wrote:
> Dies Koper wrote:
>> Any chance that you forgot to specify that integrity or confidentially
>> is REQUIRED in the sun-ejb-jar.xml definition for the bean you are
>> looking up?
>> Note that first the naming service (on 3700) is accessed and the IOR
>> that is returned will redirect the ACC to the SSL port provided that
>> your bean is defined to require SSL.
>
> Do I need both annotations and sun-ejb-jar.xml to configure the bean
> correctly?
>
> Example:
>
> package server;
>
> @Remote
> public interface MyServer {
> public String getInfo() throws RemoteException;
> }
>
>
> package server;
>
> @Stateless
> public class MyServerImpl implements MyServer {
> public String getInfo() throws RemoteException {
> return "info";
> }
> }
>
> sun-ejb-jar.xml:
> <sun-ejb-jar>
> <enterprise-beans>
> <ejb>
> <ejb-name>server.MyServerImpl</ejb-name>
> <jndi-name>ejb/MyServer</jndi-name>
> <ior-security-config>
> <transport-config>
> <integrity>required</integrity>
> <confidentiality>required</confidentiality>
> <establish-trust-in-target>supported</establish-trust-in-target>
> <establish-trust-in-client>supported</establish-trust-in-client>
> </transport-config>
> <sas-context>
> <caller-propagation>supported</caller-propagation>
> </sas-context>
> </ior-security-config>
> </ejb>
> </enterprise-beans>
> </sun-ejb-jar>
>
>
>
> And here the lookup code of the standalone client:
> System.setProperty("javax.net.ssl.trustStore", "client.keystore");
> System.setProperty("javax.net.ssl.trustStorePassword", "abc");
> System.setProperty("javax.net.ssl.keyStore", "client.keystore");
> System.setProperty("javax.net.ssl.keyStorePassword", "abc");
> System.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
> System.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
> InitialContext ctx = new InitialContext();
> server = (MyServer) ctx.lookup("ejb/MyServer");
>
>
>
> This lookup code is not working because I get a NamingException:
> MyServer not found.
> What's wrong in the above code?
>
>
> Thanks,
> Gerald