You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Richard <ri...@gmail.com> on 2009/04/24 18:07:32 UTC

using glassfish remoting in tomcat 6

Hi

I am sure this is a common issue but I looked it up on google and nobody
seem to have a real good fix about this. Or maybe there is something I don't
understand something... ? here is my problem:

I try to use the glassfish appserv-rt.jar client library to enable my webapp
to call EJBs remotely in my tomcat 6 context.

With a simple test application. I can successfully call an EJB from a
servlet.

I place my jars (javaee.jar and appserver-rt and the necessary dependencies)
in my WEB-INF/lib/ direcectory. I build the InitialContext by hand and set
the properties that will serve to initialise the jndi jndi name resolver.
This is my base app I used test that everything is working.

In another app. With more complex libraries (ex: Seam, richfaces, etc). I
have a classloading issue. If I put the appserver-rt.jar and javaee.jar in
my web-app /WEB-INF/lib directory the web-app won't deploy because the
classloading is not done in the right order so when it's some on my seam
componenent instantiate and I try to fill some cache from the EJBs, the call
fails because the appserver-rt-jar as not yet been loader (or I guess, is
not loaded by the class loader because of the javax.* java.* constraint of
the servlet specification?)

I tried to move things arround... and put the appserver-rt.jar in
CATALINA_BASE/lib forlder

If I put the javaee.jar in CATALINA_BASE/lib/ there is no problem.
If I put the appserver-rt file into the CATALINA_BASE/lib/ folder the server
does not start because of a NamingException. I am not sure I understand why
there seems to be a problem/conlict between the ressourcefactory in the
appserver-rt.jar and tomcat's resourcefactory. Anyone know how to get
arround this problem in a clean way? I am seen solutions like renaming the
appserver-rt.jar to zappserver-rt.jar so it is loader last... but this is
not a clean solution.

Here is the output of my tomcat server when I start it with the
appserver-rt.jar in the CATALINA_BASE/LIB foder:

E:\dev\runtime\apache-tomcat-6.0.18\bin>catalina.bat run
Using CATALINA_BASE:   E:\dev\runtime\apache-tomcat-6.0.18
Using CATALINA_HOME:   E:\dev\runtime\apache-tomcat-6.0.18
Using CATALINA_TMPDIR: E:\dev\runtime\apache-tomcat-6.0.18\temp
Using JRE_HOME:        E:\dev\lib\jdk1.6.0_13
Apr 24, 2009 12:04:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Cannot find message associated with key aprListener.aprInit
Apr 24, 2009 12:04:12 PM org.apache.coyote.http11.Http11Protocol init
INFO: PWC4652: Initializing null on port 8080
Apr 24, 2009 12:04:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1187 ms
Apr 24, 2009 12:04:13 PM
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
SEVERE: Exception processing Global JNDI Resources
javax.naming.NamingException: Cannot create resource instance
        at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
        at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
        at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:179)
        at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:149)
        at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:121)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:143)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2310)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Apr 24, 2009 12:04:13 PM org.apache.catalina.core.StandardService start
INFO: PWC1377: Starting service Catalina
javax.naming.NamingException: Cannot create resource instance
        at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
        at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
        at
org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:279)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
        at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
        at
org.apache.catalina.core.StandardService.start(StandardService.java:515)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
UserDatabaseRealm[Catalina]: PWC2101: Exception looking up UserDatabase
under key UserDatabase
javax.naming.NamingException: Cannot create resource instance
        at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
        at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
        at
org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:279)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
        at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
        at
org.apache.catalina.core.StandardService.start(StandardService.java:515)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Apr 24, 2009 12:04:13 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
LifecycleException:  PWC2102: No UserDatabase component found under key
UserDatabase
        at
org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:286)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
        at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
        at
org.apache.catalina.core.StandardService.start(StandardService.java:515)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Apr 24, 2009 12:04:13 PM org.apache.catalina.startup.Catalina start

