----- Original Message -----
From: "Carlos Granados" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 30, 2001 10:28 pm
Subject: [JBoss-user] Running the interest sample as a Servlet does not work


> b) I transformed the code of the sample client into a servlet.

The interestEJB.zip example contains a servlet named EJB.java. I see the
obfuscation technique worked! I think it would be better if it were named
Servlet or something. Maybe it's just me.

> d) I also put some logging println lines in the lookout method of the
> jnpserver (in file NamingServer.java) and I found that both in the case of
> the standalone client and the servlet, the jnpserver is correctly called
and
> it finds the appropiate object. I put some println lines to display the
name
> being looked up and the object found and in both cases I got the same
> information:
> looking for interest/Interest
> found java.rmi.MarshalledObject@53248168
>
> e) So my hypothesis is that the naming server correctly finds the EJB, but
> when it is sent back to the naming client, it is somehow corrupted or
> something like that. This seems a RMI problem and I feel that I have run
> into something too complicated for me, so this is the point to ask for
help
> :-)

Because you're requesting a remote object it's being serialized across the
"divide." The receiving side needs the same class code to deserialize it. I
think your servlet can't find the class for what the
java.rmi.MarshalledObject instance--acting like an envelope--holds. The
servlet needs the .class files in [interest.war]/WEB-INF/classes/. The
servlet doesn't need the session bean code just the home and remote
interfaces. Here's the jar tf output from a sample interest.war I built:

META-INF/MANIFEST.MF
WEB-INF/classes/com/web_tomorrow/interest/Interest.class
WEB-INF/classes/com/web_tomorrow/interest/InterestHome.class
WEB-INF/classes/EJB.class
WEB-INF/web.xml

If you're using any utility classes in their own jar you will need a
class-path entry in the manifest of the war file. For example, we're using a
utility jar and have a class-path entry in the manifest for both the war and
the ejb.jar. It looks something like this:

; begin [interest.war/META-INF/MANIFEST.MF] (don't include this line)
Manifest-Version: 1.0
Class-Path: library/utilities.jar
; end (don't include this line)

library/utilities.jar is in the .ear not the .war.

BTW, I had problems with the example EJB servlet client in EJB.java. It
seems that the servlet can't find the bean in the init() method. I added two
lines before the m_interest==null check:

    try {
      if (m_interest == null) // added SS
        init();                       // added SS

      if (m_interest == null) {
        out.println ("Could not connect to Interest bean. Is EJB Container
running?");
      } else {

I also added an e.printStackTrace(); in the empty catch in the body of the
init() method. Before this it would eat a naming exception when deployed. So
now it displays an exception when deployed but finds the bean when servicing
a request.

I hope this helped. I'm new to JBoss also so if I've ignorantly misled you,
someone please enlighten us both.

Steve

>
> Carlos
>



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to