users@glassfish.java.net

Re: ACC, Web Start and IIOP/SSL

From: <glassfish_at_javadesktop.org>
Date: Thu, 13 Mar 2008 01:24:47 PST

Hi,

I must be doing something terribly wrong, as I cannot get things working using the appclient -client way either...


The (successfully deployed) bean has the following:
[b]-- Interface:[/b]
import javax.ejb.Remote;

@Remote
public interface IJustABean2 {
        public String sayHello(String in);
}

[b]-- Class:[/b]
import javax.annotation.security.RolesAllowed;
import javax.ejb.Stateless;

@Stateless(name="JustABean2", mappedName="ejb/JustABean2")
@RolesAllowed("appuser")
public class JustABean2 implements IJustABean2 {

        @Override
        public String sayHello(String in) {
                if (in == null) {
                        return "JustABean2 says hello to nobody";
                }
        
                return "JustABean2 says hello to " + in ;
        }

}

[b]-- META-INF/sun-ejb-jar.xml:[/b]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd" >
<sun-ejb-jar>
  <security-role-mapping>
        <role-name>appuser</role-name>
        <group-name>appuser</group-name>
  </security-role-mapping>
  <enterprise-beans>
           <ejb>
                  <ejb-name>JustABean2</ejb-name>
                  <jndi-name>ejb/JustABean2</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>
                          <as-context>
                                  <auth-method>username_password</auth-method>
                                  <realm>default</realm>
                                  <required>true</required>
                          </as-context>
                  </ior-security-config>
          </ejb>
  </enterprise-beans>
</sun-ejb-jar>


My standalone client looks like this:
[b]-- Class:[/b]
import javax.naming.InitialContext;

import nl.teamsoft.sjsas.ejb.IJustABean2;

public class JustABean2Client {

        public static void main(String[] args) {
                
                InitialContext ic = null;
                IJustABean2 aBean = null;
                
                System.out.println("starting");
                
                try {
                        
                        System.out.println("trying");
                        
                        System.setProperty("javax.net.ssl.trustStore", "C:/Java/Jre1.6.0_04/lib/security/cacerts");
                        System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
                        System.setProperty("javax.net.ssl.keyStore", "C:/Java/Jre1.6.0_04/lib/security/.keystore");
                        System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
                        System.setProperty("org.omg.CORBA.ORBInitialHost","PCUP");
                        System.setProperty("org.omg.CORBA.ORBInitialPort","3700");
                        
                        ic = new InitialContext();
                        aBean = (IJustABean2) ic.lookup("ejb/JustABean2");

                        System.out.println( aBean.sayHello("world") );
                } catch (Exception e) {
                        System.out.println("oops.... " + e.getLocalizedMessage());
                }
                
                System.out.println("finished");

        }

}


I jarred the client and saved it in the %server_home%\bin directory.
This way I have direct access to the appclient tool provided by the server itself (assuming that all needed server classes/properties/... are directly available).

The only extra thing I did was to redirect the logservice of the %server-home%\domain\domain1\config\sun-acc.xml to a file (with loglevel of INFO) using the following:
<log-service file="c:/sun-acc.log" level="INFO"/>
 
Running the client with: [i]appclient -client JustABean2Client.jar[/i] results in the following logfile c:/sun-acc.log:
13-mrt-2008 10:02:14 com.sun.enterprise.appclient.MainWithModuleSupport prepareSecurity
INFO: Security Manager is OFF.
13-mrt-2008 10:02:15 com.sun.enterprise.appclient.MainWithModuleSupport setTargetServerProperties
INFO: ACC001:Using ClientContainer file: [C:\Java\J2ee\sdk\domains\domain1\config\sun-acc.xml].
13-mrt-2008 10:02:15 com.sun.enterprise.appclient.MainWithModuleSupport <init>
INFO: ACC024: IIOP endpoint(s) = PCUP:3700
13-mrt-2008 10:02:17 com.sun.enterprise.appclient.MainWithModuleSupport loadMainClientClass
INFO: ACC009: Load Application Class: [nl.teamsoft.sjsas.client.JustABean2Client]
[b]13-mrt-2008 10:02:17 com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread run
WARNING: "IOP00710311: (INTERNAL) Worker thread Thread[p: default-threadpool; w: 3,5,ORB ThreadGroup] caught throwable org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 203 completed: No while executing work."
org.omg.CORBA.INTERNAL: vmcid: SUN minor code: 311 completed: No
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.workerThreadDoWorkThrowable(ORBUtilSystemException.java:7706)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.workerThreadDoWorkThrowable(ORBUtilSystemException.java:7730)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:558)[/b]

The warning entry is being repeated in the log until I kill the program.

I'm getting afraid to ask but do you have any clues/hints/ideas/...?

Bart.
[Message sent by forum member 'bertusdotcom' (bertusdotcom)]

http://forums.java.net/jive/thread.jspa?messageID=263754