RE: using glassfish remoting in tomcat 6

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jonathan Richard [mailto:richajon@gmail.com]
> Subject: using glassfish remoting in tomcat 6
> 
> I place my jars (javaee.jar and appserver-rt and the necessary
> dependencies) in my WEB-INF/lib/ direcectory.

You must not put javaee.jar anywhere that's reachable by Tomcat, including any WEB-INF/lib or Tomcat's lib directory.  Some of the classes in javaee.jar conflict with the ones supplied by Tomcat and cannot be used.  You will have to extract whatever pieces of javaee.jar you really need and put those in WEB-INF/lib (or WEB-INF/classes); doing otherwise will result in a never-ending series of classloader problems.

The same may be true of appserver-rt.jar, but I'm not familiar with it.

 - Chuck

P.S.  The name of a jar has only a random effect on search order and cannot be relied upon.


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: using glassfish remoting in tomcat 6

Posted by Jonathan Richard <ri...@gmail.com>.
Aaaaahhhh! makes sense now!

I will try this. Thanks a lot. You guys gave me the missing piece of the
puzzle.

Thanks.

On Fri, Apr 24, 2009 at 1:32 PM, Martin Gainty <mg...@hotmail.com> wrote:

>
> Richard-
>
> the class is org.apache.naming.factory.ResourceRef and the author is Remy
> Maucherat remm@apache.org
>
> package org.apache.naming;
> public class ResourceRef
>    extends Reference {
>    // --------------------------------------------------------------
> Constants
>    /*** Default factory for this reference.*/
>    public static final String DEFAULT_FACTORY =
>        org.apache.naming.factory.Constants.DEFAULT_RESOURCE_FACTORY;
>
> whereas DEFAULT_RESOURCE_FACTORY is defined as CONSTANT in Constants class
>
> package org.apache.naming.factory;
> public final class Constants {
>    public static final String Package = "org.apache.naming.factory";
>    public static final String DEFAULT_RESOURCE_FACTORY =
>        Package + ".ResourceFactory";
>
> 1)
> you can ask remm to fix the code
> 2)
> OR you can download the code and fix it yourself
> http://www.uniontransit.com/apache/tomcat/tomcat-6/v6.0.18/src
>
> you can build it extracting all bits from naming-factory.jar (usually in
> /lib or /common/lib)
> jar -xvf naming-factory.jar .\SomeTestFolder
> if you cant locate naming-factory.jar in $TOMCAT_HOME\lib or
> $TOMCAT_HOME\common\lib Eclipse has a naming-facctory.jar located at
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tomcat/naming-factory.jar?view=log
>
> make the edits (i think you can just modify the Package and or
> DEFAULT_RESOURCE_FACTORY in org.apache.naming.factory.Constants
>
> compile the org.apache.naming.factory.Constants.java
> copy to location of unjar'ed org.apache.naming.factory.Constants.class
>
> if necessary
> compile the org.apache.naming.ResourceRef.java
> copy to location of unjar'ed org.apache.naming.ResourceRef.class
>
> --jar it up
> jar -cvf naming-factory.jar .\*.*
> copy naming-factory.jar to location where you found naming-factory.jar
> (usually $TOMCAT_HOME\lib or $TOMCAT_HOME\common\lib)
>
> HTH
> Martin
> ______________________________________________
> Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note
> de déni et de confidentialité
> This message is confidential. If you should not be the intended receiver,
> then we ask politely to report. Each unauthorized forwarding or
> manufacturing of a copy is inadmissible. This message serves only for the
> exchange of information and has no legal binding effect. Due to the easy
> manipulation of emails we cannot take responsibility over the the contents.
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>
>
> > Date: Fri, 24 Apr 2009 12:07:32 -0400
> > Subject: using glassfish remoting in tomcat 6
> > From: richajon@gmail.com
> > To: users@tomcat.apache.org
> >
> > Hi
> >
> > I am sure this is a common issue but I looked it up on google and nobody
> > seem to have a real good fix about this. Or maybe there is something I
> don't
> > understand something... ? here is my problem:
> >
> > I try to use the glassfish appserv-rt.jar client library to enable my
> webapp
> > to call EJBs remotely in my tomcat 6 context.
> >
> > With a simple test application. I can successfully call an EJB from a
> > servlet.
> >
> > I place my jars (javaee.jar and appserver-rt and the necessary
> dependencies)
> > in my WEB-INF/lib/ direcectory. I build the InitialContext by hand and
> set
> > the properties that will serve to initialise the jndi jndi name resolver.
> > This is my base app I used test that everything is working.
> >
> > In another app. With more complex libraries (ex: Seam, richfaces, etc). I
> > have a classloading issue. If I put the appserver-rt.jar and javaee.jar
> in
> > my web-app /WEB-INF/lib directory the web-app won't deploy because the
> > classloading is not done in the right order so when it's some on my seam
> > componenent instantiate and I try to fill some cache from the EJBs, the
> call
> > fails because the appserver-rt-jar as not yet been loader (or I guess, is
> > not loaded by the class loader because of the javax.* java.* constraint
> of
> > the servlet specification?)
> >
> > I tried to move things arround... and put the appserver-rt.jar in
> > CATALINA_BASE/lib forlder
> >
> > If I put the javaee.jar in CATALINA_BASE/lib/ there is no problem.
> > If I put the appserver-rt file into the CATALINA_BASE/lib/ folder the
> server
> > does not start because of a NamingException. I am not sure I understand
> why
> > there seems to be a problem/conlict between the ressourcefactory in the
> > appserver-rt.jar and tomcat's resourcefactory. Anyone know how to get
> > arround this problem in a clean way? I am seen solutions like renaming
> the
> > appserver-rt.jar to zappserver-rt.jar so it is loader last... but this is
> > not a clean solution.
> >
> > Here is the output of my tomcat server when I start it with the
> > appserver-rt.jar in the CATALINA_BASE/LIB foder:
> >
> > E:\dev\runtime\apache-tomcat-6.0.18\bin>catalina.bat run
> > Using CATALINA_BASE:   E:\dev\runtime\apache-tomcat-6.0.18
> > Using CATALINA_HOME:   E:\dev\runtime\apache-tomcat-6.0.18
> > Using CATALINA_TMPDIR: E:\dev\runtime\apache-tomcat-6.0.18\temp
> > Using JRE_HOME:        E:\dev\lib\jdk1.6.0_13
> > Apr 24, 2009 12:04:12 PM org.apache.catalina.core.AprLifecycleListener
> init
> > INFO: Cannot find message associated with key aprListener.aprInit
> > Apr 24, 2009 12:04:12 PM org.apache.coyote.http11.Http11Protocol init
> > INFO: PWC4652: Initializing null on port 8080
> > Apr 24, 2009 12:04:12 PM org.apache.catalina.startup.Catalina load
> > INFO: Initialization processed in 1187 ms
> > Apr 24, 2009 12:04:13 PM
> > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
> > SEVERE: Exception processing Global JNDI Resources
> > javax.naming.NamingException: Cannot create resource instance
> >         at
> >
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
> >         at
> > javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
> >         at
> >
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:179)
> >         at
> >
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:149)
> >         at
> >
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:121)
> >         at
> >
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:143)
> >         at
> > org.apache.catalina.core.StandardServer.start(StandardServer.java:2310)
> >         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >         at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:597)
> >         at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> >         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> > Apr 24, 2009 12:04:13 PM org.apache.catalina.core.StandardService start
> > INFO: PWC1377: Starting service Catalina
> > javax.naming.NamingException: Cannot create resource instance
> >         at
> >
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
> >         at
> > javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
> >         at
> >
> org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:279)
> >         at
> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
> >         at
> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
> >         at
> > org.apache.catalina.core.StandardService.start(StandardService.java:515)
> >         at
> > org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
> >         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >         at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:597)
> >         at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> >         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> > UserDatabaseRealm[Catalina]: PWC2101: Exception looking up UserDatabase
> > under key UserDatabase
> > javax.naming.NamingException: Cannot create resource instance
> >         at
> >
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
> >         at
> > javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
> >         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
> >         at
> >
> org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:279)
> >         at
> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
> >         at
> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
> >         at
> > org.apache.catalina.core.StandardService.start(StandardService.java:515)
> >         at
> > org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
> >         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >         at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:597)
> >         at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> >         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> > Apr 24, 2009 12:04:13 PM org.apache.catalina.startup.Catalina start
> > SEVERE: Catalina.start:
> > LifecycleException:  PWC2102: No UserDatabase component found under key
> > UserDatabase
> >         at
> >
> org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:286)
> >         at
> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
> >         at
> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
> >         at
> > org.apache.catalina.core.StandardService.start(StandardService.java:515)
> >         at
> > org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
> >         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >         at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:597)
> >         at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> >         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> > Apr 24, 2009 12:04:13 PM org.apache.catalina.startup.Catalina start
>
> _________________________________________________________________
> Windows Live™ SkyDrive™: Get 25 GB of free online storage.
> http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_042009

