ejb@glassfish.java.net

Re: Fwd: follow-up question about remote EJB

From: Ing. Walter Minchez <walter.minchez_at_gmail.com>
Date: Wed, 13 Feb 2008 22:28:15 -0600

Hi, thanks, I finally get the servlet to communicate with the EJB3.... but
not exactly as you told...

First, I tried to fix the error with the logger but the try-catch method in
the post didn't work for me. I also modified the LogDomains.java but in this
way:

1. I added another package to look for:
public static final String PACKAGE_ROOT_WEB = "com.sun.webserver.logging.";
public static final String PACKAGE_ROOT = "com.sun.logging.";

this because the error was on resources within the web server, and this
class returned resources from application server.

2. The method try with the normal flow and if there is an error tries with
the web server resources:
private static String getLoggerResourceBundleName(String loggerName) {
        String result = loggerName + "." + RESOURCE_BUNDLE;
        return result.replaceFirst(DOMAIN_ROOT, PACKAGE_ROOT);
    }

private static String getLoggerResourceBundleNameWeb(String loggerName)
{
        String result = loggerName + "." + RESOURCE_BUNDLE;
        return result.replaceFirst(DOMAIN_ROOT, PACKAGE_ROOT_WEB);
    }
 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) {
    logger = Logger.getLogger(name, getLoggerResourceBundleNameWeb(name));
   }
   return logger;
    }

I added a complete different method, getLoggerResourceBundleNameWeb, just to
keep the original unchanged. After this change the IllegalArgumentException
was not thrown.

3. Then, comes the conflict with the Utility class, fixed the way you told.
Changing the class in webserv-rt.jar with the classes in appserv-rt.jar.
But, there is a limitation with this, the resources configured at the
server can no longer be used. If there is a resource configured the server
doesn't start because the new Utility.class hasn't a method "loadObject". If
you delete the resources at the server there is no problem with this
substitution (until now). I found this because I have configured the
ejb2.1example, the one with the web server
6.1.

4. A strange thing is that let me load the javaee.jar without any
modification. Before didn't let me load it because offended the
Servlet.class, but today there was no problem.

The servlet is now communicating with the ejb3, if I find another strange
behaviour I will let you know.

Again, thank you very much.