users@glassfish.java.net

Re: accessing ejb3.0 hosted by glassfish from sun java system Web

From: <glassfish_at_javadesktop.org>
Date: Tue, 12 Feb 2008 14:51:26 PST

Hi,

Another user also reported the same problem to glassfish ejb alias (https://glassfish.dev.java.net/servlets/ReadMsg?list=ejb&msgNo=432).

First, you will need to add javaee.jar, appserv-rt.jar, appserv-deployment-client.jar to web server's classpath suffix. Depending on the nature of your app, you may also need other jars. For examples, if it's access glassfish jms, jdbc, connector resources, you also need imqjmsra.jar, appserv-admin.jar, appserv-ext.jar. Looks like you already passed this step. I'm including this step for other readers' benefits.

Next, at least 2 issues we need to resolve in order to interop between SJSWS and glassfish:

conflicts of classes: some classes are shared between web server and appserver, with different versions. For example, com/sun/enterprise/util/Utility.class, com/sun/enterprise/util/Utility$1.class.

This is the exception from webserver, which seems to have an older version of Utility.class:
java.lang.NoSuchMethodError: com.sun.enterprise.util.Utility.getMechanism()[B
        at com.sun.enterprise.iiop.CSIV2TaggedComponentInfo.createASContextSec(CSIV2TaggedComponentInfo.java:4
53)
        at com.sun.enterprise.iiop.CSIV2TaggedComponentInfo.createSecurityTaggedComponent(CSIV2TaggedComponent
Info.java:233)
        at com.sun.enterprise.iiop.TxSecIORInterceptor.addCSIv2Components(TxSecIORInterceptor.java:208)
        at com.sun.enterprise.iiop.TxSecIORInterceptor.establish_components(TxSecIORInterceptor.java:108)
        at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.objectAdapterCreated(InterceptorInvoker.java:


What I did is to unjar the 2 classes from glassifhs appserv-rt.jar and jar them into webserv-rt.jar (back up webserv-rt.jar first).


conflicts of loggers. I had 3 logger (util, core, core.security) conflicts between glassfish and webserver. I modifed glassfish\appserv-commons\src\java\com\sun\logging\LogDomains to dynamically choose a different logger, in case of conflicts:

     public static Logger getLogger(String name) {
- return Logger.getLogger(name, getLoggerResourceBundleName(name));
+ Logger logger = null;
+ try {
+ logger = Logger.getLogger(name, getLoggerResourceBundleName(name));
+ } catch (IllegalArgumentException e) {
+ String name2 = name + "2";
+ System.out.println("## got IllegalArgumentException, try new name:" + name2 +
+ ", resourcebundlename:" + getLoggerResourceBundleName(name2));
+ logger = Logger.getLogger(name2, getLoggerResourceBundleName(name2));
+ }
+ return logger;
     }

You will also need to copy the resource bundles files (**/LogStrings.properties files in appserv-rt.jar and appserv-deployment-client.jar) to their new name.

appserv-deployment-client.jar:
com/sun/logging/enterprise/system/util2/LogStrings.properties

appserv-rt.jar:
com/sun/logging/enterprise/system/core2/LogStrings.properties
com/sun/logging/enterprise/system/core/security2/LogStrings.properties

With these steps, my servlet on SJSWS was able to call a EJB 3 bean deployed on glassfish.

-cheng
[Message sent by forum member 'cf126330' (cf126330)]

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