RE: using glassfish remoting in tomcat 6

Posted by Martin Gainty <mg...@hotmail.com>.
Richard-

the class is org.apache.naming.factory.ResourceRef and the author is Remy Maucherat remm@apache.org

package org.apache.naming;
public class ResourceRef
    extends Reference {
    // -------------------------------------------------------------- Constants
    /*** Default factory for this reference.*/
    public static final String DEFAULT_FACTORY = 
        org.apache.naming.factory.Constants.DEFAULT_RESOURCE_FACTORY;

whereas DEFAULT_RESOURCE_FACTORY is defined as CONSTANT in Constants class

package org.apache.naming.factory;
public final class Constants {
    public static final String Package = "org.apache.naming.factory";
    public static final String DEFAULT_RESOURCE_FACTORY = 
        Package + ".ResourceFactory";

1)
you can ask remm to fix the code 
2)
OR you can download the code and fix it yourself
http://www.uniontransit.com/apache/tomcat/tomcat-6/v6.0.18/src

you can build it extracting all bits from naming-factory.jar (usually in /lib or /common/lib)
jar -xvf naming-factory.jar .\SomeTestFolder
if you cant locate naming-factory.jar in $TOMCAT_HOME\lib or $TOMCAT_HOME\common\lib Eclipse has a naming-facctory.jar located at
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tomcat/naming-factory.jar?view=log

