Well, I guess I really am starting to learn a bit more about Tomcat. It is
possible to remove the singleton loader and put it back in the application
code. I was just trying to do something slick with a single loader. But your
answer and the previous one have shown me the error of my way. now I
that work around is probably not what you want. You've just disabled the
ability to reload your app correctly.
Try using another classloader, maybe the
Thread.currentThread().getContextClassLoader()
where are you storing the class that is trying to load the singleton? it
should be in your
The class that is trying to load the singleton (SingletonLoader) is in a common
JAR located at /common/lib/mvpservlet.jar
The Singletons that I am trying to load can be from ANY app and are in the
WEB-INF/classes folder of whichever application is trying to use the
SingletonLoader.
well there you go, that wont work,
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
take a look at the hierarchy of the tomcat class loaders, and a class
can only load up in the tree, not down.
so mvpservlet is unable to load your web-inf/classes directory
from your
THAT is really *not* recommended.
Short answer,
you go the wrong way in your design. And adding your web-inf/classes to
your common classloader will completly break the tomcat behaviour
(presence of same classes at 2 levels, some instances are done at one
level, some other at another level, and
I think this may be a class loader issue, but am not sure as I have never
really worked with them before. I am putting together a JAR file that contains
a set of classes to be used throughout a suite of applications. I have a class
called SingletonLoader that was working when it was within the
did you try
Class singletongClassObj = this.getClass().getClassLoader().loadName(singletonClassName);
Filip
Mike Peremsky wrote:
I think this may be a class loader issue, but am not sure as I have never really worked with them before. I am putting together a JAR file that contains a set of
I tried the modification you suggested (with the correct method name on the
end) but still with the same results. I also printed out a debug message just
to see what class loader was being used (not that I know what to do with it :-P
)
log.debug(this class loader: +
I have resolved this issue, but am wondering if the way I did it is the
correct way to resolve this issue.
I modified the catalina.properties file entry common.loader by adding the
path to the applications WEB-INF/classes directory, this seems to have resolved
the issue with finding the