make the edits (i think you can just modify the Package and or DEFAULT_RESOURCE_FACTORY in org.apache.naming.factory.Constants 

compile the org.apache.naming.factory.Constants.java
copy to location of unjar'ed org.apache.naming.factory.Constants.class

if necessary 
compile the org.apache.naming.ResourceRef.java
copy to location of unjar'ed org.apache.naming.ResourceRef.class

--jar it up
jar -cvf naming-factory.jar .\*.*
copy naming-factory.jar to location where you found naming-factory.jar
(usually $TOMCAT_HOME\lib or $TOMCAT_HOME\common\lib)

HTH
Martin 
______________________________________________ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité 
This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.






> Date: Fri, 24 Apr 2009 12:07:32 -0400
> Subject: using glassfish remoting in tomcat 6
> From: richajon@gmail.com
> To: users@tomcat.apache.org
> 
> Hi
> 
> I am sure this is a common issue but I looked it up on google and nobody
> seem to have a real good fix about this. Or maybe there is something I don't
> understand something... ? here is my problem:
> 
> I try to use the glassfish appserv-rt.jar client library to enable my webapp
> to call EJBs remotely in my tomcat 6 context.
> 
> With a simple test application. I can successfully call an EJB from a
> servlet.
> 
> I place my jars (javaee.jar and appserver-rt and the necessary dependencies)
> in my WEB-INF/lib/ direcectory. I build the InitialContext by hand and set
> the properties that will serve to initialise the jndi jndi name resolver.
> This is my base app I used test that everything is working.
> 
> In another app. With more complex libraries (ex: Seam, richfaces, etc). I
> have a classloading issue. If I put the appserver-rt.jar and javaee.jar in
> my web-app /WEB-INF/lib directory the web-app won't deploy because the
> classloading is not done in the right order so when it's some on my seam
> componenent instantiate and I try to fill some cache from the EJBs, the call
> fails because the appserver-rt-jar as not yet been loader (or I guess, is
> not loaded by the class loader because of the javax.* java.* constraint of
> the servlet specification?)
> 
> I tried to move things arround... and put the appserver-rt.jar in
> CATALINA_BASE/lib forlder
> 
> If I put the javaee.jar in CATALINA_BASE/lib/ there is no problem.
> If I put the appserver-rt file into the CATALINA_BASE/lib/ folder the server
> does not start because of a NamingException. I am not sure I understand why
> there seems to be a problem/conlict between the ressourcefactory in the
> appserver-rt.jar and tomcat's resourcefactory. Anyone know how to get
> arround this problem in a clean way? I am seen solutions like renaming the
> appserver-rt.jar to zappserver-rt.jar so it is loader last... but this is
> not a clean solution.
> 
> Here is the output of my tomcat server when I start it with the
> appserver-rt.jar in the CATALINA_BASE/LIB foder:
> 
> E:\dev\runtime\apache-tomcat-6.0.18\bin>catalina.bat run
> Using CATALINA_BASE:   E:\dev\runtime\apache-tomcat-6.0.18
> Using CATALINA_HOME:   E:\dev\runtime\apache-tomcat-6.0.18
> Using CATALINA_TMPDIR: E:\dev\runtime\apache-tomcat-6.0.18\temp
> Using JRE_HOME:        E:\dev\lib\jdk1.6.0_13
> Apr 24, 2009 12:04:12 PM org.apache.catalina.core.AprLifecycleListener init
> INFO: Cannot find message associated with key aprListener.aprInit
> Apr 24, 2009 12:04:12 PM org.apache.coyote.http11.Http11Protocol init
> INFO: PWC4652: Initializing null on port 8080
> Apr 24, 2009 12:04:12 PM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 1187 ms
> Apr 24, 2009 12:04:13 PM
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
> SEVERE: Exception processing Global JNDI Resources
> javax.naming.NamingException: Cannot create resource instance
>         at
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
>         at
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
>         at
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:179)
>         at
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:149)
>         at
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:121)
>         at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:143)
>         at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2310)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Apr 24, 2009 12:04:13 PM org.apache.catalina.core.StandardService start
> INFO: PWC1377: Starting service Catalina
> javax.naming.NamingException: Cannot create resource instance
>         at
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
>         at
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
>         at
> org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:279)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
>         at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
>         at
> org.apache.catalina.core.StandardService.start(StandardService.java:515)
>         at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> UserDatabaseRealm[Catalina]: PWC2101: Exception looking up UserDatabase
> under key UserDatabase
> javax.naming.NamingException: Cannot create resource instance
>         at
> org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:156)
>         at
> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
>         at
> org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:279)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
>         at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
>         at
> org.apache.catalina.core.StandardService.start(StandardService.java:515)
>         at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Apr 24, 2009 12:04:13 PM org.apache.catalina.startup.Catalina start
> SEVERE: Catalina.start:
> LifecycleException:  PWC2102: No UserDatabase component found under key
> UserDatabase
>         at
> org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:286)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1226)
>         at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
>         at
> org.apache.catalina.core.StandardService.start(StandardService.java:515)
>         at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2317)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Apr 24, 2009 12:04:13 PM org.apache.catalina.startup.Catalina start

_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.  
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_042009