Re: help with embedded tomcat's webapp classloader

2005-09-19 Thread Donald Ball

Donald Ball wrote:

everything works okay but my webapp fails on initialization, with a 
NoClassDefFoundError on net.sf.hibernate.HibernateException. this is 
somewhat surprising given that hibernate.jar lives in the webapp's 
WEB-INF/lib directory. is there some additional configuration i need to 
do on my embedded Context object to force it to act like a normal tomcat 
webapp Context? do i perhaps need to ensure the webapp directory 
structure is in place before constructing my Tomcat instance? (that is 
to say, are the contents of WEB-INF/lib examined when the Context is 
created and/or added to the Host, or when tomcat is started?)


i worked around this issue by simply adding the classpath resources 
under WEB-INF to the classpath of the swt application in which tomcat is 
embedded. not a very elegant solution, but it'll do for the moment. now 
i find that jsp files cannot be compiled because Jasper is unable to 
find a javac compiler; com.sun.tools.javac.Main is not on the classpath.


ought i hunt down tools.jar and add that to my classpath manually as 
well, or can someone point me towards some documentation w.r.t. 
configuring embedded tomcat's webapp classloaders? i'm frankly unable to 
tell if this behavior is expected and i'm supposed to be manually doing 
some extra initialiation work on my Context, or if this is unusual 
behavior and i'm doing something wrong? any suggestions?


- donald

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



classloader issue on jboss3.2.2 for tomcat4.1

2005-09-16 Thread lio tomcat
Hello world,
 For some reason, i had to change default conf of my jboss 3.2.2 in order to 
avoid the use of jboss class loader.
It's now set in [jboss]\deploy\jbossweb-
tomcat41.sar\META-INF\jboss-service.xml in this way :
 
attribute name=UseJBossWebLoaderfalse/attribute 

The problem is now my webapp does not even see/load my jars in my 
war/WEB-INF/lib

What's the hint?

Please help,

thx


Re: classloader issue on jboss3.2.2 for tomcat4.1

2005-09-16 Thread Steve Dodge
It doesn't see any classes in any of your jars?  I was using JBoss 3.2.2 
back in 2003 and had the same issue.  Once I set the web loader to 
false, I realized that some utility classes were getting loaded from 
jars deployed in other wars.   Effectively, now each webapp has its own 
classloader.  So, I had to add those same jars into all my wars. 


On a side note, JBoss 4.0.x does a much better job with this.

Steve

lio tomcat wrote:


Hello world,
For some reason, i had to change default conf of my jboss 3.2.2 in order to 
avoid the use of jboss class loader.

It's now set in [jboss]\deploy\jbossweb-
tomcat41.sar\META-INF\jboss-service.xml in this way :

attribute name=UseJBossWebLoaderfalse/attribute 

The problem is now my webapp does not even see/load my jars in my 
war/WEB-INF/lib


What's the hint?

Please help,

thx

 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



help with embedded tomcat's webapp classloader

2005-09-16 Thread Donald Ball
hey guys. i'm trying out embedding tomcat 5.0 in an swt app that creates 
complex configuration data for a webapp. basically, i'd like the users 
to be able to do a test deploy of the webapp on their own box using 
hsqldb and an embedded tomcat.


my code looks more or less like so:

import org.apache.catalina.*;
import org.apache.catalina.logger.FileLogger;
import org.apache.catalina.realm.MemoryRealm;
import org.apache.catalina.startup.Embedded;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.net.InetAddress;

public final class Tomcat {

private static final Log log = LogFactory.getLog(Tomcat.class);

private final Embedded embeddedTomcat;
private final Engine baseEngine;
private final Host baseHost;
private final Context rootContext;

public Tomcat() {
embeddedTomcat = new Embedded();

final FileLogger fileLogger = new FileLogger();
fileLogger.setDirectory(.);
fileLogger.setPrefix(myTomcat);
fileLogger.setSuffix(.log);
fileLogger.setTimestamp(true);
embeddedTomcat.setLogger(fileLogger);

final MemoryRealm memoryRealm = new MemoryRealm();
embeddedTomcat.setRealm(memoryRealm);

baseEngine = embeddedTomcat.createEngine();
baseEngine.setName(myEngine);
baseEngine.setDefaultHost(localhost);

baseHost = embeddedTomcat.createHost(localhost, webapps);
baseEngine.addChild(baseHost);

rootContext = embeddedTomcat.createContext(, ROOT);
baseHost.addChild(rootContext);

embeddedTomcat.addEngine(baseEngine);

final Connector httpConnector = 
embeddedTomcat.createConnector((InetAddress)null, 8080, false);

embeddedTomcat.addConnector(httpConnector);
}

public void start() {
try {
embeddedTomcat.start();
} catch (LifecycleException e) {
log.error(Error starting tomcat, e);
}
}

public void stop() {
try {
embeddedTomcat.stop();
} catch (LifecycleException e) {
log.error(Error stopping tomcat, e);
}
}

}

everything works okay but my webapp fails on initialization, with a 
NoClassDefFoundError on net.sf.hibernate.HibernateException. this is 
somewhat surprising given that hibernate.jar lives in the webapp's 
WEB-INF/lib directory. is there some additional configuration i need to 
do on my embedded Context object to force it to act like a normal tomcat 
webapp Context? do i perhaps need to ensure the webapp directory 
structure is in place before constructing my Tomcat instance? (that is 
to say, are the contents of WEB-INF/lib examined when the Context is 
created and/or added to the Host, or when tomcat is started?)


- donald

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5 classloader log4j vs JCL issue

2005-09-06 Thread Woodchuck
 org.apache.log4j.spi.RepositorySelector;
 import org.apache.log4j.spi.RootCategory;
 
 /**
  * The ContextClassLoaderRepositorySelector class is used to manage
 different
  * [EMAIL PROTECTED] LoggerRepository} heirarchies for different context class
 loaders. The
  * [EMAIL PROTECTED] #add()} method can be used to create a seperate logger
 repository for
  * the current thread context class loader. When the class loader is
 about to be
  * destroyed use the [EMAIL PROTECTED] #remove()} method to clean up the 
 logger
 repository
  * for the class loader. See the [EMAIL PROTECTED] 
 Log4jServletContextListener}
 for use in
  * web applications.
  * 
  * @author Paul Austin
  * @version 1.0
  */
 public class ContextClassLoaderRepositorySelector implements
 RepositorySelector {
 /** The gaurd used to set the respository selector on the
 LogManager. */
 private static final Object GUARD = LogManager.getRootLogger();
 
 /** The map of class loaders to logging hierarchies. */
 private static final Map repositories = new HashMap();
 
 /**
  * The deault repository to use when one hasn't been created for
 the class
  * loader.
  */
 private static final LoggerRepository defaultRepository;
 
 static {
 defaultRepository = LogManager.getLoggerRepository();
 RepositorySelector selector = new
 ContextClassLoaderRepositorySelector();
 LogManager.setRepositorySelector(selector, GUARD);
 }
 
 /**
  * Get the logger repository for the current thread context class
 loader or
  * the default one if one does not exist.
  * 
  * @return The logger repository.
  */
 public final synchronized LoggerRepository getLoggerRepository()
 {
 Thread thread = Thread.currentThread();
 ClassLoader classLoader = thread.getContextClassLoader();
 Hierarchy hierarchy =
 (Hierarchy)repositories.get(classLoader);
 if (hierarchy == null) {
 return defaultRepository;
 } else {
 return hierarchy;
 }
 }
 
 /**
  * Add a new hierarchy for the current thread context class
 loader if one
  * does not exist or return the previous hierarchy.
  * 
  * @return The created heirarchy.
  */
 public static synchronized Hierarchy add() {
 Thread thread = Thread.currentThread();
 ClassLoader classLoader = thread.getContextClassLoader();
 return add(classLoader);
 }
 
 /**
  * Add a new hierarchy for the specified class loader if one does
 not exist
  * or return the previous hierarchy.
  * 
  * @param classLoader The classloader to create the hierarchy
 for.
  * @return The created heirarchy.
  */
 public static synchronized Hierarchy add(final ClassLoader
 classLoader) {
 Hierarchy hierarchy =
 (Hierarchy)repositories.get(classLoader);
 if (hierarchy == null) {
 hierarchy = new Hierarchy(new
 RootCategory((Level)Level.DEBUG));
 repositories.put(classLoader, hierarchy);
 }
 return hierarchy;
 }
 
 /**
  * Remove and shutdown the hierarchy for the current thread
 context class
  * loader class loader.
  */
 public static synchronized void remove() {
 Thread thread = Thread.currentThread();
 ClassLoader classLoader = thread.getContextClassLoader();
 remove(classLoader);
 }
 
 /**
  * Remove and shutdown the hierarchy for the specified class
 loader.
  * 
  * @param classLoader The classloader to create the hierarchy
 for.
  */
 public static synchronized void remove(final ClassLoader
 classLoader) {
 Hierarchy hierarchy =
 (Hierarchy)repositories.remove(classLoader);
 hierarchy.shutdown();
 }
 
 }
  /*
  * Copyright 2005 Revolution Systems Inc.
  * 
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  *  http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing,
 software
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 implied.
  * See the License for the specific language governing permissions
 and
  * limitations under the License.
  */
 package com.revolsys.logging.log4j;
 
 import java.io.InputStream;
 
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
 import org.apache.log4j.Hierarchy;
 import org.apache.log4j.xml.DOMConfigurator;
 
 /**
  * The Log4jServletContextListener class uses the
  * [EMAIL PROTECTED] ContextClassLoaderRepositorySelector} to maintain a
 separate Log4j
  * configuration for a servlet context and to load the logging
 configuration
  * from the log4j.xml file specified

RE: Tomcat 5.5 classloader log4j vs JCL issue

2005-09-06 Thread Woodchuck
hihi Seva,

yes, your suggestion also works.  i tried it to confirm, and it was my
backup plan to do in case i couldn't figure out how to *not* place
log4j.jar and commons-logging.jar into the ${Tomcat}/common/lib folder.

just fyi, it's also possible to centralize logging for the entire
servlet container by having the log4j.properties file in
${Tomcat}/common/classes (and the log4j.jar in ${Tomcat}/common/lib). 
this way, it is not necessary to put log4j.jar in each web app's
WEB-INF/lib folder, nor the log4j.properties file in each web app's
WEB-INF/classes folder.  centralize, as in one log4j.properties file
and one log4j.jar file.  yet, Tomcat and each web app can still
maintain their own separate log files!  i've tested this and it works
as well.


woodchuck


--- Seva Popov [EMAIL PROTECTED] wrote:

 Woodchuck,
  
 I guess, the alternative solution is to have all your web apps use
 log4j
 as well.
  
 So, you have commons-logging.jar and log4j.jar in the
 ${Tomcat}/common/lib folder
 and log4j.properties in ${Tomcat}/common/classes folder.
  
 Just add into your each web app's WEB-INF/classes folder
 log4j.properties file and
 into WEB-INF/lib folder log4j.jar.
  
 This way both Tomcat and your web apps will use separate log4j
 configurations.
  
 Thanks,
 Seva
  
 
 
 From: Paul Austin [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, August 31, 2005 1:30 PM
 To: Tomcat Users List
 Subject: Re: Tomcat 5.5 classloader log4j vs JCL issue
  
 Woodchuck,
 
 The following web page describes this situation and a solution to the
 problem.
 http://www.qos.ch/logging/sc.jsp
 
 I have attached the solution that I created this week based on the
 information above. To compile you will need servlet-api.jar and
 log4j.jar to compile.
 
 Include the jar you create from these files in your web application
 and
 then in your web.xml include the following sections.
 
 This section can be used if your log4j.xml is not under
 /WEB-INF/log4j.xml
   context-param
 param-namelog4jXmlLocation/param-name
 param-value/WEB-INF/log4j.xml/param-value
   /context-param
 
 The following calls invokes the listerner when the web app starts up
 to
 create a separate logging context for the web application.
 
   listener
  

listener-classcom.revolsys.logging.log4j.Log4jServletContextListener/
 listener-class
   /listener
 
 Also make sure you have a listener that does the following when the
 context is destroyed otherwise you'll get a log of PermGen out of
 memory
 errors after a number of redeploys
 
 Introspector.flushCaches();
 LogFactory.getFactory().release();
 
 Good luck,
 Paul
 
 On Wed, 2005-08-31 at 13:03 -0700, Woodchuck wrote: 
  
 hihi all,
  
 on my TC 5.5.9 installation i deployed several web applications that
 uses the default JCL logging.  that is, i placed a simple
 logging.properties file into each web app's WEB-INF/classes folder
 and
 i have per web app logging.  everything works beautifully.
  
 then i installed a new web app that forced me to place
 commons-logging.jar and log4j.jar into the ${Tomcat}/common/lib
 folder.
  as a result, all my previous per web app logging no longer works.
  
 i believe this is because log4j was discovered in the
 ${Tomcat}/common/lib first, and therefore it has superceeded any
 other
 logging system at the (lower) web app level.  this is due to Tomcat's
 classloading process.
  
 the reason this new web app required commons-logging.jar and
 log4j.jar
 to be placed specifically into the ${Tomcat}/commons/lib folder is
 because it instantiates a log4j logger object in it's start-up
 servlet
 which extends HttpServlet which is found in the servlet-api.jar which
 is also in the ${Tomcat}/commons/lib folder.  this is because
 Tomcat's
 classloading hierarchy dictates that classes in the common/lib cannot
 see web app classes 'downstream'.
  
 does anyone have any suggestions on how i can have per web app
 logging
 again?  i would like to keep my deployment process as web app
 isolated
 as possible (ie. each web app deployed by WAR, drop it in and that's
 it, no further steps necessary).
  
 thanks in advance,
 woodchuck
  
  

 
 Start your day with Yahoo! - make it your home page 
 http://www.yahoo.com/r/hs 
  
  
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
  
 





__
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat 5.5 classloader log4j vs JCL issue

2005-09-06 Thread Seva Popov
Yes it it possible to centralize the logging for the entire container
including all web apps. However, this seems to be a bad practice. The
better approach  is to separate the container internal logging and the
web apps logging. But I guess you know this for yourself.

-Original Message-
From: Woodchuck [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 06, 2005 11:10 AM
To: Tomcat Users List; Seva Popov
Subject: RE: Tomcat 5.5 classloader log4j vs JCL issue

hihi Seva,

yes, your suggestion also works.  i tried it to confirm, and it was my
backup plan to do in case i couldn't figure out how to *not* place
log4j.jar and commons-logging.jar into the ${Tomcat}/common/lib folder.

just fyi, it's also possible to centralize logging for the entire
servlet container by having the log4j.properties file in
${Tomcat}/common/classes (and the log4j.jar in ${Tomcat}/common/lib). 
this way, it is not necessary to put log4j.jar in each web app's
WEB-INF/lib folder, nor the log4j.properties file in each web app's
WEB-INF/classes folder.  centralize, as in one log4j.properties file
and one log4j.jar file.  yet, Tomcat and each web app can still
maintain their own separate log files!  i've tested this and it works
as well.


woodchuck


--- Seva Popov [EMAIL PROTECTED] wrote:

 Woodchuck,
  
 I guess, the alternative solution is to have all your web apps use
 log4j
 as well.
  
 So, you have commons-logging.jar and log4j.jar in the
 ${Tomcat}/common/lib folder
 and log4j.properties in ${Tomcat}/common/classes folder.
  
 Just add into your each web app's WEB-INF/classes folder
 log4j.properties file and
 into WEB-INF/lib folder log4j.jar.
  
 This way both Tomcat and your web apps will use separate log4j
 configurations.
  
 Thanks,
 Seva
  
 
 
 From: Paul Austin [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, August 31, 2005 1:30 PM
 To: Tomcat Users List
 Subject: Re: Tomcat 5.5 classloader log4j vs JCL issue
  
 Woodchuck,
 
 The following web page describes this situation and a solution to the
 problem.
 http://www.qos.ch/logging/sc.jsp
 
 I have attached the solution that I created this week based on the
 information above. To compile you will need servlet-api.jar and
 log4j.jar to compile.
 
 Include the jar you create from these files in your web application
 and
 then in your web.xml include the following sections.
 
 This section can be used if your log4j.xml is not under
 /WEB-INF/log4j.xml
   context-param
 param-namelog4jXmlLocation/param-name
 param-value/WEB-INF/log4j.xml/param-value
   /context-param
 
 The following calls invokes the listerner when the web app starts up
 to
 create a separate logging context for the web application.
 
   listener
  

listener-classcom.revolsys.logging.log4j.Log4jServletContextListener/
 listener-class
   /listener
 
 Also make sure you have a listener that does the following when the
 context is destroyed otherwise you'll get a log of PermGen out of
 memory
 errors after a number of redeploys
 
 Introspector.flushCaches();
 LogFactory.getFactory().release();
 
 Good luck,
 Paul
 
 On Wed, 2005-08-31 at 13:03 -0700, Woodchuck wrote: 
  
 hihi all,
  
 on my TC 5.5.9 installation i deployed several web applications that
 uses the default JCL logging.  that is, i placed a simple
 logging.properties file into each web app's WEB-INF/classes folder
 and
 i have per web app logging.  everything works beautifully.
  
 then i installed a new web app that forced me to place
 commons-logging.jar and log4j.jar into the ${Tomcat}/common/lib
 folder.
  as a result, all my previous per web app logging no longer works.
  
 i believe this is because log4j was discovered in the
 ${Tomcat}/common/lib first, and therefore it has superceeded any
 other
 logging system at the (lower) web app level.  this is due to Tomcat's
 classloading process.
  
 the reason this new web app required commons-logging.jar and
 log4j.jar
 to be placed specifically into the ${Tomcat}/commons/lib folder is
 because it instantiates a log4j logger object in it's start-up
 servlet
 which extends HttpServlet which is found in the servlet-api.jar which
 is also in the ${Tomcat}/commons/lib folder.  this is because
 Tomcat's
 classloading hierarchy dictates that classes in the common/lib cannot
 see web app classes 'downstream'.
  
 does anyone have any suggestions on how i can have per web app
 logging
 again?  i would like to keep my deployment process as web app
 isolated
 as possible (ie. each web app deployed by WAR, drop it in and that's
 it, no further steps necessary).
  
 thanks in advance,
 woodchuck
  
  

 
 Start your day with Yahoo! - make it your home page 
 http://www.yahoo.com/r/hs 
  
  
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED

Tomcat 5.5 classloader log4j vs JCL issue

2005-09-02 Thread luc_boudreau
I'm having the same issue and after trying to follow the instructions given by 
Paul Austin, I've got stuck on the part that says to add a listener. 

There's no place for a listener in web.xml according to the dtd validation 
file. Am I wrong ? (I'm using Tomcat 5.5.9 with the struts framework)

Everything else went fine. I've created a jar file with your source code. BTW, 
where am I supposed to put this jar anyways ? in common/lib/ ??

And just to double check, is this log4j.xml file valid ? :

---

?xml version=1.0 encoding=UTF-8 ?
!-- !DOCTYPE log4j:configuration SYSTEM log4j.dtd --
log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
  appender name=ConsoleAppender class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.SimpleLayout/
  /appender
  root
priority value =debug /
appender-ref ref=ConsoleAppender/
  /root
/log4j:configuration

---

Thanks a lot 


Luc Boudreau
SID - Université du Québec
[EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5 classloader log4j vs JCL issue

2005-09-02 Thread Paul Austin
Luc,

The listener element is only valid in the Servlet 2.3 web.xml file, if
using a previous servlet version use the attached servlet set to load at
startup before any of the other servlets.

The jar containing my classes should be included in your WEB-INF/lib
directory in each web application.

Paul

On Fri, 2005-09-02 at 09:07 -0400, [EMAIL PROTECTED] wrote:
 I'm having the same issue and after trying to follow the instructions given 
 by Paul Austin, I've got stuck on the part that says to add a listener. 
 
 There's no place for a listener in web.xml according to the dtd validation 
 file. Am I wrong ? (I'm using Tomcat 5.5.9 with the struts framework)
 
 Everything else went fine. I've created a jar file with your source code. 
 BTW, where am I supposed to put this jar anyways ? in common/lib/ ??
 
 And just to double check, is this log4j.xml file valid ? :
 
 ---
 
 ?xml version=1.0 encoding=UTF-8 ?
 !-- !DOCTYPE log4j:configuration SYSTEM log4j.dtd --
 log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
   appender name=ConsoleAppender class=org.apache.log4j.ConsoleAppender
 layout class=org.apache.log4j.SimpleLayout/
   /appender
   root
 priority value =debug /
 appender-ref ref=ConsoleAppender/
   /root
 /log4j:configuration
 
 ---
 
 Thanks a lot 
 
 
 Luc Boudreau
 SID - Université du Québec
 [EMAIL PROTECTED]
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
/*
 * Copyright 2005 Revolution Systems Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.revolsys.logging.log4j;

import java.io.InputStream;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Hierarchy;
import org.apache.log4j.xml.DOMConfigurator;

/**
 * The Log4jInitializationServlet class uses the
 * [EMAIL PROTECTED] ContextClassLoaderRepositorySelector} to maintain a separate Log4j
 * configuration for a servlet context and to load the logging configuration
 * from the log4j.xml file specified by the log4jXmlLocation context-param (or
 * /WEB-INF/log4j.xml if not specified).
 * 
 * @author Paul Austin
 * @version 1.0
 */
public class Log4jInitializationServlet extends HttpServlet {
/** The default location for the log4j.xml file. */
public static final String DEFAULT_LOG4J_XML_LOCATION = /WEB-INF/log4j.xml;

/**
 * Initialize the logging for context by creating a new heirarchy for the
 * current thread context class context and loading the configuration from
 * the log4jXmlLocation context-param.
 * 
 * @param config The servlet configuration.
 * @throws ServletException If there was a problem initializing the servlet.
 */
public void init(final ServletConfig config) throws ServletException {
super.init(config);
Hierarchy hierarchy = ContextClassLoaderRepositorySelector.add();
ServletContext context = config.getServletContext();
String log4jXml = context.getInitParameter(log4jXmlLocation);
if (log4jXml == null) {
log4jXml = DEFAULT_LOG4J_XML_LOCATION;
}
try {
InputStream log4JConfig = context.getResourceAsStream(log4jXml);
if (log4JConfig != null) {
DOMConfigurator conf = new DOMConfigurator();
conf.doConfigure(log4JConfig, hierarchy);
}
} catch (Exception e) {
throw new ServletException(e);
}
}

/**
 * Clean up the servlet by removing the logging configuration for the
 * current context.
 */
public void destroy() {
ContextClassLoaderRepositorySelector.remove();
}

}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Tomcat 5.5 classloader log4j vs JCL issue

2005-08-31 Thread Woodchuck
hihi all,

on my TC 5.5.9 installation i deployed several web applications that
uses the default JCL logging.  that is, i placed a simple
logging.properties file into each web app's WEB-INF/classes folder and
i have per web app logging.  everything works beautifully.

then i installed a new web app that forced me to place
commons-logging.jar and log4j.jar into the ${Tomcat}/common/lib folder.
 as a result, all my previous per web app logging no longer works.

i believe this is because log4j was discovered in the
${Tomcat}/common/lib first, and therefore it has superceeded any other
logging system at the (lower) web app level.  this is due to Tomcat's
classloading process.

the reason this new web app required commons-logging.jar and log4j.jar
to be placed specifically into the ${Tomcat}/commons/lib folder is
because it instantiates a log4j logger object in it's start-up servlet
which extends HttpServlet which is found in the servlet-api.jar which
is also in the ${Tomcat}/commons/lib folder.  this is because Tomcat's
classloading hierarchy dictates that classes in the common/lib cannot
see web app classes 'downstream'.

does anyone have any suggestions on how i can have per web app logging
again?  i would like to keep my deployment process as web app isolated
as possible (ie. each web app deployed by WAR, drop it in and that's
it, no further steps necessary).

thanks in advance,
woodchuck




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5 classloader log4j vs JCL issue

2005-08-31 Thread Paul Austin
();
RepositorySelector selector = new ContextClassLoaderRepositorySelector();
LogManager.setRepositorySelector(selector, GUARD);
}

/**
 * Get the logger repository for the current thread context class loader or
 * the default one if one does not exist.
 * 
 * @return The logger repository.
 */
public final synchronized LoggerRepository getLoggerRepository() {
Thread thread = Thread.currentThread();
ClassLoader classLoader = thread.getContextClassLoader();
Hierarchy hierarchy = (Hierarchy)repositories.get(classLoader);
if (hierarchy == null) {
return defaultRepository;
} else {
return hierarchy;
}
}

/**
 * Add a new hierarchy for the current thread context class loader if one
 * does not exist or return the previous hierarchy.
 * 
 * @return The created heirarchy.
 */
public static synchronized Hierarchy add() {
Thread thread = Thread.currentThread();
ClassLoader classLoader = thread.getContextClassLoader();
return add(classLoader);
}

/**
 * Add a new hierarchy for the specified class loader if one does not exist
 * or return the previous hierarchy.
 * 
 * @param classLoader The classloader to create the hierarchy for.
 * @return The created heirarchy.
 */
public static synchronized Hierarchy add(final ClassLoader classLoader) {
Hierarchy hierarchy = (Hierarchy)repositories.get(classLoader);
if (hierarchy == null) {
hierarchy = new Hierarchy(new RootCategory((Level)Level.DEBUG));
repositories.put(classLoader, hierarchy);
}
return hierarchy;
}

/**
 * Remove and shutdown the hierarchy for the current thread context class
 * loader class loader.
 */
public static synchronized void remove() {
Thread thread = Thread.currentThread();
ClassLoader classLoader = thread.getContextClassLoader();
remove(classLoader);
}

/**
 * Remove and shutdown the hierarchy for the specified class loader.
 * 
 * @param classLoader The classloader to create the hierarchy for.
 */
public static synchronized void remove(final ClassLoader classLoader) {
Hierarchy hierarchy = (Hierarchy)repositories.remove(classLoader);
hierarchy.shutdown();
}

}
/*
 * Copyright 2005 Revolution Systems Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.revolsys.logging.log4j;

import java.io.InputStream;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Hierarchy;
import org.apache.log4j.xml.DOMConfigurator;

/**
 * The Log4jServletContextListener class uses the
 * [EMAIL PROTECTED] ContextClassLoaderRepositorySelector} to maintain a separate Log4j
 * configuration for a servlet context and to load the logging configuration
 * from the log4j.xml file specified by the log4jXmlLocation context-param (or
 * /WEB-INF/log4j.xml if not specified).
 * 
 * @author Paul Austin
 * @version 1.0
 */
public class Log4jServletContextListener implements ServletContextListener {
/** The default location for the log4j.xml file. */
public static final String DEFAULT_LOG4J_XML_LOCATION = /WEB-INF/log4j.xml;

/**
 * Initialize the logging for context by creating a new heirarchy for the
 * current thread context class context and loading the configuration from
 * the log4jXmlLocation context-param.
 * 
 * @param event The servler context event.
 */
public void contextInitialized(ServletContextEvent event) {
Hierarchy hierarchy = ContextClassLoaderRepositorySelector.add();
ServletContext context = event.getServletContext();
String log4jXml = context.getInitParameter(log4jXmlLocation);
if (log4jXml == null) {
log4jXml = DEFAULT_LOG4J_XML_LOCATION;
}
try {
InputStream log4JConfig = context.getResourceAsStream(log4jXml);
if (log4JConfig != null) {
DOMConfigurator conf = new DOMConfigurator();
conf.doConfigure(log4JConfig, hierarchy);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}

/**
 * Clean up the context by removing the logging configuration for the
 * current context

Re: Tomcat 5.5 classloader log4j vs JCL issue

2005-08-31 Thread Wendy Smoak

From: Woodchuck [EMAIL PROTECTED]


then i installed a new web app that forced me to place
commons-logging.jar and log4j.jar into the ${Tomcat}/common/lib folder.
as a result, all my previous per web app logging no longer works.

does anyone have any suggestions on how i can have per web app logging
again?  i would like to keep my deployment process as web app isolated
as possible (ie. each web app deployed by WAR, drop it in and that's
it, no further steps necessary).


Is giving the uncooperative webapp its own Tomcat instance an option?

That's what I'd do.  I have a third-party app that insists on all kinds of 
special configuration.  I maintain the project as an expanded directory 
structure that overlays a Tomcat install.


--
Wendy Smoak 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat 5.5 classloader log4j vs JCL issue

2005-08-31 Thread Woodchuck
hihi Paul,

thanks so much for your help!  i will definitely give this a try and
post my results.

woodchuck


--- Paul Austin [EMAIL PROTECTED] wrote:

 Woodchuck,
 
 The following web page describes this situation and a solution to the
 problem.
 http://www.qos.ch/logging/sc.jsp
 
 I have attached the solution that I created this week based on the
 information above. To compile you will need servlet-api.jar and
 log4j.jar to compile.
 
 Include the jar you create from these files in your web application
 and
 then in your web.xml include the following sections.
 
 This section can be used if your log4j.xml is not
 under /WEB-INF/log4j.xml
   context-param
 param-namelog4jXmlLocation/param-name
 param-value/WEB-INF/log4j.xml/param-value
   /context-param
 
 The following calls invokes the listerner when the web app starts up
 to
 create a separate logging context for the web application.
 
   listener
 

listener-classcom.revolsys.logging.log4j.Log4jServletContextListener/listener-class
   /listener
 
 Also make sure you have a listener that does the following when the
 context is destroyed otherwise you'll get a log of PermGen out of
 memory
 errors after a number of redeploys
 
 Introspector.flushCaches();
 LogFactory.getFactory().release();
 
 Good luck,
 Paul





Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat 5.5 classloader log4j vs JCL issue

2005-08-31 Thread Seva Popov
Woodchuck,
 
I guess, the alternative solution is to have all your web apps use log4j
as well.
 
So, you have commons-logging.jar and log4j.jar in the
${Tomcat}/common/lib folder
and log4j.properties in ${Tomcat}/common/classes folder.
 
Just add into your each web app's WEB-INF/classes folder
log4j.properties file and
into WEB-INF/lib folder log4j.jar.
 
This way both Tomcat and your web apps will use separate log4j
configurations.
 
Thanks,
Seva
 


From: Paul Austin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 31, 2005 1:30 PM
To: Tomcat Users List
Subject: Re: Tomcat 5.5 classloader log4j vs JCL issue
 
Woodchuck,

The following web page describes this situation and a solution to the
problem.
http://www.qos.ch/logging/sc.jsp

I have attached the solution that I created this week based on the
information above. To compile you will need servlet-api.jar and
log4j.jar to compile.

Include the jar you create from these files in your web application and
then in your web.xml include the following sections.

This section can be used if your log4j.xml is not under
/WEB-INF/log4j.xml
  context-param
param-namelog4jXmlLocation/param-name
param-value/WEB-INF/log4j.xml/param-value
  /context-param

The following calls invokes the listerner when the web app starts up to
create a separate logging context for the web application.

  listener
 
listener-classcom.revolsys.logging.log4j.Log4jServletContextListener/
listener-class
  /listener

Also make sure you have a listener that does the following when the
context is destroyed otherwise you'll get a log of PermGen out of memory
errors after a number of redeploys

Introspector.flushCaches();
LogFactory.getFactory().release();

Good luck,
Paul

On Wed, 2005-08-31 at 13:03 -0700, Woodchuck wrote: 
 
hihi all,
 
on my TC 5.5.9 installation i deployed several web applications that
uses the default JCL logging.  that is, i placed a simple
logging.properties file into each web app's WEB-INF/classes folder and
i have per web app logging.  everything works beautifully.
 
then i installed a new web app that forced me to place
commons-logging.jar and log4j.jar into the ${Tomcat}/common/lib folder.
 as a result, all my previous per web app logging no longer works.
 
i believe this is because log4j was discovered in the
${Tomcat}/common/lib first, and therefore it has superceeded any other
logging system at the (lower) web app level.  this is due to Tomcat's
classloading process.
 
the reason this new web app required commons-logging.jar and log4j.jar
to be placed specifically into the ${Tomcat}/commons/lib folder is
because it instantiates a log4j logger object in it's start-up servlet
which extends HttpServlet which is found in the servlet-api.jar which
is also in the ${Tomcat}/commons/lib folder.  this is because Tomcat's
classloading hierarchy dictates that classes in the common/lib cannot
see web app classes 'downstream'.
 
does anyone have any suggestions on how i can have per web app logging
again?  i would like to keep my deployment process as web app isolated
as possible (ie. each web app deployed by WAR, drop it in and that's
it, no further steps necessary).
 
thanks in advance,
woodchuck
 
 
   

Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: Tomcat 5.5 classloader log4j vs JCL issue

2005-08-31 Thread Woodchuck
hihi Wendy,

hehe.  that also crossed my mind, i wish that was an option, but i
can't unfortunately.:)

woodchuck


--- Wendy Smoak [EMAIL PROTECTED] wrote:
 
 Is giving the uncooperative webapp its own Tomcat instance an option?
 
 That's what I'd do.  I have a third-party app that insists on all
 kinds of 
 special configuration.  I maintain the project as an expanded
 directory 
 structure that overlays a Tomcat install.
 
 -- 
 Wendy Smoak 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



re: how do others deal with classloader not being recycled

2005-07-28 Thread Dirk Weigenand
Hi,

 I am assuming that this FAQ entry is still valid for Tomcat 5.5.9:
   Why does the memory usage increase when I redeploy a web application?
 Because the Classloader (and the Class objects it loaded) cannot be
 recycled. They are stored in the permanent heap generation by the JVM,
 and when you redepoy a new class loader is created, which loads another
 copy of all these classes. This can cause OufOfMemoryErrors eventually.
 
   This could explain why, when I redeploy my webapp many times, I
 eventually run out of PermMemory.
 
   I am curious what others do, in production, because of this issue?
 

Have a look at the following page:

http://wiki.apache.org/jakarta-commons/Logging/UndeployMemoryLeak

   We are going to be doing some testing to see about optimizing the
 memory allocation, but I am curious how others handle this.
 
 Thanx.

Regards

  Dirk

-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



re: how do others deal with classloader not being recycled

2005-07-27 Thread James Black
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I am assuming that this FAQ entry is still valid for Tomcat 5.5.9:
  Why does the memory usage increase when I redeploy a web application?
Because the Classloader (and the Class objects it loaded) cannot be
recycled. They are stored in the permanent heap generation by the JVM,
and when you redepoy a new class loader is created, which loads another
copy of all these classes. This can cause OufOfMemoryErrors eventually.

  This could explain why, when I redeploy my webapp many times, I
eventually run out of PermMemory.

  I am curious what others do, in production, because of this issue?

  We are going to be doing some testing to see about optimizing the
memory allocation, but I am curious how others handle this.

Thanx.

- --
Love is mutual self-giving that ends in self-recovery. Fulton Sheen
James Black[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC59l3ikQgpVn8xrARAjvhAJ0Xus3w6FptvBZhye3wmDbAWkv8ewCfbIZx
CmT6TVS6E22dVdt4p6CyDiU=
=Q+Kv
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RMI classloader issues in TC - second time

2005-06-05 Thread Nikola Milutinovic

Hi all.

I have been mucking around this for some time and have some empirical 
data and a question for the list.


BACKGROUND
---

I'm building a web client for a RMI client/server application. RMI 
server and client are working from command line. Next I built 
JSP/Servlet which uses that RMI client interface to give web GUI to the 
application.


RMI server: SearchServerStub implements SearchRMI
RMI Stub: SearchServerStub_Stub (I'm running in JDK 1.5.0, thus no 
*_Skel class)

RMI client: SearchClientRMI

Whenever my Servlet/JSP executes a method of SearchClientRMI, which has 
this in it:


SearchRMI server = (SearchRMI) Naming.lookup( rmi://localhost/Search );

I get a ClassCastException: SearchSearverStub_Stub. I have inspected 
this from a debugger (JBuilder) and the class that is returned from 
Naming.lookup(...) is SearchServerStub_Stub, which DOES implement 
SearchRMI.


TRIALERROR
--

Well, fiddling around with the whole setup has given me a situation 
under which this works. If I copy SearchServerStub_Stub into 
WEB-INF/classes I do not get the exception.


CONCLUSION
--

I can say with 99% certainty that this is a classloader issue. TC sets 
up a classloader for my web-app which reads from WEB-INF/{classes,lib} - 
that I know. RMI has it's own classloader, as it must - that I also 
know. It looks like the class loaded by one classloader cannot mix with 
a class from another. I believe I have read something like that in one 
JBoss article. In this case my local webapp classloader is first 
queried, I guess, and it loads the requested class from it's classpath. 
In unsuccessful case, the _Stub class was loaded by RMI's classloader 
and thus the difference.


QUESTION
-

Given my situation, what is your recomendation I should do?

I can copy stub classes to the client, but that is awkward and IT IS NOT 
what RMI was intended for. It was intended for transparent and network 
located classloading. If I have to copy RMI stub classes (and, I 
suspect, implementation classes, too) to the client (web application, in 
this case), then I'm better off not using RMI at all. Can someone 
advise? Has anyone been bitten by this?


I think this is mostly intended for the TC developers, not to forget 
JBoss group, too. But, anyone who has insight into this matter is 
welcome. I'm relieved to have a working solution, even if it is a 
patch-quality. I will have to evaluate the applicability of RMI in this 
situation.


It could be that I'm doing something wrong here. Just to note, I'm not 
setting on TC anything RMI specific, like -Djava.rmi.server.codebase, 
only the security policy (and, boy, does that need being relaxed, I had 
to open connection to TCP ports 1024-65535).


TYIA,
Nix.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



TC and RMI ClassLoader issue

2005-05-28 Thread Nikola Milutinovic

Hi all.

I'm having problems with ClassLoader. I have a RMI client that calls a 
RMI server. What I keep getting as an error is a ClassCastException. 
This is the code:


   Object obj = Naming.lookup(url);
   search = (SearchRMI) obj;

And the exception is:

java.lang.ClassCastException
   at 
com.qspi.client.search.SearchClientRMI.setHost(SearchClientRMI.java:49)
   at 
com.qspi.client.search.SearchClientRMI.init(SearchClientRMI.java:33)
   at 
com.qspi.client.search.SearchClientFactory.getRMIClient(SearchClientFactory.java:87)
   at 
com.qspi.client.search.SearchClientFactory.getSearchClient(SearchClientFactory.java:38)


   at org.apache.jsp.search_jsp._jspService(search_jsp.java:68)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
   at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)

   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
...

The client code works flawlessly from a JUnit test.

What I have determined is that the object returned by 
Naming.lookup(...) is of a RMI ClassLoader. The returned object is a 
stub, which implements the SearchRMI, but if it is a different 
ClassLoader, I guess it cannot cast. I'm not sure why that isn't failing 
in JUint, but it is failing in Tomcat 5.0.x. I'm going to test it on 
some other installations I have, but I'd like a good explanation on 
ClassLoaders, if someone can enlighten me.


How do others do this? Are there any tutorials for RMI in Servlets?

Nix.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



I can not replace a classloader using Loader tag.

2005-04-26 Thread Hideaki HIBINO
Hello,
(B
(BI am trying to replace the default classloader of Tomcat to a
(Bclassloader that I customized. I red the manual for customizing
(Bit (server configuration on Jakarta tomcat site) and wrote the
(Bfollowing configuration in context configuration file.
(B
(B!-- ${CATALINA_HOME}/conf/Catalina/localhost/myapp.xml --
(BContext path="/myapp" docBase="${catalina.home}/webapps/myapp"
(Bdebug="1" privileged="true"
(B  Loader className="org.apache.catalina.loader.WebappLoader" /
(B/Context
(B
(BBut, I cannot change into customized classloader, and I am
(Bgetting the following error now.
(B
(BWhats wrong with the configuration?
(BCould somebody help me, please?
(B
(B
(B
(B!-- ${CATALINA_HOME}/logs/localhost_log.2005-04-26.txt --
(B
(B2005-04-26 16:52:18
(BStandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter:
(Binit(): ruleChain: [org.apache.webapp.balancer.RuleChain:
(B[org.apache.webapp.balancer.rules.URLStringMatchRule: Target string:
(BNews / Redirect URL: http://www.cnn.com],
(B[org.apache.webapp.balancer.rules.RequestParameterRule: Target param
(Bname: paramName / Target param value: paramValue / Redirect URL:
(Bhttp://www.yahoo.com],
(B[org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL:
(Bhttp://jakarta.apache.org]]
(B2005-04-26 16:52:18 StandardContext[/myapp]Marking servlet default as
(Bunavailable
(B2005-04-26 16:52:18 StandardContext[/myapp]Error loading WebappClassLoader
(B  delegate: false
(B  repositories:
(B/WEB-INF/classes/
(B-- Parent Classloader:
(BStandardClassLoader
(B  delegate: true
(B  repositories:
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/shared/classes/
(B-- Parent Classloader:
(BStandardClassLoader
(B  delegate: true
(B  repositories:
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/classes/
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/endorsed/xercesImpl.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/endorsed/xmlParserAPIs.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/ant.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/commons-collections.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/commons-dbcp-1.1.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/commons-el.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/commons-pool-1.1.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/jasper-compiler.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/jasper-runtime.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/jsp-api.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/naming-common.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/naming-factory.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/naming-java.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/naming-resources.jar
(B
(Bfile:/workA/csg/hibino/tomcat/jakarta-tomcat-5.0.25-new/common/lib/servlet-api.jar
(B-- Parent Classloader:
(B[EMAIL PROTECTED]
(B
(B
(B org.apache.catalina.servlets.DefaultServlet
(Bjava.lang.ClassNotFoundException:
(Borg.apache.catalina.servlets.DefaultServlet
(Bat
(Borg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
(Bat
(Borg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
(Bat
(Borg.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:954)
(Bat
(Borg.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
(Bat
(Borg.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3991)
(Bat
(Borg.apache.catalina.core.StandardContext.start(StandardContext.java:4335)
(Bat
(Borg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
(Bat
(Borg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
(Bat
(Borg.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
(Bat
(Borg.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)
(Bat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
(Bat
(Bsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
(Bat
(Bsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
(Bat java.lang.reflect.Method.invoke(Method.java:324)
(Bat
(Borg.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
(Bat org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)

RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-22 Thread Caldarale, Charles R
 From: Akoulov, Alexandre [IT] [mailto:[EMAIL PROTECTED]

 Subject: RE: Problem with the classloader in 
 jakarta-tomcat-5.0.28 - cannot add a jar file to class repository
 
 However, if you add a reference to the actual jar file (eg, 
 shared.loader=${catalina.home}/shared/lib/velocity-dep-1.3.1.j
 ar) you will not be able to use any classes from it but 
 rather will get ClassNotFoundException. This is the actual problem!

This appears to be the same situation described in Bugzilla entry 23344
(see
http://issues.apache.org/bugzilla/show_bug.cgi?id=23344
for details) which was marked as fixed in September 2003 in level
5.0.12.  Apparently, individual jars should be added as URLs rather than
normal file system paths.  I suppose that means using
file:///path/file.jar, but I haven't tried it.

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-22 Thread Akoulov, Alexandre [IT]
Apparently, individual jars should be added as URLs rather than
normal file system paths.  I suppose that means using
file:///path/file.jar, but I haven't tried it.

I guess that would work because Bootstrap.java has the following piece of code 
in its createClassLoader(String, ClassLoader)

-
// Check for a JAR URL repository
try {
urlList.add(new URL(repository));
continue;
} catch (MalformedURLException e) {
// Ignore
}
-

Chuck, but would not be better if we fix the actual problem in the 
ClassLoaderFactory#createClassLoader. Then people would not be spending time 
working out why they cannot load a jar file :)  We already have a fix - see 
below :

---FIX-in 
ClassLoaderFactory#createClassLoader---
// Add unpacked directories
//if (unpacked != null) {
//for (int i = 0; i  unpacked.length; i++)  {
//File file = unpacked[i];
//if (!file.exists() || !file.canRead())
//continue;
//if (debug = 1)
//log(  Including directory or JAR  
//+ file.getAbsolutePath());
//URL url = new URL(file, null,
//  file.getCanonicalPath() + File.separator);
//list.add(url.toString());
//}
//}
// 
if (unpacked != null) {
for (int i = 0; i  unpacked.length; i++)  {
File file = unpacked[i];
if (!file.exists() || !file.canRead())
continue;
if (debug = 1)
log(  Including directory or JAR  
+ file.getAbsolutePath());

// THE FIX !!!
StringBuffer filePath = new 
StringBuffer(file.getCanonicalPath());
if ( file.isDirectory() ) { 
// Only add a file separator if a file represents a 
directory
filePath.append(File.separator);
}

URL url = new URL(file, null, filePath.toString());
list.add(url.toString());
}
}




Please let me know what you think




-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED]
Sent: Friday, 22 April 2005 4:09 PM
To: Tomcat Users List
Subject: RE: Problem with the classloader in jakarta-tomcat-5.0.28 -
cannot add a jar file to class repository


 From: Akoulov, Alexandre [IT] [mailto:[EMAIL PROTECTED]

 Subject: RE: Problem with the classloader in 
 jakarta-tomcat-5.0.28 - cannot add a jar file to class repository
 
 However, if you add a reference to the actual jar file (eg, 
 shared.loader=${catalina.home}/shared/lib/velocity-dep-1.3.1.j
 ar) you will not be able to use any classes from it but 
 rather will get ClassNotFoundException. This is the actual problem!

This appears to be the same situation described in Bugzilla entry 23344
(see
http://issues.apache.org/bugzilla/show_bug.cgi?id=23344
for details) which was marked as fixed in September 2003 in level
5.0.12.  Apparently, individual jars should be added as URLs rather than
normal file system paths.  I suppose that means using
file:///path/file.jar, but I haven't tried it.

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-22 Thread Caldarale, Charles R
 From: Akoulov, Alexandre [IT] [mailto:[EMAIL PROTECTED]

 Subject: RE: Problem with the classloader in 
 jakarta-tomcat-5.0.28 - cannot add a jar file to class repository
 
 Please let me know what you think

It doesn't really matter what I think - I'm not a Tomcat developer.  If
you believe the area needs changing, you'll need to submit a Bugzilla
report and convince Remy.  Best if you report it against the 5.5 leg,
since that's the one under active development.

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-21 Thread Akoulov, Alexandre [IT]
Hi all,

I'd greatly appreciate your thoughts on the following issue (and the proposed 
solution ):



When adding a jar file (eg, foo/bar.jar) to the class loader's repository it 
treats as a directory and therefore it cannot load any classes from this jar. 
The following explains why it happens.

org.apache.catalina.startup.ClassLoaderFactory is responsible for creating 
class loader instances. Each instance is of 
org.apache.catalina.loader.StandardClassLoader type, which in its turn extends 
java.net.URLClassLoader:
-
public class StandardClassLoader extends URLClassLoader
-

ClassLoaderFactory#createClassLoader(File unpacked[], File packed[], URL 
urls[], ClassLoader parent) is the actual method that creates class loaders. 
The very first argument to this method contains jar files or directories ( that 
is where the name unpacked comes from ). 

ClassLoaderFactory#createClassLoader method adds File.separator to the end of 
the jar file path ( file.getCanonicalPath() + File.separator ) when 
constructing a URL instance to represent a jar file and then adds a string 
representation of a newly created URL to its list of repositories ( 
list.add(url.toString()) ) :
-
if (unpacked != null) {
for (int i = 0; i  unpacked.length; i++)  {
File file = unpacked[i];
if (!file.exists() || !file.canRead())
continue;
if (debug = 1)
log(  Including directory or JAR  
+ file.getAbsolutePath());
URL url = new URL(file, null,
  file.getCanonicalPath() + 
File.separator);
list.add(url.toString());
}
}
-

For instance, if unpacked argument contains '/home/aa/lib/velocity.jar' 
then a URL object is 'file:/home/aa/lib/velocity.jar/' - a forward slash / 
(which is a Unix file separator) has been added to the url.

After ClassLoaderFactory#createClassLoader adds all repositories to its 
repository list it converts this list to array and constructs 
StandardClassLoader with it:

-
String array[] = (String[]) list.toArray(new 
String[list.size()]);
StandardClassLoader classLoader = null;
if (parent == null)
classLoader = new StandardClassLoader(array);
-

StandardClassLoader( String[] ) constructor converts each repository found in 
the given array argument to a URL object:
-
protected static URL[] convert(String input[], 
URLStreamHandlerFactory factory) {
.
url[i] = new URL(null, input[i], streamHandler);
.
}
-
   
For instance, if the repositories array of String type contains 
'file:/home/aa/lib/velocity.jar/' then a URL object is 
'file:/home/aa/lib/velocity.jar/'. If the repository holds a path on Windows 
machine then the URL object would have all backslashes  replaced all  with 
forward slashes ( URL object crated with new URL(null, 
file:I:\lib\velocity.jar\, streamHandler) would have 
file:I:/lib/velocity.jar/ string representation ).

Once StandardClassLoader( String[] ) converts repository array of a String type 
into a URL type it calls its super constructor, which in fact is a 
URLClassLoader( URL[] ).

However, the contract for URLClassLoader( URL[] ) constructor indicates that 
Any URL that ends with a '/' is assumed to refer to a directory.  and 
therefore a jar file gets ignored by the loader.

For instance, if the repositories array contains 
'file:/home/aa/lib/velocity.jar/' url object the URLClassLoader( URL[] ) 
constructor treats this url as a directory and therefore a jar file is never 
properly loaded.


Therefore, a File.separator that got added to a jar file in 
ClassLoaderFactory#createClassLoader method made it invalid because the actual 
class loader assumes that this jar file is a directory.

==
Proposed solution
==

ClassLoaderFactory

RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-21 Thread Caldarale, Charles R
 From: Akoulov, Alexandre [IT] [mailto:[EMAIL PROTECTED]

 Subject: Problem with the classloader in 
 jakarta-tomcat-5.0.28 - cannot add a jar file to class repository
 
 ClassLoaderFactory#createClassLoader(File unpacked[], File 
 packed[], URL urls[], ClassLoader parent) is the actual 
 method that creates class loaders. The very first argument to 
 this method contains jar files or directories ( that is where 
 the name unpacked comes from ). 

From what I can tell, it's the _second_ argument that should contain
.jar files; the first is for directories only.

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-21 Thread Akoulov, Alexandre [IT]
Thanks Chuck for your reply.

I still think it is a bug!!! 

Please try the following: add a jar file (eg, foo/bar.jar) as a class 
repository in the catalina.properties and then use one of the classes from this 
jar file in one the servlets - will get a ClassNotFoundException.

I've attached ClassLoaderFactoryTest.java and 
ClassLoaderFactoryWithTheFix.java. Please try to run the test - one of the 
tests will fail, refer to the place where it fails and read the comments.


Kind regards,

Alex.



-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED]
Sent: Thursday, 21 April 2005 9:27 PM
To: Tomcat Users List
Subject: RE: Problem with the classloader in jakarta-tomcat-5.0.28 -
cannot add a jar file to class repository


 From: Akoulov, Alexandre [IT] [mailto:[EMAIL PROTECTED]

 Subject: Problem with the classloader in 
 jakarta-tomcat-5.0.28 - cannot add a jar file to class repository
 
 ClassLoaderFactory#createClassLoader(File unpacked[], File 
 packed[], URL urls[], ClassLoader parent) is the actual 
 method that creates class loaders. The very first argument to 
 this method contains jar files or directories ( that is where 
 the name unpacked comes from ). 

From what I can tell, it's the _second_ argument that should contain
.jar files; the first is for directories only.

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-Original Message-
From: Akoulov, Alexandre [IT] 
Sent: Thursday, 21 April 2005 6:29 PM
To: tomcat-user@jakarta.apache.org
Subject: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot
add a jar file to class repository


Hi all,

I'd greatly appreciate your thoughts on the following issue (and the proposed 
solution ):



When adding a jar file (eg, foo/bar.jar) to the class loader's repository it 
treats as a directory and therefore it cannot load any classes from this jar. 
The following explains why it happens.

org.apache.catalina.startup.ClassLoaderFactory is responsible for creating 
class loader instances. Each instance is of 
org.apache.catalina.loader.StandardClassLoader type, which in its turn extends 
java.net.URLClassLoader:
-
public class StandardClassLoader extends URLClassLoader
-

ClassLoaderFactory#createClassLoader(File unpacked[], File packed[], URL 
urls[], ClassLoader parent) is the actual method that creates class loaders. 
The very first argument to this method contains jar files or directories ( that 
is where the name unpacked comes from ). 

ClassLoaderFactory#createClassLoader method adds File.separator to the end of 
the jar file path ( file.getCanonicalPath() + File.separator ) when 
constructing a URL instance to represent a jar file and then adds a string 
representation of a newly created URL to its list of repositories ( 
list.add(url.toString()) ) :
-
if (unpacked != null) {
for (int i = 0; i  unpacked.length; i++)  {
File file = unpacked[i];
if (!file.exists() || !file.canRead())
continue;
if (debug = 1)
log(  Including directory or JAR  
+ file.getAbsolutePath());
URL url = new URL(file, null,
  file.getCanonicalPath() + 
File.separator);
list.add(url.toString());
}
}
-

For instance, if unpacked argument contains '/home/aa/lib/velocity.jar' 
then a URL object is 'file:/home/aa/lib/velocity.jar/' - a forward slash / 
(which is a Unix file separator) has been added to the url.

After ClassLoaderFactory#createClassLoader adds all repositories to its 
repository list it converts this list to array and constructs 
StandardClassLoader with it:

-
String array[] = (String[]) list.toArray(new 
String[list.size()]);
StandardClassLoader classLoader = null;
if (parent == null)
classLoader = new StandardClassLoader(array

RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-21 Thread Caldarale, Charles R
 From: Akoulov, Alexandre [IT] [mailto:[EMAIL PROTECTED]

 Sent: 2005 April 21, Thursday 19:48
 Subject: RE: Problem with the classloader in 
 jakarta-tomcat-5.0.28 - cannot add a jar file to class repository
 
 I still think it is a bug!!! 

Read the javadoc for the class in question.  (The full URL is
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/catalina/docs/api/org/ap
ache/catalina/startup/ClassLoaderFactory.html#createClassLoader(java.io.
File[],%20java.io.File[],%20java.net.URL[],%20java.lang.ClassLoader).)
The first parameter is for directories, the second for jars, which is
why they're named unpacked and packed, respectively.  

 Please try the following: add a jar file (eg, foo/bar.jar) as 
 a class repository in the catalina.properties

The standard catalina.properties already has several jars and several
directories specified for the various class loaders, and they all seem
to work fine in the levels I'm using (5.0.28 and 5.5.7) - otherwise
Tomcat wouldn't even be able to start up.  What specifically did you
change in catalina.properties that led you to believe there's a problem?

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository

2005-04-21 Thread Akoulov, Alexandre [IT]
The standard catalina.properties already has several jars and several
directories specified for the various class loaders,

standard catalina.properties has refs to *.jar (eg, 
${catalina.home}/common/endorsed/*.jar) not to the actual jar file. 

Bootstrap.java then checks whether there is *.jar at the end of the path, 
strips it from the path and then adds to the packed list. If the path ends in 
anything other than *.jar it gets added to unpacked list (that is where the 
jar file ends up)

--
if (repository.endsWith(*.jar)) {
packed = true;
repository = repository.substring
(0, repository.length() - *.jar.length());
}
if (packed) {
packedList.add(new File(repository));
} else {
unpackedList.add(new File(repository));
}
--

However, if you add a reference to the actual jar file (eg, 
shared.loader=${catalina.home}/shared/lib/velocity-dep-1.3.1.jar) you will not 
be able to use any classes from it but rather will get ClassNotFoundException. 
This is the actual problem!



Read the javadoc for the class in question.  (The full URL is
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/catalina/docs/api/org/ap
ache/catalina/startup/ClassLoaderFactory.html#createClassLoader(java.io.
File[],%20java.io.File[],%20java.net.URL[],%20java.lang.ClassLoader).)


Well, the java doc says that packed - Array of pathnames to DIRECTORIES 
CONTAINING JAR files that should be added to the repositories of the class 
loader, or null for no directories of JAR files to be considered (not the 
actual jar files). 
At the same time java doc indicates that unpacked - Array of pathnames to 
unpacked directories that should be added to the repositories of the class 
loader, or null for no unpacked directories to be considered. I guess here it 
means that a jar file is already considered to be unpacked directory. This 
conclusion can be drawn from the Bootstrap.java code extract (see above) and 
more importantly from the actual ClassLoaderFactory#createClassLoader method's 
source:



if (unpacked != null) {
for (int i = 0; i  unpacked.length; i++)  {
File file = unpacked[i];
if (!file.exists() || !file.canRead())
continue;
if (debug = 1)
log(  Including directory or JAR   // LOOK HERE - expects 
directory or a JAR file
+ file.getAbsolutePath());
..
..
if (packed != null) {
for (int i = 0; i  packed.length; i++) {
File directory = packed[i];
if (!directory.isDirectory() || !directory.exists() ||
!directory.canRead())   // LOOK HERE - only expects to 
find directories in here, not the files!!!
continue;



-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED]
Sent: Friday, 22 April 2005 3:13 PM
To: Tomcat Users List
Subject: RE: Problem with the classloader in jakarta-tomcat-5.0.28 -
cannot add a jar file to class repository


 From: Akoulov, Alexandre [IT] [mailto:[EMAIL PROTECTED]

 Sent: 2005 April 21, Thursday 19:48
 Subject: RE: Problem with the classloader in 
 jakarta-tomcat-5.0.28 - cannot add a jar file to class repository
 
 I still think it is a bug!!! 

Read the javadoc for the class in question.  (The full URL is
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/catalina/docs/api/org/ap
ache/catalina/startup/ClassLoaderFactory.html#createClassLoader(java.io.
File[],%20java.io.File[],%20java.net.URL[],%20java.lang.ClassLoader).)
The first parameter is for directories, the second for jars, which is
why they're named unpacked and packed, respectively.  

 Please try the following: add a jar file (eg, foo/bar.jar) as 
 a class repository in the catalina.properties

The standard catalina.properties already has several jars and several
directories specified for the various class loaders, and they all seem
to work fine in the levels I'm using (5.0.28 and 5.5.7) - otherwise
Tomcat wouldn't even be able to start up.  What specifically did you
change in catalina.properties that led you to believe there's a problem?

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED

System ClassLoader problem on Linux running Hipergate on Tomcat?

2005-03-17 Thread Lee Hammond
)
at
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:407)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
95)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137
)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118
)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:705)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
at java.lang.Thread.run(Thread.java:534)
 
2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
sessionDestroyed('AA89D380700D2E70151385DD9E96D9EE')
2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
attributeRemoved('AA89D380700D2E70151385DD9E96D9EE', 'table',
'[EMAIL PROTECTED]')
2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
attributeRemoved('AA89D380700D2E70151385DD9E96D9EE',
'javax.servlet.jsp.jstl.fmt.request.charset', 'UTF-8')
2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
attributeRemoved('AA89D380700D2E70151385DD9E96D9EE', 'theTruth', 'true')

It seems to be a system classLoader problem, which (according to:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
System - This class loader is normally initialized from the contents of the
CLASSPATH environment variable. All such classes are visible to both Tomcat
internal classes, and to web applications. where: However, the standard
Tomcat 4 startup scripts ($CATALINA_HOME/bin/catalina.sh or
%CATALINA_HOME%\bin\catalina.bat) totally ignore the contents of the
CLASSPATH environment variable itself (bizarre?!). Is Tomcat 5 the same?
Besides I'm running from the command: 

[EMAIL PROTECTED] (in tomcat root)]# ./bin/jsvc
-Djava.endorsed.dirs=./common/endorsed -Dfile.encoding=UTF-8 -cp
./bin/bootstrap.jar -outfile ./logs/catalina.out -errfile
./logs/catalina.err org.apache.catalina.startup.Bootstrap

Running bin/startup.sh crashes my shell (for the same reason as this issue I
think).

I've tried numerous combinations of CLASSPATH(S), PATH(S) and JAVA_HOME
variables in different orders to no avail. I've also updated /etc/profile so
that these are global and persistent.

The variables are currently set at:

PATH=$PATH:/opt/SUNWappserver/bin

RE: System ClassLoader problem on Linux running Hipergate on Tomcat?

2005-03-17 Thread Caldarale, Charles R
 From: Lee Hammond [mailto:[EMAIL PROTECTED]
 Subject: System ClassLoader problem on Linux running Hipergate on Tomcat?
 
 Well, I've got J2EE in it's default place /opt/ and Tomcat 5.0.30
 in /opt too and everything is now working fine.

Tomcat doesn't need the J2EE download, and, in some situations, it can cause 
problems.  (Don't know if Hipergate needs anything from it, but I would hope 
not.)  You should install just the JDK (it has its own JRE), and JAVA_HOME 
should point to that.

   Unable to find a javac compiler;
   com.sun.tools.javac.Main is not on the classpath.
   Perhaps JAVA_HOME does not point to the JDK

More evidence that you have JAVA_HOME pointing to the wrong place, perhaps to 
the JRE or J2EE instead of the JDK.  Need to make sure that 
/appropriate_path/tools.jar appears somewhere in the classpath used to launch 
Tomcat.  Do NOT use the CLASSPATH environment variable; the only jars you need 
on the eventual -cp parameter used to start Tomcat are tools.jar (from the JDK) 
and bootstrap.jar (from the Tomcat bin directory).

 It seems to be a system classLoader problem, which (according to:
 http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

If you're running 5.0.30, why are you looking at the doc for 4.1?

Can you run javac yourself?  I.e., does 
java -cp $JAVA_HOME/lib/tools.jar com.sun.tools.javac.Main
do anything useful?  (It should show you a list of the javac options.)

 - Chuck


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ClassLoader question

2005-01-26 Thread Li Ma
Hi there,

I embedded Tomcat Embedded edition into my app. Here's a brief folder
structureof my app:

/
lib
bin
Tomcat
lib
webapps
myapp
WEB-INF
lib

I create a classloader to automatically load jars from lib, bin and
Tomcat/lib. But after myapp is started, it complains that class
org/apache/commons/logging/LogFactory is not found. I'm sure the class is in
/lib/commons-logging.jar which should be loaded by my classloader. 

I think it might have something to do with Tomcat's classloader hierarchy. I
read the related article a few times, didn't find any solution for my
problem. Since my app needs about 100 jars to start, a customized
classloader will help a lot for easy deployment. Anybody has similar
experience?

Thanks!


Li Ma
Ideal Technologies Inc.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Classloader problem with ant versions

2005-01-19 Thread Jagadeesh Sunkara
Hello Group,
Is there any way to make tomcat use ant.jar from my web application's
web-inf/lib instead of the one from tomcat/common/lib?
 
I need this as my web app uses ant 1.6.2 but where tomcat 5.0.28 comes with
ant 1.6.1 
 
Any help/pointers is appreciated...
 
Thanks,
Jagadeesh


Tomcat classloader problem with different ant versions

2005-01-18 Thread Jagadeesh Sunkara
Hello,
I am getting the following error when I deploy and run my application under
tomcat 5.0.28. The problem is that tomcat is using the ant.jar from
tomcat/common/lib directory. But I want to use the one from my web
application's WEB-INF/lib. How can I make tomcat use the ant 1.6.2 from my
application's web-inf/lib instead of ant 1.6.1 from tomcat/common/lib?
 
Replacing the ant.jar in tomcat/common/lib is not an option here as the
tomcat installation/environment is not controlled by us. 
 
Appreciate if someone can tell me how to make tomcat use my own version of
jar. 
 
Thanks,
Jagadeesh
 
Invalid implementation version between Ant core and Ant optional tasks.

 core: 1.6.1

 optional: 1.6.2

Invalid implementation version between Ant core and Ant optional tasks.

 core: 1.6.1

 optional: 1.6.2

  at
org.apache.tools.ant.Diagnostics.validateVersion(Diagnostics.java:76)

  at com.crm.utils.AntRunner.startAnt(Unknown Source)

  at com.crm.utils.AntRunner.startAnt(Unknown Source)

  at
com.ssa.crm.actions.CodeGenAction.handleRequest(CodeGenAction.java:189)



Programmatically add ClassLoader for Embedded tomcat

2005-01-17 Thread Iwan Vosloo
Hi there,

Assuming I have programmatic access to tomcat only (I run am Embedded tomcat), 
how can I either:
a) append more paths to search for classes in an existing ClassLoader; or
b) create and add my own custom Loader or ClassLoader in the chain?

Thanks
-Iwan Vosloo

Powered by Tiscali - http://www.tiscali.co.za



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Tomcat 4.1.24, Classloader problems

2005-01-17 Thread James Milks
Hi all,
Having a weird problem that is driving me nuts.

In the past week, every time I update a supporting class (Not a servlet
or JSP) and refresh my page, I get all kinds of null pointer exceptions
and must log out and back into my application or restart Tomcat. This is
a pain in development. FYI - I do have the app set to reload=true.

I looked into the stdout.log file and noticed the following messages:
-
TimeOut
WebAppClassLoader:Lifecycle Error: CL Stopped.
-
Sometimes it appears several dozen times in a row, almost like some sort
of loop is causing the output. A quick restart and everything is ok
again...for a while anyway.

I've not seen this before with Tomcat 4 or 5. 

Any help appreciated.

JW





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Classloader/Resource handling differences between 5.0 and 5.5?

2005-01-10 Thread David Ramsey
I saw an offhand comment from Yoav about differences between 5.0 and
5.5 in resource loading and class loading. He mentioned some change
was made due to Windows usage of file handles.

Under 5.0.x and JDK 1.4.2_06 under Windows 2000 SP4, our web
application works fine. However, under JDK 5 and Tomcat 5.5.4 (only
one tested so far), we're seeing XSL files that include other XSL
files generate I/O errors and the included file is not found.

Now, all file references are from the webapp base dir and are relative
pathnames. Our JSPs are in a folder named webapp/jsp and the XSLs are
in webapp/xsl with references being done relatively:
../xsl/mystylesheet.xsl.

This worked without issue in 4.x and 5.0.x but as I noted causes
errors now in 5.5.4. It seems, from Yoav's comments that something has
changed but I cannot find anything clear in terms of documentation on
this.

Does anyone have any pointers, articles, or whatnot that will help me
either in configuring our webapp or changing what we've done to be
compliant with the new resource loading semantics? Searching so far
has not yielded anything that was obvious to me.

Thanks in advance!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Gurus! JCE and classloader question

2005-01-05 Thread Lionel Pasquier
Arg... My bad
The test has been done, but a jar was remaining in the WEB-INF

Antony Paul wrote:
May be there are two jar files or unzipped class files of the same
class. Check for it also.
rgds
Antony Paul
On Thu, 23 Dec 2004 16:22:33 +0100, Lionel Pasquier
[EMAIL PROTECTED] wrote:
 

Well, I tried to put the library in common/lib (and I think also for a
different try, in shared/lib). Usually it is in WEB-INF/lib.
But the problem occured also.
I believe that the factory used by the jvm searches for the first
instance of the JCE. Then it tries to cast it into another instance of
the lib which is different from the first, but I am not too sure about
that since I am no expert in Tomcat.
Have you an explanation or any solution?
Antony Paul wrote:
   

Where you put the provider jar file ?. WEB-INF/lib ?. Try putting it
in shared/lib or common/lib if the same jar file is used by multiple
applications.
rgds
Antony Paul
On Thu, 23 Dec 2004 15:01:04 +0530, Antony Paul [EMAIL PROTECTED] wrote:
 

Which JCE provider you are using ?
rgds
Antony Paul
On Tue, 21 Dec 2004 20:06:40 +0100, Lionel Pasquier
[EMAIL PROTECTED] wrote:
   

Hello again!
Any guru around to solve my problem please? :-)
Lionel Pasquier wrote:

 

Hello,
I have a trouble with using a JCE and multiple contexts. From what I
could have read around here this is probably linked to a classloader
problem. Could you guys help?
Basicaly, I generate a RSA Keypair, then create a certificate and want
to self sign it. Finally i need to store the private key to create a
p12. Here is the code: I am using the IAIK JCE.
KeyPair keyPair;
IAIK IAIKprovider = new IAIK();
Security.insertProviderAt(IAIKprovider, 2);
KeyPairGenerator keyPairGenerator =
KeyPairGenerator.getInstance(RSA, IAIKprovider.getName());
keyPairGenerator.initialize(keySize);
keyPair = keyPairGenerator.generateKeyPair();
X509Certificate cert;
[...]
cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(),
IAIKprovider.getName());
if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){
 error(Generated RSA private key is not of type RSA!);
}
KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(),
certLabel, certLabel.getBytes());
The problem is that if I have more than one tomcat context using the
same pice of code, the 2nd context to use it triggers the if (that
is, without it I get a ClassCastException). Meaning that the generated
private key is not compatible with RSAPrivateKey, while I asked for a
RSA key.
I also have the same problem with the other way around:
CertificateFactory certFactory =
CertificateFactory.getInstance(X.509, IAIK);
Collection certCollection = certFactory.generateCertificates(new
ByteArrayInputStream(  certChainBlob.getDatabinary() ));
cert = (X509Certificate)certChain.get(0); //where X509Certificate
being iaik.x509.X509Certificate)
gets a ClassCastException if being the second context to call this code.
Oh, one more important thing: I add the security provider dynamicaly
with a:
Security.insertProviderAt(new IAIK(), 2);
Could someone help me on this?
Thank you,
Lionel
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

   

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


classloader problem in tomcat 5

2005-01-04 Thread ssk 2001
Hi,
I can able to start the tomcat5 ,but when i give the url it gives null pointer 
exception error
 
I think it is due to class loader problem , can any suggest on this...
ServletContext classloader[0]: class sun.misc.Launcher$ExtClassLoader
ServletContext classloader[1]: class sun.misc.Launcher$AppClassLoader
 
 
pls advice
thanks
ssk

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Gurus! JCE and classloader question

2004-12-23 Thread Antony Paul
Which JCE provider you are using ?

rgds
Antony Paul


On Tue, 21 Dec 2004 20:06:40 +0100, Lionel Pasquier
[EMAIL PROTECTED] wrote:
 Hello again!
 
 Any guru around to solve my problem please? :-)
 
 Lionel Pasquier wrote:
 
  Hello,
 
  I have a trouble with using a JCE and multiple contexts. From what I
  could have read around here this is probably linked to a classloader
  problem. Could you guys help?
 
  Basicaly, I generate a RSA Keypair, then create a certificate and want
  to self sign it. Finally i need to store the private key to create a
  p12. Here is the code: I am using the IAIK JCE.
 
 
  KeyPair keyPair;
  IAIK IAIKprovider = new IAIK();
  Security.insertProviderAt(IAIKprovider, 2);
  KeyPairGenerator keyPairGenerator =
  KeyPairGenerator.getInstance(RSA, IAIKprovider.getName());
  keyPairGenerator.initialize(keySize);
  keyPair = keyPairGenerator.generateKeyPair();
  X509Certificate cert;
  [...]
  cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(),
  IAIKprovider.getName());
  if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){
 
 error(Generated RSA private key is not of type RSA!);
  }
  KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(),
  certLabel, certLabel.getBytes());
 
 
  The problem is that if I have more than one tomcat context using the
  same pice of code, the 2nd context to use it triggers the if (that
  is, without it I get a ClassCastException). Meaning that the generated
  private key is not compatible with RSAPrivateKey, while I asked for a
  RSA key.
 
  I also have the same problem with the other way around:
  CertificateFactory certFactory =
  CertificateFactory.getInstance(X.509, IAIK);
  Collection certCollection = certFactory.generateCertificates(new
  ByteArrayInputStream(  certChainBlob.getDatabinary() ));
  cert = (X509Certificate)certChain.get(0); //where X509Certificate
  being iaik.x509.X509Certificate)
  gets a ClassCastException if being the second context to call this code.
 
 
  Oh, one more important thing: I add the security provider dynamicaly
  with a:
  Security.insertProviderAt(new IAIK(), 2);
 
 
  Could someone help me on this?
 
  Thank you,
 
  Lionel
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Gurus! JCE and classloader question

2004-12-23 Thread Antony Paul
Where you put the provider jar file ?. WEB-INF/lib ?. Try putting it
in shared/lib or common/lib if the same jar file is used by multiple
applications.

rgds
Antony Paul


On Thu, 23 Dec 2004 15:01:04 +0530, Antony Paul [EMAIL PROTECTED] wrote:
 Which JCE provider you are using ?
 
 rgds
 Antony Paul
 
 
 On Tue, 21 Dec 2004 20:06:40 +0100, Lionel Pasquier
 [EMAIL PROTECTED] wrote:
  Hello again!
 
  Any guru around to solve my problem please? :-)
 
  Lionel Pasquier wrote:
 
   Hello,
  
   I have a trouble with using a JCE and multiple contexts. From what I
   could have read around here this is probably linked to a classloader
   problem. Could you guys help?
  
   Basicaly, I generate a RSA Keypair, then create a certificate and want
   to self sign it. Finally i need to store the private key to create a
   p12. Here is the code: I am using the IAIK JCE.
  
  
   KeyPair keyPair;
   IAIK IAIKprovider = new IAIK();
   Security.insertProviderAt(IAIKprovider, 2);
   KeyPairGenerator keyPairGenerator =
   KeyPairGenerator.getInstance(RSA, IAIKprovider.getName());
   keyPairGenerator.initialize(keySize);
   keyPair = keyPairGenerator.generateKeyPair();
   X509Certificate cert;
   [...]
   cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(),
   IAIKprovider.getName());
   if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){
  
  error(Generated RSA private key is not of type RSA!);
   }
   KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(),
   certLabel, certLabel.getBytes());
  
  
   The problem is that if I have more than one tomcat context using the
   same pice of code, the 2nd context to use it triggers the if (that
   is, without it I get a ClassCastException). Meaning that the generated
   private key is not compatible with RSAPrivateKey, while I asked for a
   RSA key.
  
   I also have the same problem with the other way around:
   CertificateFactory certFactory =
   CertificateFactory.getInstance(X.509, IAIK);
   Collection certCollection = certFactory.generateCertificates(new
   ByteArrayInputStream(  certChainBlob.getDatabinary() ));
   cert = (X509Certificate)certChain.get(0); //where X509Certificate
   being iaik.x509.X509Certificate)
   gets a ClassCastException if being the second context to call this code.
  
  
   Oh, one more important thing: I add the security provider dynamicaly
   with a:
   Security.insertProviderAt(new IAIK(), 2);
  
  
   Could someone help me on this?
  
   Thank you,
  
   Lionel
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Gurus! JCE and classloader question

2004-12-23 Thread Lionel Pasquier
Well, I tried to put the library in common/lib (and I think also for a 
different try, in shared/lib). Usually it is in WEB-INF/lib.
But the problem occured also.

I believe that the factory used by the jvm searches for the first 
instance of the JCE. Then it tries to cast it into another instance of 
the lib which is different from the first, but I am not too sure about 
that since I am no expert in Tomcat.

Have you an explanation or any solution?

Antony Paul wrote:
Where you put the provider jar file ?. WEB-INF/lib ?. Try putting it
in shared/lib or common/lib if the same jar file is used by multiple
applications.
rgds
Antony Paul
On Thu, 23 Dec 2004 15:01:04 +0530, Antony Paul [EMAIL PROTECTED] wrote:
 

Which JCE provider you are using ?
rgds
Antony Paul
On Tue, 21 Dec 2004 20:06:40 +0100, Lionel Pasquier
[EMAIL PROTECTED] wrote:
   

Hello again!
Any guru around to solve my problem please? :-)
Lionel Pasquier wrote:
 

Hello,
I have a trouble with using a JCE and multiple contexts. From what I
could have read around here this is probably linked to a classloader
problem. Could you guys help?
Basicaly, I generate a RSA Keypair, then create a certificate and want
to self sign it. Finally i need to store the private key to create a
p12. Here is the code: I am using the IAIK JCE.
KeyPair keyPair;
IAIK IAIKprovider = new IAIK();
Security.insertProviderAt(IAIKprovider, 2);
KeyPairGenerator keyPairGenerator =
KeyPairGenerator.getInstance(RSA, IAIKprovider.getName());
keyPairGenerator.initialize(keySize);
keyPair = keyPairGenerator.generateKeyPair();
X509Certificate cert;
[...]
cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(),
IAIKprovider.getName());
if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){
  error(Generated RSA private key is not of type RSA!);
}
KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(),
certLabel, certLabel.getBytes());
The problem is that if I have more than one tomcat context using the
same pice of code, the 2nd context to use it triggers the if (that
is, without it I get a ClassCastException). Meaning that the generated
private key is not compatible with RSAPrivateKey, while I asked for a
RSA key.
I also have the same problem with the other way around:
CertificateFactory certFactory =
CertificateFactory.getInstance(X.509, IAIK);
Collection certCollection = certFactory.generateCertificates(new
ByteArrayInputStream(  certChainBlob.getDatabinary() ));
cert = (X509Certificate)certChain.get(0); //where X509Certificate
being iaik.x509.X509Certificate)
gets a ClassCastException if being the second context to call this code.
Oh, one more important thing: I add the security provider dynamicaly
with a:
Security.insertProviderAt(new IAIK(), 2);
Could someone help me on this?
Thank you,
Lionel
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Gurus! JCE and classloader question

2004-12-23 Thread Antony Paul
May be there are two jar files or unzipped class files of the same
class. Check for it also.

rgds
Antony Paul


On Thu, 23 Dec 2004 16:22:33 +0100, Lionel Pasquier
[EMAIL PROTECTED] wrote:
 Well, I tried to put the library in common/lib (and I think also for a
 different try, in shared/lib). Usually it is in WEB-INF/lib.
 But the problem occured also.
 
 I believe that the factory used by the jvm searches for the first
 instance of the JCE. Then it tries to cast it into another instance of
 the lib which is different from the first, but I am not too sure about
 that since I am no expert in Tomcat.
 
 Have you an explanation or any solution?
 
 
 Antony Paul wrote:
 
 Where you put the provider jar file ?. WEB-INF/lib ?. Try putting it
 in shared/lib or common/lib if the same jar file is used by multiple
 applications.
 
 rgds
 Antony Paul
 
 
 On Thu, 23 Dec 2004 15:01:04 +0530, Antony Paul [EMAIL PROTECTED] wrote:
 
 
 Which JCE provider you are using ?
 
 rgds
 Antony Paul
 
 
 On Tue, 21 Dec 2004 20:06:40 +0100, Lionel Pasquier
 [EMAIL PROTECTED] wrote:
 
 
 Hello again!
 
 Any guru around to solve my problem please? :-)
 
 Lionel Pasquier wrote:
 
 
 
 Hello,
 
 I have a trouble with using a JCE and multiple contexts. From what I
 could have read around here this is probably linked to a classloader
 problem. Could you guys help?
 
 Basicaly, I generate a RSA Keypair, then create a certificate and want
 to self sign it. Finally i need to store the private key to create a
 p12. Here is the code: I am using the IAIK JCE.
 
 
 KeyPair keyPair;
 IAIK IAIKprovider = new IAIK();
 Security.insertProviderAt(IAIKprovider, 2);
 KeyPairGenerator keyPairGenerator =
 KeyPairGenerator.getInstance(RSA, IAIKprovider.getName());
 keyPairGenerator.initialize(keySize);
 keyPair = keyPairGenerator.generateKeyPair();
 X509Certificate cert;
 [...]
 cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(),
 IAIKprovider.getName());
 if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){
 
error(Generated RSA private key is not of type RSA!);
 }
 KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(),
 certLabel, certLabel.getBytes());
 
 
 The problem is that if I have more than one tomcat context using the
 same pice of code, the 2nd context to use it triggers the if (that
 is, without it I get a ClassCastException). Meaning that the generated
 private key is not compatible with RSAPrivateKey, while I asked for a
 RSA key.
 
 I also have the same problem with the other way around:
 CertificateFactory certFactory =
 CertificateFactory.getInstance(X.509, IAIK);
 Collection certCollection = certFactory.generateCertificates(new
 ByteArrayInputStream(  certChainBlob.getDatabinary() ));
 cert = (X509Certificate)certChain.get(0); //where X509Certificate
 being iaik.x509.X509Certificate)
 gets a ClassCastException if being the second context to call this code.
 
 
 Oh, one more important thing: I add the security provider dynamicaly
 with a:
 Security.insertProviderAt(new IAIK(), 2);
 
 
 Could someone help me on this?
 
 Thank you,
 
 Lionel
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Gurus! JCE and classloader question

2004-12-21 Thread Lionel Pasquier
Hello again!
Any guru around to solve my problem please? :-)
Lionel Pasquier wrote:
Hello,
I have a trouble with using a JCE and multiple contexts. From what I 
could have read around here this is probably linked to a classloader 
problem. Could you guys help?

Basicaly, I generate a RSA Keypair, then create a certificate and want 
to self sign it. Finally i need to store the private key to create a 
p12. Here is the code: I am using the IAIK JCE.

KeyPair keyPair;
IAIK IAIKprovider = new IAIK();
Security.insertProviderAt(IAIKprovider, 2);
KeyPairGenerator keyPairGenerator = 
KeyPairGenerator.getInstance(RSA, IAIKprovider.getName());
keyPairGenerator.initialize(keySize);
keyPair = keyPairGenerator.generateKeyPair();
X509Certificate cert;
[...]
cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(), 
IAIKprovider.getName());
if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){ 

   error(Generated RSA private key is not of type RSA!);
}
KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(), 
certLabel, certLabel.getBytes());

The problem is that if I have more than one tomcat context using the 
same pice of code, the 2nd context to use it triggers the if (that 
is, without it I get a ClassCastException). Meaning that the generated 
private key is not compatible with RSAPrivateKey, while I asked for a 
RSA key.

I also have the same problem with the other way around:
CertificateFactory certFactory = 
CertificateFactory.getInstance(X.509, IAIK);
Collection certCollection = certFactory.generateCertificates(new 
ByteArrayInputStream(  certChainBlob.getDatabinary() ));
cert = (X509Certificate)certChain.get(0); //where X509Certificate 
being iaik.x509.X509Certificate)
gets a ClassCastException if being the second context to call this code.

Oh, one more important thing: I add the security provider dynamicaly 
with a:
Security.insertProviderAt(new IAIK(), 2);

Could someone help me on this?
Thank you,
Lionel
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


JCE and classloader question

2004-12-17 Thread Lionel Pasquier
Hello,
I have a trouble with using a JCE and multiple contexts. From what I 
could have read around here this is probably linked to a classloader 
problem. Could you guys help?

Basicaly, I generate a RSA Keypair, then create a certificate and want 
to self sign it. Finally i need to store the private key to create a 
p12. Here is the code: I am using the IAIK JCE.

KeyPair keyPair;
IAIK IAIKprovider = new IAIK();
Security.insertProviderAt(IAIKprovider, 2);
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(RSA, 
IAIKprovider.getName());
keyPairGenerator.initialize(keySize);
keyPair = keyPairGenerator.generateKeyPair();
X509Certificate cert;
[...]
cert.sign( AlgorithmID.sha1WithRSAEncryption ,keyPair.getPrivate(), 
IAIKprovider.getName());
if(!RSAPrivateKey.class.isAssignableFrom(keyPair.getPrivate().getClass())){
   error(Generated RSA private key is not of type RSA!);
}
KeyBag keybag = new KeyBag((RSAPrivateKey) keyPair.getPrivate(), 
certLabel, certLabel.getBytes());

The problem is that if I have more than one tomcat context using the 
same pice of code, the 2nd context to use it triggers the if (that is, 
without it I get a ClassCastException). Meaning that the generated 
private key is not compatible with RSAPrivateKey, while I asked for a 
RSA key.

I also have the same problem with the other way around:
CertificateFactory certFactory = CertificateFactory.getInstance(X.509, 
IAIK);
Collection certCollection = certFactory.generateCertificates(new 
ByteArrayInputStream(  certChainBlob.getDatabinary() ));
cert = (X509Certificate)certChain.get(0); //where X509Certificate being 
iaik.x509.X509Certificate)
gets a ClassCastException if being the second context to call this code.

Oh, one more important thing: I add the security provider dynamicaly with a:
Security.insertProviderAt(new IAIK(), 2);
Could someone help me on this?
Thank you,
Lionel
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Tomcat classloader fails to load manager app

2004-11-27 Thread Roman D
Hi,
Tomcat 5.0.28, Windows XP install from exe.
After deploying Jakarta Slide(2.1), the Tomcat manager and balancer 
applications fail during loading. It fails because something get broken 
in Tomcat's class loader/classpath. However Tomcat Admin application 
still works.

I tried to reinstall Tomcat and re-deploy, it's always the same result. 
You can have Slide or Tomcat manager but not both at the same time.
I Can't figure out what exactly get broken in configuration.
If I copy all JARs from Tomcat/server/lib to Tomcat/common/lib then it 
works. But it's not the right way isn't it.

Here is output:
2004-11-27 20:35:47 StandardContext[/manager]Marking servlet default as 
unavailable
2004-11-27 20:35:47 StandardContext[/manager]Error loading WebappClassLoader
  delegate: false
  repositories:
-- Parent Classloader:
StandardClassLoader
  delegate: true
  repositories:
file:C:\Tomcat5.0\shared\classes\
-- Parent Classloader:
StandardClassLoader
  delegate: true
  repositories:
file:C:\Tomcat5.0\common\classes\
file:C:\Tomcat5.0\common\endorsed\xercesImpl.jar
file:C:\Tomcat5.0\common\endorsed\xml-apis.jar
file:C:\Tomcat5.0\common\lib\ant-launcher.jar
file:C:\Tomcat5.0\common\lib\ant.jar
file:C:\Tomcat5.0\common\lib\commons-collections-3.1.jar
file:C:\Tomcat5.0\common\lib\commons-dbcp-1.2.1.jar
file:C:\Tomcat5.0\common\lib\commons-el.jar
file:C:\Tomcat5.0\common\lib\commons-pool-1.2.jar
file:C:\Tomcat5.0\common\lib\jasper-compiler.jar
file:C:\Tomcat5.0\common\lib\jasper-runtime.jar
file:C:\Tomcat5.0\common\lib\jsp-api.jar
file:C:\Tomcat5.0\common\lib\naming-common.jar
file:C:\Tomcat5.0\common\lib\naming-factory.jar
file:C:\Tomcat5.0\common\lib\naming-java.jar
file:C:\Tomcat5.0\common\lib\naming-resources.jar
file:C:\Tomcat5.0\common\lib\servlet-api.jar
file:C:\Tomcat5.0\common\lib\tools.jar
-- Parent Classloader:
[EMAIL PROTECTED]

 org.apache.catalina.servlets.DefaultServlet
java.lang.ClassNotFoundException: 
org.apache.catalina.servlets.DefaultServlet
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
.

2004-11-27 20:35:48 StandardContext[/manager]Servlet /manager threw 
load() exception
javax.servlet.ServletException: Wrapper cannot find servlet class 
org.apache.catalina.servlets.DefaultServlet or a class it depends on
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:974)
at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)

 Root Cause -
java.lang.ClassNotFoundException: 
org.apache.catalina.servlets.DefaultServlet
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)

How do I fix that?
Thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


JAASRealm, Classloader

2004-11-10 Thread Oliver Wulff
Isn't is possible to deploy my custom JAASLoginModule into the server/lib
directory instead of shared/lib or web-inf/lib? The JAASRealm is loaded by
the Catalina classloader either.

You're help is appreciated.

Oliver






*** BITTE BEACHTEN ***
Diese Nachricht (wie auch allfällige Anhänge dazu) beinhaltet
möglicherweise vertrauliche oder gesetzlich geschützte Daten oder
Informationen. Zum Empfang derselben ist (sind) ausschliesslich die
genannte(n) Person(en) bestimmt. Falls Sie diese Nachricht
irrtümlicherweise erreicht hat, sind Sie höflich gebeten, diese unter
Ausschluss jeder Reproduktion zu zerstören und die absendende Person
umgehend zu benachrichtigen. Vielen Dank für Ihre Hilfe.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ClassLoader question

2004-11-08 Thread Mark Claassen
What is the difference between the server/lib and shared directories as far
as the class loaders are concerned?

Background:
---
I was having trouble with CGI scripts, so I wanted to creat a new CGIServlet
to run some tests.  To start the process, I copied source of the tomcat
CGIServlet file into my own package structure.  Once I got this working I
would alter that code and try to see why the CGI scripts where not executing
correctly.

Part I Don't Understand:
---
I put my jar file containing the CGIServlet into the server/lib directory
(where the tomcat CGIServlet resides).  This, however, would not start up
and gave me ClassNotFound exceptions.  However, when I moved my jar to the
shared directory, everything seems to work.  

Question:
-
I thought everything had access to things in the server/lib directory.  What
is going on here?

Thanks,
Mark


Confidentiality Notice:  OCIESERVICE
-
The contents of this e-mail message and any attachments are intended 
solely for the addressee(s) named in this message. This communication 
is intended to be and to remain confidential.  If you are not the 
intended recipient of this message, or if this message has been 
addressed to you in error, please immediately alert the sender by 
reply e-mail and then delete this message and its attachments. Do not 
deliver, distribute, copy, disclose the contents or take any action 
in reliance upon the information contained in the communication or 
any attachments. 
-
Mark Claassen
Donnell Systems, Inc.
300 S. St. Louis Blvd. Ste. 203 
South Bend, IN 46617
E-mail: mailto:[EMAIL PROTECTED]
Voice: (574)232-3784
Fax: (574)232-4014
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ClassLoader question

2004-11-08 Thread Shapira, Yoav

Hi,
RTFM:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html.
It clearly (in bold, capital letters) says server/lib is not visible to
web applications.

Yoav Shapira http://www.yoavshapira.com


-Original Message-
From: Mark Claassen [mailto:[EMAIL PROTECTED]
Sent: Monday, November 08, 2004 2:40 PM
To: 'Tomcat Users List'
Subject: ClassLoader question

What is the difference between the server/lib and shared directories as
far
as the class loaders are concerned?

Background:
---
I was having trouble with CGI scripts, so I wanted to creat a new
CGIServlet
to run some tests.  To start the process, I copied source of the tomcat
CGIServlet file into my own package structure.  Once I got this working
I
would alter that code and try to see why the CGI scripts where not
executing
correctly.

Part I Don't Understand:
---
I put my jar file containing the CGIServlet into the server/lib
directory
(where the tomcat CGIServlet resides).  This, however, would not start
up
and gave me ClassNotFound exceptions.  However, when I moved my jar to
the
shared directory, everything seems to work.

Question:
-
I thought everything had access to things in the server/lib directory.
What
is going on here?

Thanks,
Mark


Confidentiality Notice:  OCIESERVICE
-
The contents of this e-mail message and any attachments are intended
solely for the addressee(s) named in this message. This communication
is intended to be and to remain confidential.  If you are not the
intended recipient of this message, or if this message has been
addressed to you in error, please immediately alert the sender by
reply e-mail and then delete this message and its attachments. Do not
deliver, distribute, copy, disclose the contents or take any action
in reliance upon the information contained in the communication or
any attachments.
-
Mark Claassen
Donnell Systems, Inc.
300 S. St. Louis Blvd. Ste. 203
South Bend, IN 46617
E-mail: mailto:[EMAIL PROTECTED]
Voice: (574)232-3784
Fax: (574)232-4014




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, proprietary 
and/or privileged.  This e-mail is intended only for the individual(s) to whom 
it is addressed, and may not be saved, copied, printed, disclosed or used by 
anyone else.  If you are not the(an) intended recipient, please immediately 
delete this e-mail from your computer system and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ClassLoader question

2004-11-08 Thread e-Denton Subscriber
shared is the right directory for things to be shared by all your web apps
(shared class loader).
server/lib is for the Catalina class loader.


- Original Message - 
From: Mark Claassen [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Monday, November 08, 2004 1:40 PM
Subject: ClassLoader question


 What is the difference between the server/lib and shared directories as
far
 as the class loaders are concerned?

 Background:
 ---
 I was having trouble with CGI scripts, so I wanted to creat a new
CGIServlet
 to run some tests.  To start the process, I copied source of the tomcat
 CGIServlet file into my own package structure.  Once I got this working I
 would alter that code and try to see why the CGI scripts where not
executing
 correctly.

 Part I Don't Understand:
 ---
 I put my jar file containing the CGIServlet into the server/lib directory
 (where the tomcat CGIServlet resides).  This, however, would not start up
 and gave me ClassNotFound exceptions.  However, when I moved my jar to the
 shared directory, everything seems to work.

 Question:
 -
 I thought everything had access to things in the server/lib directory.
What
 is going on here?

 Thanks,
 Mark


 Confidentiality Notice:  OCIESERVICE
 -
 The contents of this e-mail message and any attachments are intended
 solely for the addressee(s) named in this message. This communication
 is intended to be and to remain confidential.  If you are not the
 intended recipient of this message, or if this message has been
 addressed to you in error, please immediately alert the sender by
 reply e-mail and then delete this message and its attachments. Do not
 deliver, distribute, copy, disclose the contents or take any action
 in reliance upon the information contained in the communication or
 any attachments.
 -
 Mark Claassen
 Donnell Systems, Inc.
 300 S. St. Louis Blvd. Ste. 203
 South Bend, IN 46617
 E-mail: mailto:[EMAIL PROTECTED]
 Voice: (574)232-3784
 Fax: (574)232-4014




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ClassLoader question

2004-11-08 Thread Mark Claassen
One thing I was going to add to this was that I do have other classes in
this directory that work.  I have a custom access log value, which works
fine, and the only reference to it is in a jar file that is in this
directory.  And, from what I have read, it properly placed be in this
directory.



 -Original Message-
 From: Mark Claassen [mailto:[EMAIL PROTECTED] 
 Sent: Monday, November 08, 2004 3:14 PM
 To: 'Tomcat Users List'
 Subject: RE: ClassLoader question
 
 
 I forgot to mention that I am running 4.1, however the docs 
 are similar and on this point I clearly deserve any sneers 
 that are sent my way.
 
 But,...
 In the default web.xml file there is this:
 !-- IMPORTANT: To use the CGI servlet, you also need to rename the
 --
 !--
 $CATALINA_HOME/server/lib/servlets-cgi.renametojar file
 --
 !--to $CATALINA_HOME/server/lib/servlets-cgi.jar
 --.
 
 When the name is changed, the default CGIServlet works!  Why 
 does the CGIServlet work from the server/lib directory and 
 mine not?  Does it actually check somehow?  My class is 
 currently a carbon copy of tomcat's with no additional class 
 dependencies.  It compiles against the catalina.jar just fine.
 
 
  -Original Message-
  From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
  Sent: Monday, November 08, 2004 2:47 PM
  To: Tomcat Users List
  Subject: RE: ClassLoader question
  
  
  
  Hi,
  RTFM:
  http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-h
  owto.html.
  It clearly (in bold, capital letters) says server/lib is not 
  visible to web applications.
  
  Yoav Shapira http://www.yoavshapira.com
   
  
  -Original Message-
  From: Mark Claassen [mailto:[EMAIL PROTECTED]
  Sent: Monday, November 08, 2004 2:40 PM
  To: 'Tomcat Users List'
  Subject: ClassLoader question
  
  What is the difference between the server/lib and shared
  directories as
  far
  as the class loaders are concerned?
  
  Background:
  ---
  I was having trouble with CGI scripts, so I wanted to creat a new
  CGIServlet to run some tests.  To start the process, I 
  copied source of
  the tomcat CGIServlet file into my own package structure.
  Once I got
  this working
  I
  would alter that code and try to see why the CGI scripts where not
  executing correctly.
  
  Part I Don't Understand:
  ---
  I put my jar file containing the CGIServlet into the server/lib
  directory
  (where the tomcat CGIServlet resides).  This, however, would
  not start
  up
  and gave me ClassNotFound exceptions.  However, when I moved
  my jar to
  the
  shared directory, everything seems to work.
  
  Question:
  -
  I thought everything had access to things in the server/lib
  directory.
  What is going on here?
  
  Thanks,
  Mark
  
  
  Confidentiality Notice:  OCIESERVICE
  
 -
  The contents of this e-mail message and any attachments 
 are intended
  solely for the addressee(s) named in this message. This 
  communication
  is intended to be and to remain confidential.  If you are not the
  intended recipient of this message, or if this message has been 
  addressed to you in error, please immediately alert the 
  sender by reply
  e-mail and then delete this message and its attachments. Do not
  deliver, distribute, copy, disclose the contents or take any 
  action in
  reliance upon the information contained in the communication or any
  attachments.
  -
  Mark Claassen
  Donnell Systems, Inc.
  300 S. St. Louis Blvd. Ste. 203
  South Bend, IN 46617
  E-mail: mailto:[EMAIL PROTECTED]
  Voice: (574)232-3784
  Fax: (574)232-4014
  
  
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: 
 [EMAIL PROTECTED]
  
  
  
  
  This e-mail, including any attachments, is a confidential
  business communication, and may contain information that is 
  confidential, proprietary and/or privileged.  This e-mail is 
  intended only for the individual(s) to whom it is addressed, 
  and may not be saved, copied, printed, disclosed or used by 
  anyone else.  If you are not the(an) intended recipient, 
  please immediately delete this e-mail from your computer 
  system and notify the sender.  Thank you.
  
  
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Classloader / oracle JDBC

2004-10-13 Thread Michal Kwiatek
Hello All,

I have a problem using oracle jdbc in tomcat. 

JDBC call fails with java.sql.SQLException: Non supported character
set: oracle-character-set-46  (see full stack trace below).

After some investigation, I came to the conlusion that translation
tables that are in the *.gbl files in orai18n.jar are not read properly.


Is it possible that tomcat classloader does not allow reading *.gbl
files from orai18n.jar?

Or perhaps there is some other reason jdbc crashes on tomcat? 

Versions:
Tomcat 5.0.28
Oracle jdbc 10.1.0.2.0, both OCI and thin
Oracle 9.2.0.5.0 database in WE8ISO8859P15 characterset

Thank you in advance,
Michal. 

-
java.sql.SQLException: Non supported character set:
oracle-character-set-46
at oracle.gss.util.NLSError.throwSQLException(NLSError.java:65)
at
oracle.sql.CharacterSetUnknown.failCharsetUnknown(CharacterSetFactoryThi
n.java:178)
at
oracle.sql.CharacterSetUnknown.convert(CharacterSetFactoryThin.java:145)
at oracle.sql.CHAR.init(CHAR.java:147)
at oracle.jpub.runtime.Util._convertToOracle(Util.java:166)
at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
at
oracle.jpub.runtime.MutableStruct.getDatumAttribute(MutableStruct.java:2
92)
at
oracle.jpub.runtime.MutableStruct.getDatumAttributes(MutableStruct.java:
311)
at
oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
at
org.glite.data.catalog.service.database.principalTokenFAS.toDatum(princi
palTokenFAS.java:43)
at
oracle.jdbc.driver.OraclePreparedStatement.setORADataInternal(OraclePrep
aredStatement.java:7112)
at
oracle.jdbc.driver.OracleCallableStatement.setORAData(OracleCallableStat
ement.java:4522)
at
org.glite.data.catalog.service.database.OraReplicaCatalog.setdefaultuser
permission(OraReplicaCatalog.java:791)
at
org.glite.data.catalog.service.replica.ReplicaCatalogSoapBindingImpl.set
DefaultUserPermission(ReplicaCatalogSoapBindingImpl.java:628)
at
org.glite.data.catalog.service.replica.ReplicaCatalogSoapBindingSkeleton
.setDefaultUserPermission(ReplicaCatalogSoapBindingSkeleton.java:493)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java
:402)
at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.ja
va:309)
at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:333
)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.j
ava:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.j
ava:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:118)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
20)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo

RE: Classloader / oracle JDBC

2004-10-13 Thread Shapira, Yoav

Hi,
Tomcat itself contains no Oracle-proprietary bits, nor any special
handling of GBL files.

Where is orai18n.jar located?  It should be alongside the ojdbc14.jar
(assuming that's what you're using) so it's loaded by the same
classloader.

I see you have a fairly complex deployment, with Axis running and
relying on the Oracle data catalog.  So naturally, my next question is
if you can reproduce the error under simpler circumstances, e.g. in a
command-line program or a simple servlet.

Finally, although you've already done this probably, I'd suggest looking
online: there are a number of good Oracle configuration references.
Chances are you're missing a simple configuration step somewhere along
the way.

Yoav Shapira http://www.yoavshapira.com


-Original Message-
From: Michal Kwiatek [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 13, 2004 1:30 PM
To: Tomcat Users List
Subject: Classloader / oracle JDBC

Hello All,

I have a problem using oracle jdbc in tomcat.

JDBC call fails with java.sql.SQLException: Non supported character
set: oracle-character-set-46  (see full stack trace below).

After some investigation, I came to the conlusion that translation
tables that are in the *.gbl files in orai18n.jar are not read
properly.


Is it possible that tomcat classloader does not allow reading *.gbl
files from orai18n.jar?

Or perhaps there is some other reason jdbc crashes on tomcat?

Versions:
Tomcat 5.0.28
Oracle jdbc 10.1.0.2.0, both OCI and thin
Oracle 9.2.0.5.0 database in WE8ISO8859P15 characterset

Thank you in advance,
Michal.

-
java.sql.SQLException: Non supported character set:
oracle-character-set-46
at oracle.gss.util.NLSError.throwSQLException(NLSError.java:65)
at
oracle.sql.CharacterSetUnknown.failCharsetUnknown(CharacterSetFactoryTh
i
n.java:178)
at
oracle.sql.CharacterSetUnknown.convert(CharacterSetFactoryThin.java:145
)
at oracle.sql.CHAR.init(CHAR.java:147)
at oracle.jpub.runtime.Util._convertToOracle(Util.java:166)
at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
at
oracle.jpub.runtime.MutableStruct.getDatumAttribute(MutableStruct.java:
2
92)
at
oracle.jpub.runtime.MutableStruct.getDatumAttributes(MutableStruct.java
:
311)
at
oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
at
org.glite.data.catalog.service.database.principalTokenFAS.toDatum(princ
i
palTokenFAS.java:43)
at
oracle.jdbc.driver.OraclePreparedStatement.setORADataInternal(OraclePre
p
aredStatement.java:7112)
at
oracle.jdbc.driver.OracleCallableStatement.setORAData(OracleCallableSta
t
ement.java:4522)
at
org.glite.data.catalog.service.database.OraReplicaCatalog.setdefaultuse
r
permission(OraReplicaCatalog.java:791)
at
org.glite.data.catalog.service.replica.ReplicaCatalogSoapBindingImpl.se
t
DefaultUserPermission(ReplicaCatalogSoapBindingImpl.java:628)
at
org.glite.data.catalog.service.replica.ReplicaCatalogSoapBindingSkeleto
n
.setDefaultUserPermission(ReplicaCatalogSoapBindingSkeleton.java:493)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
v
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
r
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.jav
a
:402)
at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.j
a
va:309)
at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:33
3
)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.
j
ava:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481)
at
org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.
j
ava:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
a
tionFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
t
erChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
v
e.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
o
ntext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
5
20)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCo
n

RE: Classloader / oracle JDBC

2004-10-13 Thread Michal Kwiatek
Both ojdbc14.jar and orai18n.jar are in commons/lib/
Any ideas?

 I see you have a fairly complex deployment, with Axis running 
 and relying on the Oracle data catalog.  So naturally, my 
 next question is if you can reproduce the error under simpler 
 circumstances, e.g. in a command-line program or a simple servlet.

It work's fine from a command-line tool. 

 Finally, although you've already done this probably, I'd 
 suggest looking online: there are a number of good Oracle
configuration references.
 Chances are you're missing a simple configuration step 
 somewhere along the way.

Can you point me to some specific howtos?

Thanks,
Michal.


 
 Yoav Shapira http://www.yoavshapira.com
  
 
 -Original Message-
 From: Michal Kwiatek [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 13, 2004 1:30 PM
 To: Tomcat Users List
 Subject: Classloader / oracle JDBC
 
 Hello All,
 
 I have a problem using oracle jdbc in tomcat.
 
 JDBC call fails with java.sql.SQLException: Non supported character
 set: oracle-character-set-46  (see full stack trace below).
 
 After some investigation, I came to the conlusion that translation 
 tables that are in the *.gbl files in orai18n.jar are not read
 properly.
 
 
 Is it possible that tomcat classloader does not allow reading *.gbl 
 files from orai18n.jar?
 
 Or perhaps there is some other reason jdbc crashes on tomcat?
 
 Versions:
 Tomcat 5.0.28
 Oracle jdbc 10.1.0.2.0, both OCI and thin Oracle 9.2.0.5.0 
 database in 
 WE8ISO8859P15 characterset
 
 Thank you in advance,
 Michal.
 
 -
 java.sql.SQLException: Non supported character set:
 oracle-character-set-46
 at 
 oracle.gss.util.NLSError.throwSQLException(NLSError.java:65)
 at
 oracle.sql.CharacterSetUnknown.failCharsetUnknown(CharacterSe
 tFactoryTh
 i
 n.java:178)
 at
 oracle.sql.CharacterSetUnknown.convert(CharacterSetFactoryThi
 n.java:145
 )
 at oracle.sql.CHAR.init(CHAR.java:147)
 at oracle.jpub.runtime.Util._convertToOracle(Util.java:166)
 at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
 at
 oracle.jpub.runtime.MutableStruct.getDatumAttribute(MutableSt
 ruct.java:
 2
 92)
 at
 oracle.jpub.runtime.MutableStruct.getDatumAttributes(MutableS
 truct.java
 :
 311)
 at
 oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
 at
 org.glite.data.catalog.service.database.principalTokenFAS.toD
 atum(princ
 i
 palTokenFAS.java:43)
 at
 oracle.jdbc.driver.OraclePreparedStatement.setORADataInternal
 (OraclePre
 p
 aredStatement.java:7112)
 at
 oracle.jdbc.driver.OracleCallableStatement.setORAData(OracleC
 allableSta
 t
 ement.java:4522)
 at
 org.glite.data.catalog.service.database.OraReplicaCatalog.set
 defaultuse
 r
 permission(OraReplicaCatalog.java:791)
 at
 org.glite.data.catalog.service.replica.ReplicaCatalogSoapBind
 ingImpl.se
 t
 DefaultUserPermission(ReplicaCatalogSoapBindingImpl.java:628)
 at
 org.glite.data.catalog.service.replica.ReplicaCatalogSoapBind
 ingSkeleto
 n
 .setDefaultUserPermission(ReplicaCatalogSoapBindingSkeleton.java:493)
 at 
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
 sorImpl.ja
 v
 a:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
 hodAccesso
 r
 Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
 org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCPr
 ovider.jav
 a
 :402)
 at
 org.apache.axis.providers.java.RPCProvider.processMessage(RPC
 Provider.j
 a
 va:309)
 at
 org.apache.axis.providers.java.JavaProvider.invoke(JavaProvid
 er.java:33
 3
 )
 at
 org.apache.axis.strategies.InvocationStrategy.visit(Invocatio
 nStrategy.
 j
 ava:71)
 at 
 org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
 at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
 at
 org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.
 java:481)
 at
 org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
 at
 org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet
 .java:854)
 at 
 javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
 at
 org.apache.axis.transport.http.AxisServletBase.service(AxisSe
 rvletBase.
 j
 ava:339)
 at 
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFil
 ter(Applic
 a
 tionFilterChain.java:237)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(Appl
 icationFil
 t
 erChain.java:157)
 at
 org.apache.catalina.core.StandardWrapperValve.invoke(Standard
 WrapperVal
 v
 e.java:214)
 at
 org.apache.catalina.core.StandardValveContext.invokeNext(Stan
 dardValveC
 o
 ntext.java:104

RE: Classloader / oracle JDBC

2004-10-13 Thread Shapira, Yoav

Hi,

Both ojdbc14.jar and orai18n.jar are in commons/lib/

Assuming you mean common/lib, that should be fine.

It work's fine from a command-line tool.

Is the runtime classpath for the command-line tool that works the same
as the runtime classpath within tomcat?

Can you point me to some specific howtos?

Dude (or Gal), Google ;)  Here are a few that seem relevant:

http://www.utexas.edu/its/unix/reference/oracledocs/v92/B10501_01/java.9
20/a96657/jspnls.htm

http://www.doc.gold.ac.uk/oracle/doc/java.817/a83726/jspnls3.htm

http://radio.weblogs.com/0118231/stories/2003/08/08/installingTheBc4jToy
StoreOnApacheTomcat4124.html

http://www.exzilla.net/node/view/9?PHPSESSID=c923a9f76ddb761f003df7bd8de
a2f5c#_NLS

There are many others that also look promising.  Hopefully the above
will be helpful.

Yoav



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to use a class loaded with a Custom ClassLoader

2004-09-16 Thread gfdgdf gdfgdf
Hi all.
I have a web application with sensitive information inside a class. To protect it, I 
have encrypted the class and written a custom classloader in order to load and decrypt 
it.
The class itself is masked with an interface which has a method which returns an 
instance of the class.
 
The class is successfully loaded in the Context listener event:
 
 public void contextInitialized(ServletContextEvent event)
  {
  CustomLoader c = new CustomLoader(context.getClass().getClassLoader());
  Class clazz = 
c.loadClass(C:\\jakarta-tomcat-5.0.16\\temp\\,SecretClass,true);
 
 
The problem is, when the application tries to reference the SecretClass a 
ClassnotFoundException is thrown...
Why Tomcat cannot use the class I have loaded in memory before ?
What can I do to solve the problem ?
I'm using Tomcat 5.0.16 as container.
 
Hope somebody can help
Regards
Francesco


-
Scopri Mister Yahoo! -  il fantatorneo sul calcio di Yahoo! Sport'

RE: How to use a class loaded with a Custom ClassLoader

2004-09-16 Thread Shapira, Yoav

Hi,

 public void contextInitialized(ServletContextEvent event)
  {
  CustomLoader c = new
CustomLoader(context.getClass().getClassLoader());
  Class clazz = c.loadClass(C:\\jakarta-tomcat-
5.0.16\\temp\\,SecretClass,true);

If you add Class.forName(SecretClass) after this, does it work or
throw a CNFE?

Yoav



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to use a class loaded with a Custom ClassLoader

2004-09-16 Thread Shapira, Yoav

Hi,
Actually, I'm not sure that would work anyhow.  The Class is loaded in
your ClassLoader, and nowhere else.  The Tomcat classloader(s) still
don't know about it, hence the CNFE.

You would need to declare your Loader in server.xml (or the context.xml
file for your webapp), and have it extend WebappClassLoader most likely.
This would become a pain I imagine, and it means your classloader would
have to be in common/lib instead of WEB-INF/lib for your webapp.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Shapira, Yoav
Sent: Thursday, September 16, 2004 8:26 AM
To: Tomcat Users List
Subject: RE: How to use a class loaded with a Custom ClassLoader


Hi,

 public void contextInitialized(ServletContextEvent event)
  {
  CustomLoader c = new
CustomLoader(context.getClass().getClassLoader());
  Class clazz = c.loadClass(C:\\jakarta-tomcat-
5.0.16\\temp\\,SecretClass,true);

If you add Class.forName(SecretClass) after this, does it work or
throw a CNFE?

Yoav



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended
recipient, please immediately delete this e-mail from your computer
system
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to use a class loaded with a Custom ClassLoader

2004-09-16 Thread gfdgdf gdfgdf

Shapira, Yoav [EMAIL PROTECTED] wrote:

Hi,
Actually, I'm not sure that would work anyhow. The Class is loaded in
your ClassLoader, and nowhere else. The Tomcat classloader(s) still
don't know about it, hence the CNFE.

You would need to declare your Loader in server.xml (or the context.xml
file for your webapp), and have it extend WebappClassLoader most likely.
This would become a pain I imagine, and it means your classloader would
have to be in common/lib instead of WEB-INF/lib for your webapp.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Shapira, Yoav
Sent: Thursday, September 16, 2004 8:26 AM
To: Tomcat Users List
Subject: RE: How to use a class loaded with a Custom ClassLoader


Hi,

 public void contextInitialized(ServletContextEvent event)
 {
 CustomLoader c = new
CustomLoader(context.getClass().getClassLoader());
 Class clazz = c.loadClass(C:\\jakarta-tomcat-
5.0.16\\temp\\,SecretClass,true);

If you add Class.forName(SecretClass) after this, does it work or
throw a CNFE?

Yoav



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged. This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else. If you are not the(an)
intended
recipient, please immediately delete this e-mail from your computer
system
and notify the sender. Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Hello,

thanks for your answers.

You mentioned to declare the classloader in server.xml.

Have you idea how to include this information in server.xml ? I cannot find any 
reference to Classloaders in it.

Thanks again

Francesco



-
Scopri Mister Yahoo! -  il fantatorneo sul calcio di Yahoo! Sport'

RE: How to use a class loaded with a Custom ClassLoader

2004-09-16 Thread Shapira, Yoav

Hi,
Read the Loader configuration reference page:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/loader.html.
Your scenario is not rare, and this Loader approach was developed to
help you out.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: gfdgdf gdfgdf [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 16, 2004 9:06 AM
To: Tomcat Users List
Subject: RE: How to use a class loaded with a Custom ClassLoader


Shapira, Yoav [EMAIL PROTECTED] wrote:

Hi,
Actually, I'm not sure that would work anyhow. The Class is loaded in
your ClassLoader, and nowhere else. The Tomcat classloader(s) still
don't know about it, hence the CNFE.

You would need to declare your Loader in server.xml (or the context.xml
file for your webapp), and have it extend WebappClassLoader most
likely.
This would become a pain I imagine, and it means your classloader would
have to be in common/lib instead of WEB-INF/lib for your webapp.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Shapira, Yoav
Sent: Thursday, September 16, 2004 8:26 AM
To: Tomcat Users List
Subject: RE: How to use a class loaded with a Custom ClassLoader


Hi,

 public void contextInitialized(ServletContextEvent event)
 {
 CustomLoader c = new
CustomLoader(context.getClass().getClassLoader());
 Class clazz = c.loadClass(C:\\jakarta-tomcat-
5.0.16\\temp\\,SecretClass,true);

If you add Class.forName(SecretClass) after this, does it work or
throw a CNFE?

Yoav



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged. This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else. If you are not the(an)
intended
recipient, please immediately delete this e-mail from your computer
system
and notify the sender. Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Hello,

thanks for your answers.

You mentioned to declare the classloader in server.xml.

Have you idea how to include this information in server.xml ? I cannot
find
any reference to Classloaders in it.

Thanks again

Francesco



-
Scopri Mister Yahoo! -  il fantatorneo sul calcio di Yahoo! Sport'



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to use a class loaded with a Custom ClassLoader

2004-09-16 Thread gfdgdf gdfgdf
Thanks. I'll give a look to it.
Regards
Francesco

Shapira, Yoav [EMAIL PROTECTED] wrote:

Hi,
Read the Loader configuration reference page:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/loader.html.
Your scenario is not rare, and this Loader approach was developed to
help you out.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: gfdgdf gdfgdf [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 16, 2004 9:06 AM
To: Tomcat Users List
Subject: RE: How to use a class loaded with a Custom ClassLoader


Shapira, Yoav wrote:

Hi,
Actually, I'm not sure that would work anyhow. The Class is loaded in
your ClassLoader, and nowhere else. The Tomcat classloader(s) still
don't know about it, hence the CNFE.

You would need to declare your Loader in server.xml (or the context.xml
file for your webapp), and have it extend WebappClassLoader most
likely.
This would become a pain I imagine, and it means your classloader would
have to be in common/lib instead of WEB-INF/lib for your webapp.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Shapira, Yoav
Sent: Thursday, September 16, 2004 8:26 AM
To: Tomcat Users List
Subject: RE: How to use a class loaded with a Custom ClassLoader


Hi,

 public void contextInitialized(ServletContextEvent event)
 {
 CustomLoader c = new
CustomLoader(context.getClass().getClassLoader());
 Class clazz = c.loadClass(C:\\jakarta-tomcat-
5.0.16\\temp\\,SecretClass,true);

If you add Class.forName(SecretClass) after this, does it work or
throw a CNFE?

Yoav



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged. This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else. If you are not the(an)
intended
recipient, please immediately delete this e-mail from your computer
system
and notify the sender. Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Hello,

thanks for your answers.

You mentioned to declare the classloader in server.xml.

Have you idea how to include this information in server.xml ? I cannot
find
any reference to Classloaders in it.

Thanks again

Francesco



-
Scopri Mister Yahoo! - il fantatorneo sul calcio di Yahoo! Sport'



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged. This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else. If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender. Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
Scopri Mister Yahoo! -  il fantatorneo sul calcio di Yahoo! Sport'

RE: dll already loaded in another classloader

2004-09-15 Thread Cox, Charlie
Some ideas:
1. your webapp is loaded multiple times(multiple Context, same docBase),
thus loading your class multiple times.
2. your servlet is loaded multiple times(multiple servlet entries in
web.xml)
3. your webapp was reloaded through the manager

From my experience, I found it worked best to put your java class that loads
your library in /common/lib and it will only be loaded once. But if you do
this, you will not be able to include this class in your war file. 

If you try to include it in your war file, your users can not use manager to
reload your app and you can not redeploy without restarting tomcat.

Also, you will need to rely on the user to put your dll on the system
path(windows) since you do not know the actual path where they may install
it.

Charlie

 -Original Message-
 From: Nathan O'Neal [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 14, 2004 7:03 PM
 To: [EMAIL PROTECTED]
 Subject: dll already loaded in another classloader
 
 Hi All,
 
 My application loads a native library using System.load().  When I run
 Tomcat 5 through Eclipse, everything works fine on IE and Firefox.  But,
 when I run Tomcat normally I get this Exception with Firefox only:
 
 
 java.lang.UnsatisfiedLinkError: Native Library
 C:\jakarta-tomcat-5.0.28\webapps\profiler\WEB-INF\ttAdapterInfo.dll
already
 loaded in another classloader
 
 I've found that this is a feature of the jvm and it will not load the
same
 native library in different classloaders.  What I don't understand is why
it
 works when running through Eclipse, but not otherwise?
 
 On a side-note, where is the best place to put dll's when distributing a
 webapp as a war file?
 
 thanks,
 nathan
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


dll already loaded in another classloader

2004-09-14 Thread Nathan O'Neal
Hi All,

My application loads a native library using System.load().  When I run
Tomcat 5 through Eclipse, everything works fine on IE and Firefox.  But,
when I run Tomcat normally I get this Exception with Firefox only:


java.lang.UnsatisfiedLinkError: Native Library
C:\jakarta-tomcat-5.0.28\webapps\profiler\WEB-INF\ttAdapterInfo.dll already
loaded in another classloader

I've found that this is a feature of the jvm and it will not load the same
native library in different classloaders.  What I don't understand is why it
works when running through Eclipse, but not otherwise?

On a side-note, where is the best place to put dll's when distributing a
webapp as a war file?

thanks,
nathan


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to implement Custom webapp classloader?

2004-09-13 Thread G Q
Hi,

The scenario I have is as follows:
The application jar file is located on a remote server. When tomcat
starts up, I would like to make a URL connection to the remote server
and download the latest jar file and use that instead of actually
placing the jar file in the WEB-INF/lib/ directory.

This way, I believe I would be preventing the class files being
decompiled and also if there are any updates to the jar, there will be
a central location for updates.

Question:
1. How do other people implement this?
2. Can I extend the webappclassloader and implement this functionality?

Would appreciate any url or article or help on this topic.

thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with WebApp Classloader using remote Jmx initialization of the Web module.

2004-08-29 Thread Alex Smirnoff
I'm trying to create the WebAppContext remotely with JMX (Tomcat 5.0.27, JDK
1.5)and doing something like this:

public void deployApplication(String context, String path) throws
CoreException {
  init();
  try {
   ObjectName webmodule =
 new
ObjectName(DOMAIN+:j2eetype=WebModule,name=//localhost/+context+,J2EEAppl
ication=none,J2EEServer=none);
   mbsc.createMBean(org.apache.commons.modeler.BaseModelMBean, webmodule,
 new Object[] {org.apache.catalina.core.StandardContext}, new String[]
{java.lang.String});
   mbsc.setAttribute(webmodule, new Attribute(docBase, path));
   mbsc.setAttribute(webmodule, new Attribute(defaultWebXml, web.xml));
   mbsc.setAttribute(webmodule, new Attribute(engineName, DOMAIN));
   mbsc.setAttribute(webmodule, new Attribute(delegate, new
Boolean(true)));
   mbsc.invoke(webmodule, init, new Object[] {}, new String[] {});
   //mbsc.invoke(webmodule, start, new Object[] {}, new String[] {});
  } catch (Throwable e){
   throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID,
IStatus.ERROR, Cannot create the application context for +context, e));
  }
 }

This code initialize, but does not starting the WebContext. When I force the
startup from JConsole it fails on NoClassDefFoundError. The class it fails
to find is in WEB-INF/lib directory.

I see that the classloader is initialized as well. But I'm not sure how to
assing it to Web App module.

Do I have to explicitly set loader atribute?

Thanks,
Alex.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with tomcat5 / svn-javahl classes (classloader problem?)

2004-08-28 Thread Nikita Zhuk
Hi all,
I'm having a problem with Tomcat5 (running on FreeBSD 5.2.1 with jdk 
1.4.2) and my webapp, which uses svn-javahl bindings to connect to the 
Subversion reporitory. The idea of my page is simple:
If http session is new, create svn connection and save in into session.
If http session already exists, use the svn connection saved into 
session.

Everything works fine during the first run - when I restart tomcat and 
open my JSP page. The session is created, svn connection is created, 
and when I refresh my page I'm using the same svn connection from the 
session just as I should. But if I restart my browser and reopen my JSP 
page ( = create a new session), browser just waits for more data, and 
my Java code seems to hang on line:

svnClient = new SVNClient();
of my SVNConnection class. The constructor of SVNClient doesn't take 
any parameters, and it doesn't create any connections, either. 
SVNClient class is in fact an interface to svn-javahl JNI binginds, so 
svn-javahl.jar is placed under $CATALINA_HOME/shared/lib as advised in 
tomcat documentation (to prevent classloader problems with JNI 
interfaces).

If I restart tomcat, my JSP page loads fine again.
The code itself should be ok, I've created several JUnit tests to test 
my methods and they all succeed.

Does anyone have any idea how this weird problem could be solved? I 
suppose it's related to tomcat's classloader, but I don't know how to 
fix it.

Best regards,
Nikita
--
Nikita Zhuk
Mac OS X  Web developer
Marko Karppinen  Co. LLC
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: classloader hangs

2004-08-06 Thread bgood

 loadClass method, and it is not reporting anything, and to the best of
 my knowledge, an error should terminate the JVM right?
 
 No, it shouldn't.  You can catch errors also by catching Throwable
 instead of Exception.
 

Thanks very much for this bit of advice, as it turns out it was throwing
a ClassDefNotFoundError.  However, now that I am catching this error, I
am still bewildered.  When I am trying to load class A, the message in
the ClassDefNotFoundError is simply B which is the class that A
extends (which is present in the directory containing the loading code).
If Tomcat's webapp loader loaded the loading code, why isn't it loading
class B as well?

Ben


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: classloader hangs

2004-08-06 Thread bgood
My attempts to abate this error are proving quite fruitless.  So I was
wondering... what is the preferred method to programatically reload a
class in Tomcat?  I've searched the web but I am stuck.

Thanks
Ben

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: classloader hangs

2004-08-06 Thread Shapira, Yoav

Hi,
You can simply set reloadable=true for your Context and Tomcat will
monitor your classes and reload the webapp (not just the class) as
needed.  You can also programmatically invoke the Manager webapp and use
its reload feature.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, August 06, 2004 9:36 AM
To: Tomcat Users List
Subject: Re: classloader hangs

My attempts to abate this error are proving quite fruitless.  So I was
wondering... what is the preferred method to programatically reload a
class in Tomcat?  I've searched the web but I am stuck.

Thanks
Ben

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: classloader hangs

2004-08-06 Thread bgood
 You can simply set reloadable=true for your Context and Tomcat will
 monitor your classes and reload the webapp (not just the class) as
 needed.  You can also programmatically invoke the Manager webapp and use
 its reload feature.

What if these classes aren't located in the Tomcat directory?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: classloader hangs

2004-08-06 Thread Shapira, Yoav

Hi,
Then you have to write your own custom Loader to handle this.  But don't
expect much help or support, as you're going outside the Servlet Spec
and most people stop caring as much ;)

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, August 06, 2004 10:09 AM
To: Tomcat Users List
Subject: Re: classloader hangs

 You can simply set reloadable=true for your Context and Tomcat will
 monitor your classes and reload the webapp (not just the class) as
 needed.  You can also programmatically invoke the Manager webapp and
use
 its reload feature.

What if these classes aren't located in the Tomcat directory?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: classloader hangs

2004-08-06 Thread bgood
Why must I write a custom Loader, isn't URLClassLoader already suited
for this task?  What is it about URLClassLoader that makes it
incompatable with Tomcat?

 Then you have to write your own custom Loader to handle this.  But don't
 expect much help or support, as you're going outside the Servlet Spec
 and most people stop caring as much ;)
 
 Yoav Shapira
 Millennium Research Informatics
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 06, 2004 10:09 AM
 To: Tomcat Users List
 Subject: Re: classloader hangs
 
  You can simply set reloadable=true for your Context and Tomcat will
  monitor your classes and reload the webapp (not just the class) as
  needed.  You can also programmatically invoke the Manager webapp and
 use
  its reload feature.
 
 What if these classes aren't located in the Tomcat directory?
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 This e-mail, including any attachments, is a confidential business communication, 
 and may contain information that is confidential, proprietary and/or privileged.  
 This e-mail is intended only for the individual(s) to whom it is addressed, and may 
 not be saved, copied, printed, disclosed or used by anyone else.  If you are not 
 the(an) intended recipient, please immediately delete this e-mail from your computer 
 system and notify the sender.  Thank you.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: classloader hangs

2004-08-06 Thread Shapira, Yoav

Hi,
URLClassLoader is not a reloader.  Why did you get the idea it is?

There's nothing in it that's incompatible with Tomcat, in fact Tomcat
just extends it and uses its code.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, August 06, 2004 10:18 AM
To: Tomcat Users List
Subject: Re: classloader hangs

Why must I write a custom Loader, isn't URLClassLoader already suited
for this task?  What is it about URLClassLoader that makes it
incompatable with Tomcat?

 Then you have to write your own custom Loader to handle this.  But
don't
 expect much help or support, as you're going outside the Servlet Spec
 and most people stop caring as much ;)

 Yoav Shapira
 Millennium Research Informatics


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 06, 2004 10:09 AM
 To: Tomcat Users List
 Subject: Re: classloader hangs
 
  You can simply set reloadable=true for your Context and Tomcat
will
  monitor your classes and reload the webapp (not just the class) as
  needed.  You can also programmatically invoke the Manager webapp
and
 use
  its reload feature.
 
 What if these classes aren't located in the Tomcat directory?
 

-
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




 This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended
recipient, please immediately delete this e-mail from your computer
system
and notify the sender.  Thank you.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: classloader hangs

2004-08-06 Thread bgood
I apologize for not being clear the first time.  My class loading scheme
works by first loading classes  with a URLClassLoader and then when the
program wants to reload them, it creates a new URLClassLoader whose
parent is the first URLClassLoader, thus staying within the delegation
model of class loaders (i hope?).

 URLClassLoader is not a reloader.  Why did you get the idea it is?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



classloader hangs

2004-08-05 Thread bgood
Hello,
I am writing a class to be deployed with the Tomcat SOAP web app (I'll
call this class A).  It uses a URLClassloader to load classes from a
directory (i call them modules).  I initialize my class loader with

URLClassLoader initialLoader = new URLClassLoader(urls,
   Thread.currentThread().getContextClassLoader());

   This worked fine for a while.  However, when I decided that
   my class A needed to have a package statement (I wanted to
   put it in a jar file along with some libraries for easy
   distribution), I was very much dismayed when the class
   loading did not work.  Yet the strange part is that it is not
   the usual NoClassDefFound exception, instead the entire
   program just seems to hang upon trying to load one of the
   modules.  I am very dismayed as what was once working code is
   now almost useless.  Chances are, I'm just making a stupid
   mistake, however if anyone could please help me I would be
   grateful.

   Thanks,
   Ben 

   P.S. This works fine when I don't run it under Tomcat, that
   was my reason for posting it here.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: classloader hangs

2004-08-05 Thread Shapira, Yoav

Hi,
If you get a thread dump of the JVM while it's hanging, what does it
show?

The URLClassLoader is intended for use within Tomcat.  It's nice that
you have a program using outside Tomcat, but it's not that meaningful
for comparison testing.  The ClassLoading scheme and hierarchy inside a
servlet container is significantly different from the one inside a
console Java application.

NoClassDefFound is not an exception, it's an Error.  It's different from
ClassNotFoundException.  And that difference (see the JavaDoc for both)
may be the root of your problem.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 05, 2004 11:17 AM
To: [EMAIL PROTECTED]
Subject: classloader hangs

Hello,
I am writing a class to be deployed with the Tomcat SOAP web app (I'll
call this class A).  It uses a URLClassloader to load classes from a
directory (i call them modules).  I initialize my class loader with

URLClassLoader initialLoader = new URLClassLoader(urls,
   Thread.currentThread().getContextClassLoader());

  This worked fine for a while.  However, when I decided that
  my class A needed to have a package statement (I wanted to
  put it in a jar file along with some libraries for easy
  distribution), I was very much dismayed when the class
  loading did not work.  Yet the strange part is that it is not
  the usual NoClassDefFound exception, instead the entire
  program just seems to hang upon trying to load one of the
  modules.  I am very dismayed as what was once working code is
  now almost useless.  Chances are, I'm just making a stupid
  mistake, however if anyone could please help me I would be
  grateful.

  Thanks,
  Ben

  P.S. This works fine when I don't run it under Tomcat, that
  was my reason for posting it here.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: classloader hangs

2004-08-05 Thread bgood
Hello,
I know this is naive of me, but how does one get a thread dump of the
JVM?  Anyway, as for the other comments, do I have to do something
different to use URLClassLoader under Tomcat than I do in a console
application?  I kept getting this same problem under Tomcat before when
I was creating URLClassLoaders without specifying
Thread.currentThread().getContextClassLoader() as the parent, but by
adding it, the error went away.  It just seems strange that code that
worked fine stopped working when the only change I made was to insert a
package statement.  As for the NoClassDefFoundError vs
ClassNotFoundException, I do have exception handling code around the
loadClass method, and it is not reporting anything, and to the best of
my knowledge, an error should terminate the JVM right?

Thanks,
Ben

On Thu, Aug 05, 2004 at 11:22:03AM -0400, Shapira, Yoav wrote:
 
 Hi,
 If you get a thread dump of the JVM while it's hanging, what does it
 show?
 
 The URLClassLoader is intended for use within Tomcat.  It's nice that
 you have a program using outside Tomcat, but it's not that meaningful
 for comparison testing.  The ClassLoading scheme and hierarchy inside a
 servlet container is significantly different from the one inside a
 console Java application.
 
 NoClassDefFound is not an exception, it's an Error.  It's different from
 ClassNotFoundException.  And that difference (see the JavaDoc for both)
 may be the root of your problem.
 
 Yoav Shapira
 Millennium Research Informatics
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 05, 2004 11:17 AM
 To: [EMAIL PROTECTED]
 Subject: classloader hangs
 
 Hello,
 I am writing a class to be deployed with the Tomcat SOAP web app (I'll
 call this class A).  It uses a URLClassloader to load classes from a
 directory (i call them modules).  I initialize my class loader with
 
 URLClassLoader initialLoader = new URLClassLoader(urls,
Thread.currentThread().getContextClassLoader());
 
 This worked fine for a while.  However, when I decided that
 my class A needed to have a package statement (I wanted to
 put it in a jar file along with some libraries for easy
 distribution), I was very much dismayed when the class
 loading did not work.  Yet the strange part is that it is not
 the usual NoClassDefFound exception, instead the entire
 program just seems to hang upon trying to load one of the
 modules.  I am very dismayed as what was once working code is
 now almost useless.  Chances are, I'm just making a stupid
 mistake, however if anyone could please help me I would be
 grateful.
 
 Thanks,
 Ben
 
 P.S. This works fine when I don't run it under Tomcat, that
 was my reason for posting it here.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 This e-mail, including any attachments, is a confidential business communication, 
 and may contain information that is confidential, proprietary and/or privileged.  
 This e-mail is intended only for the individual(s) to whom it is addressed, and may 
 not be saved, copied, printed, disclosed or used by anyone else.  If you are not 
 the(an) intended recipient, please immediately delete this e-mail from your computer 
 system and notify the sender.  Thank you.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: classloader hangs

2004-08-05 Thread Shapira, Yoav

Hi,

I know this is naive of me, but how does one get a thread dump of the
JVM?

Send a SIGQUIT to the JVM process.

package statement.  As for the NoClassDefFoundError vs
ClassNotFoundException, I do have exception handling code around the
loadClass method, and it is not reporting anything, and to the best of
my knowledge, an error should terminate the JVM right?

No, it shouldn't.  You can catch errors also by catching Throwable
instead of Exception.

Yoav



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: classloader hangs

2004-08-05 Thread bgood
On Windows XP? :-(
(my employer doesn't enjoy linux)

 Send a SIGQUIT to the JVM process.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: classloader hangs

2004-08-05 Thread Mike Curwen
if you've got it running in a DOS window (which you might want to do, for
just this purpose), you can try either the Pause/Break key, and if that
doesn't do it, try 'Cntrl-C' in the DOS window.




 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, August 05, 2004 4:10 PM
 To: Tomcat Users List
 Subject: Re: classloader hangs
 
 
 On Windows XP? :-(
 (my employer doesn't enjoy linux)
 
  Send a SIGQUIT to the JVM process.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



custom classloader

2004-07-30 Thread
Hi All,
I'm trying to implement my own ClassLoader enabling to load encrypted classes into web 
application context under Tomcat 4.0.6. My classloader implements as recommended. But 
unfortunately I've got the following runtime exception:

javax.servlet.ServletException: Wrapper cannot find servlet class 
org.apache.jasper.servlet.JspServlet or a class it depends on
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:873)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3279)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
 at org.apache.catalina.core.StandardService.start(StandardService.java:388)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
 at org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:261)
 at org.apache.catalina.startup.CatalinaService.execute(CatalinaService.java:172)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:428)
- Root Cause -
java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet
 at 
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:1127)
 at 
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:992)
 at com.wald.license.checker.LicenseClassLoader.loadClass(LicenseClassLoader.java:76)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:867)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3279)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
 at org.apache.catalina.core.StandardService.start(StandardService.java:388)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
 at org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:261)
 at org.apache.catalina.startup.CatalinaService.execute(CatalinaService.java:172)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:428)

Could You give me a sample ClassLoader wich works correclty? I look through 
org.apache.catalina.loader.WebappClassLoader but it didn't make the sutuation more 
clear.
Thanks in advance
Dmitry

Changing the classloader to load encrypted classes

2004-07-21 Thread Edson Watanabe
Dear sirs,

I need to change the web application classloader that
Tomcat uses, because I need to load signed and/or
encrypted class files for my application. (It's my
client's requirement; he does not want obfuscation or
native-code compilation.)

Is it feasible? 

I've read some of the Tomcat source code (in fact
using grep and some educated guesses; but not the
entire source code), but it has lots of references to
the Classloader class, so I need a clue for finding
exactly what I must change.

Thanks for your attention,

Edson W.





___
Yahoo! Mail agora com 100MB, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Changing the classloader to load encrypted classes

2004-07-21 Thread Shapira, Yoav
Hi,
Yes, it's feasible: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/loader.html.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Edson Watanabe [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 21, 2004 3:43 PM
To: [EMAIL PROTECTED]
Subject: Changing the classloader to load encrypted classes

Dear sirs,

I need to change the web application classloader that
Tomcat uses, because I need to load signed and/or
encrypted class files for my application. (It's my
client's requirement; he does not want obfuscation or
native-code compilation.)

Is it feasible?

I've read some of the Tomcat source code (in fact
using grep and some educated guesses; but not the
entire source code), but it has lots of references to
the Classloader class, so I need a clue for finding
exactly what I must change.

Thanks for your attention,

Edson W.





___
Yahoo! Mail agora com 100MB, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Changing the classloader to load encrypted classes

2004-07-21 Thread Shapira, Yoav

To add a little: you would extend the webapp loader with your own one, and use a 
Loader className=yourClassLoaderName / element inside your context declaration, be 
it in server.xml or in its own file.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Shapira, Yoav
Sent: Wednesday, July 21, 2004 3:43 PM
To: Tomcat Users List
Subject: RE: Changing the classloader to load encrypted classes

Hi,
Yes, it's feasible: http://jakarta.apache.org/tomcat/tomcat-5.0-
doc/config/loader.html.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Edson Watanabe [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 21, 2004 3:43 PM
To: [EMAIL PROTECTED]
Subject: Changing the classloader to load encrypted classes

Dear sirs,

I need to change the web application classloader that
Tomcat uses, because I need to load signed and/or
encrypted class files for my application. (It's my
client's requirement; he does not want obfuscation or
native-code compilation.)

Is it feasible?

I've read some of the Tomcat source code (in fact
using grep and some educated guesses; but not the
entire source code), but it has lots of references to
the Classloader class, so I need a clue for finding
exactly what I must change.

Thanks for your attention,

Edson W.





___
Yahoo! Mail agora com 100MB, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Changing the classloader to load encrypted classes

2004-07-21 Thread Edson Watanabe
Thank you for your fast and kind answer. 

I'll try subclassing Loader.

Edson W.


--- Shapira, Yoav [EMAIL PROTECTED] escreveu: 
Hi,
 Yes, it's feasible:

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/loader.html.
 
 Yoav Shapira
 Millennium Research Informatics
 
 
 -Original Message-
 From: Edson Watanabe
 [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 21, 2004 3:43 PM
 To: [EMAIL PROTECTED]
 Subject: Changing the classloader to load encrypted
 classes
 
 Dear sirs,
 
 I need to change the web application classloader
 that
 Tomcat uses, because I need to load signed and/or
 encrypted class files for my application. (It's my
 client's requirement; he does not want obfuscation
 or
 native-code compilation.)
 
 Is it feasible?
 
 I've read some of the Tomcat source code (in fact
 using grep and some educated guesses; but not the
 entire source code), but it has lots of references
 to
 the Classloader class, so I need a clue for finding
 exactly what I must change.
 
 Thanks for your attention,
 
 Edson W.
 
 
 
 
 

___
 Yahoo! Mail agora com 100MB, anti-spam e antivírus
 grátis!
 http://br.info.mail.yahoo.com/
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
  





___
Yahoo! Mail agora com 100MB, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Classloader behavior in 5.0.25 5.0.16

2004-07-04 Thread Robert Hunt
I'm trying to upgrade a Tomcat (development) server from 5.0.16 to 5.0.25
and have found some classloader frustrations.  Ultimately, I'd like to have
the webapp JAR file under its webapp/WEB-INF/lib directory and a set of
shared classes (in several JARs) residing in the $CATALINA_BASE/shared/lib
directory (to be shared among several web apps).  Everything else being
equal between the 5.0.16 and 5.0.25 environments, listed below are JAR
placements that work and those that throw exceptions:

Key:
wa =   webapp;
$CB  =   $CATALINA_BASE
:::   =   stack trace continues

com.squirrelydo.core.= package prefix indicating a shared class
com.squirrelydo.lnal.  = package prefix indicating a webapp class


version webapp classesshared classes
result
==  ===   =   ==
5.0.16  wa/WEB-INF/lib wa/WEB-INF/lib  works
fine

5.0.16  wa/WEB-INF/lib $CB/shared/lib
java.lang.ClassNotFoundException: com.squirrelydo.lnal.LNAL$Session
at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
.java:891)
at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader
.java:756)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.squirrelydo.core.util.ClassAsEnum.init(ClassAsEnum.java:35)
at com.squirrelydo.core.prefs.Property.init(Property.java:45)
at com.squirrelydo.lnal.LNAL.init(LNAL.java:30)
at com.squirrelydo.lnal.LNAL$Session.clinit(LNAL.java:43)
:::

The class initialization for LNAL$Session triggers the constructor for a
super class (ClassAsEnum) that spans the divide between webapp and
shared classloaders.  The ClassAsEnum super class can't see LNAL$Session.

5.0.16  $CB/shared/lib $CB/shared/lib
works fine

5.0.25  wa/WEB-INF/lib  wa/WEB-INF/lib  works
fine

5.0.25  wa/WEB-INF/lib   $CB/shared/lib
java.lang.NoClassDefFoundError: com/squirrelydo/core/servlet/TMLServlet
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(Unknown Source)
 at java.security.SecureClassLoader.defineClass(Unknown Source)
 at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
ader.java:1634)
 at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
a:860)
 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1307)
 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1189)
 at java.lang.ClassLoader.loadClassInternal(Unknown Source)
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(Unknown Source)
 at java.security.SecureClassLoader.defineClass(Unknown Source)
 at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo
ader.java:1634)
 at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav
a:860)
 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1307)
 at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1189)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:95
4)
:::

A webapp class's (I'm not sure exactly which) constructor is attempting to
find the (shared) super class TMLServlet.

5.0.25  $CB/shared/lib $CB/shared/lib
java.lang.ClassNotFoundException: com.squirrelydo.lnal.Calendar

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1340)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1189)
:::

From the Tomcat log:

---
2004-07-04 13:16:10 StandardContext[/LNAL]Marking servlet Calendar as
unavailable
2004-07-04 13:16:10 StandardContext[/LNAL]Error loading WebappClassLoader
  delegate: false
  repositories:
/WEB-INF/classes/
-- Parent Classloader:
StandardClassLoader
  delegate: true
  repositories:
-- Parent Classloader:
StandardClassLoader
  delegate: true
  repositories:
file:D:\zVAR\tomcat\5.0.25\common\classes\
file:D:\zVAR\tomcat\5.0.25\common\endorsed\xercesImpl.jar
file:D:\zVAR\tomcat\5.0.25\common\endorsed\xmlParserAPIs.jar
file:D:\zVAR\tomcat\5.0.25\common\lib

Weird Classloader Scenario - Is This Possible?

2004-06-02 Thread Matthew . Hanson
Hi,

We have a fairly generic servlet framework that is used across more than 
one web app deployed to tomcat 4.1.30 on win2k using java 1.4.2_03-b02. 
The framework was initially included in the WEB-INF/lib for each 
application.  However, I was hoping the framework jar could reside in 
shared/lib.  This framework code basically uses a request handler to pass 
incoming requests to a webapp-specific request processor.  The request 
handler instantiates a request processor via 
handler.getClass().getClassLoader().loadClass(SOME_PROCESSOR).newInstance(). 
 Basically, as expected, the classloader fails to load the request 
processor class with the framework jar now in shared/lib.

Is there a loader scheme that I can use in the shared/lib jar that can be 
used to instantiate classes from my webapp (WEB-INF/classes)?

Thanks!
Matt Hanson

RE: Weird Classloader Scenario - Is This Possible?

2004-06-02 Thread Shapira, Yoav

Hi,
You can try Thread.currentThread().getContextClassLoader() instead of
handler.getClass().getClassLoader().

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 02, 2004 2:37 PM
To: [EMAIL PROTECTED]
Subject: Weird Classloader Scenario - Is This Possible?

Hi,

We have a fairly generic servlet framework that is used across more
than
one web app deployed to tomcat 4.1.30 on win2k using java 1.4.2_03-b02.
The framework was initially included in the WEB-INF/lib for each
application.  However, I was hoping the framework jar could reside in
shared/lib.  This framework code basically uses a request handler to
pass
incoming requests to a webapp-specific request processor.  The request
handler instantiates a request processor via
handler.getClass().getClassLoader().loadClass(SOME_PROCESSOR).newInstan
ce()
.
 Basically, as expected, the classloader fails to load the request
processor class with the framework jar now in shared/lib.

Is there a loader scheme that I can use in the shared/lib jar that can
be
used to instantiate classes from my webapp (WEB-INF/classes)?

Thanks!
Matt Hanson



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Weird Classloader Scenario - Is This Possible?

2004-06-02 Thread Matthew . Hanson
I think that may have been the ticket.  Thanks for all the help!




Shapira, Yoav [EMAIL PROTECTED]
06/02/2004 01:37 PM
Please respond to Tomcat Users List

 
To: Tomcat Users List [EMAIL PROTECTED]
cc: 
Subject:RE: Weird Classloader Scenario - Is This Possible?



Hi,
You can try Thread.currentThread().getContextClassLoader() instead of
handler.getClass().getClassLoader().

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 02, 2004 2:37 PM
To: [EMAIL PROTECTED]
Subject: Weird Classloader Scenario - Is This Possible?

Hi,

We have a fairly generic servlet framework that is used across more
than
one web app deployed to tomcat 4.1.30 on win2k using java 1.4.2_03-b02.
The framework was initially included in the WEB-INF/lib for each
application.  However, I was hoping the framework jar could reside in
shared/lib.  This framework code basically uses a request handler to
pass
incoming requests to a webapp-specific request processor.  The request
handler instantiates a request processor via
handler.getClass().getClassLoader().loadClass(SOME_PROCESSOR).newInstan
ce()
.
 Basically, as expected, the classloader fails to load the request
processor class with the framework jar now in shared/lib.

Is there a loader scheme that I can use in the shared/lib jar that can
be
used to instantiate classes from my webapp (WEB-INF/classes)?

Thanks!
Matt Hanson



This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, 
proprietary and/or privileged.  This e-mail is intended only for the 
individual(s) to whom it is addressed, and may not be saved, copied, 
printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your 
computer system and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






Strusts' classloader could not find my servlets

2004-05-25 Thread Chris Wahl
Howdy,
(B
(BI am using Eclipse 2.1.3, Lomboz 2.1.3 and TC4.1.27 developing webapp based
(Bon
(BStruts1.1. I created a Eclipse project under f:\strutsdemo, and a webmod
(Bunder directory f:\strutsdemo\demo.
(B
(BAll my servlets and JavaBeans were created under directory f:\strutsdemo,
(Band I add this directory to TC's classpath as to let TC find my servlets.
(BIf my webapp(i.e. webmod) are not based on struts , TC can find my servlets
(Band my webapp will work fine.
(B
(BThe problem is : because my webapp were based on struts, struts' classloader
(Bmechanism will not find servlets if they are not put in webapp's
(BWEB-INF/classes
(Bor  WEB-INF/lib , as my situation.
(B
(BHere is the code snippet from the class org.apache.struts.util.RequestUtils,
(BClassNotFoundException will be thrown by this function.
(B//--- code ---
(Bpublic static Class applicationClass(String className) throws
(BClassNotFoundException {
(B
(B// Look up the class loader to be used
(BClassLoader classLoader =
(BThread.currentThread().getContextClassLoader();
(Bif (classLoader == null) {
(BclassLoader = RequestUtils.class.getClassLoader();
(B}
(B
(B// Attempt to load the specified class
(Breturn (classLoader.loadClass(className));
(B
(B}
(B//--- code ---
(B
(B
(BSo My question is: How to configure Tomcat 4.1.27 which will lauched by
(BLomboz
(Bin Eclipse to find servlets not with \WEB-INF\classes or \WEB-INF\lib? or
(Bshall
(BI change Struts's classloader policy?
(B
(BTIA
(B
(B
(BBTW, if I configure eclipse project's output path to
(Bf:\strutsdemo\demo\WEB-INF\classes (demo is the webapp dir), Eclipse (or
(BLomboz)
(Bwill create another webapp under directory \WEB-INF\classes, there will be
(Btwo
(Bnested webapps :),  I had to use the default configuration.
(B
(B
(B-
(BTo unsubscribe, e-mail: [EMAIL PROTECTED]
(BFor additional commands, e-mail: [EMAIL PROTECTED]

RE: Strusts' classloader could not find my servlets

2004-05-25 Thread Shapira, Yoav

Hi,
I personally don't know.  As an FYI, you are not likely to get as much
help on this list for IDE-specific (or in this case,
IDE-plugin-specific, which is even worse as far as getting support)
problems.  Check out the Struts, Eclipse, Lomboz, general Java lists as
well.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Chris Wahl [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 25, 2004 8:14 AM
To: Tomcat Users List
Subject: Strusts' classloader could not find my servlets

Howdy,

I am using Eclipse 2.1.3, Lomboz 2.1.3 and TC4.1.27 developing webapp
based
on
Struts1.1. I created a Eclipse project under f:\strutsdemo, and a
webmod
under directory f:\strutsdemo\demo.

All my servlets and JavaBeans were created under directory
f:\strutsdemo,
and I add this directory to TC's classpath as to let TC find my
servlets.
If my webapp(i.e. webmod) are not based on struts , TC can find my
servlets
and my webapp will work fine.

The problem is : because my webapp were based on struts, struts'
classloader
mechanism will not find servlets if they are not put in webapp's
WEB-INF/classes
or  WEB-INF/lib , as my situation.

Here is the code snippet from the class
org.apache.struts.util.RequestUtils,
ClassNotFoundException will be thrown by this function.
//--- code ---
public static Class applicationClass(String className) throws
ClassNotFoundException {

// Look up the class loader to be used
ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
classLoader = RequestUtils.class.getClassLoader();
}

// Attempt to load the specified class
return (classLoader.loadClass(className));

}
//--- code ---


So My question is: How to configure Tomcat 4.1.27 which will lauched by
Lomboz
in Eclipse to find servlets not with \WEB-INF\classes or \WEB-INF\lib?
or
shall
I change Struts's classloader policy?

TIA


BTW, if I configure eclipse project's output path to
f:\strutsdemo\demo\WEB-INF\classes (demo is the webapp dir), Eclipse
(or
Lomboz)
will create another webapp under directory \WEB-INF\classes, there will
be
two
nested webapps :),  I had to use the default configuration.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-19 Thread John H

- Original Message - 
From: Jeanfrancois Arcand [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, April 16, 2004 5:52 PM
Subject: Re: Extending GenericPrincipal/RealmBase: Essentially a classloader
question


 Have you tried the privileged attribute in context.xml instead? I'm
 confident it will work for what you are trying to do.

Yes, this worked.

I also enabled the security manager. If I wanted to emulate the
'priveledged=true' functionality without exposing as much as
'priveledged=true does, could I do this? I want my app to be able to
'look' into server/lib, but only at what I tell it it can.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-16 Thread Jeanfrancois Arcand


Rossen Raykov wrote:

Probably you can define interface and use casting while you are accessing
your Principle implementation. Frankly, I didnt try it but it seems like
usable solution.
There is another technique that is quarantined to work though. It is very
simple and employs only Javas Reflection.
Four days ago I send an e-mail to [EMAIL PROTECTED] explaining how
Reflection may be used to extract users password from
org.apache.catalina.realm.GenericPrincipal and so fare I didnt get any
response.
Probably this is not treated as security issue so let me make it public.
Attached you will find my original e-mail to [EMAIL PROTECTED] explaining
how this may be accomplished and how one can protect himself from such
exposure.
 

With the Security Manager turned on, this hack will not work. So there 
is no security issue here. Of course without SecurityManager, you can do 
whatever you want.

-- Jeanfrancois


Regards,
Rossen Raykov
 

-Original Message-
From: John H [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 15, 2004 1:32 PM
To: Tomcat Users List
Subject: Re: Extending GenericPrincipal/RealmBase: 
Essentially a classloader question

Webapps can see GenericPrincipal only when I move 
catalina.jar to common/lib. That's the kicker. Catalina has 
supplied a nice generic principal that implements 
java.security.Principal in useful ways, but then prevents me 
from using it in my webapps (directly or through extensions).

I must be missing the reasoning behind that.

- Original Message - 
From: Benjamin Armintor [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 12:34 PM
Subject: RE: Extending GenericPrincipal/RealmBase: 
Essentially a classloader question

Can your webapps see GenericPrincipal?  Looking at the 
JavaDocs for the Catalina api, it looks like the session 
faade your get app gets is going to have access to a 
java.security.Principal (likely also a faade), not a 
GenericPrincipal.  Maybe instead of extending a class in the 
server/Catalina classloader, you could implement another 
subclass of java.security.Principal, and have that class 
loaded in the common classloader.

Benjamin J. Armintor
Systems Analyst
ITS-Systems: Mainframe Group
University of Texas - Austin
tele: (512) 232-6562
email: [EMAIL PROTECTED]


-Original Message-
From: John H [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 11:25 AM
To: Tomcat Users List
Subject: Extending GenericPrincipal/RealmBase: Essentially a 
classloader question

HI all,

He have implemented our own realm and principal buy extending 
org.apache.catalina.realm.RealmBase and GenericPrincipal.

(Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)

By doing this, however, we've got ourselves into sort of a 
catch 22 in terms of classloading. Hopefully someone can 
offer some assistance.

I've referenced the Class Loader HOW-TO at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-h
   

owto.html, so I'll use it's terminology.

RealmBase and GenericPrincipal are located in catalina.jar, which resides
physically in server/lib. The howo defines this jar as in the Catalina class
loader. The definition says that the Catalina classes are totally invisible
to web applications, which seems true enough. In order to extend these, I
must locate my jar in server/lib. So far so good.
The problem is that I need to use my extension of GenericPrincipal within my
webapps.
I tried moving my jar to common/lib, since, according to the parent tree in
the howto, it is visible to both the Catalina branch and the webapp branch.
Doing this causes a NoClassDefFoundError for GenericPrincipal. Apparently
since the Catalina classloader is below the common classloader, it can't
find GenericPrincipal.
The only solution that appears to work is moving the entire contents of
server/lib to common/lib, essentially 'promoting' all of the classes
normally in the Catalina class loader to the common class loader.
Is this the best solution? It seems to me that I should be able to extend
RealmBase/GenericPrincipal without having to move jars around.
Any ideas?

John

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Subject:
Principal's password exposure
From:
Rossen Raykov [EMAIL PROTECTED]
Date:
Sun, 11 Apr 2004 23:31:07 -0400
To:
[EMAIL PROTECTED]
Tomcat's implementation of java.security.Principal
org.apache.catalina.realm.GenericPrincipal is exposing user's password to
the applications.
Class info:
GenericPrincipal is having method declared as:
code
public String getPassword()
/code
which returns principal's password.
This method is used by the various

Re: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-16 Thread John H
Thanks for the replies.

I've tried some of the suggestions, and I guess I've hit a wall again.

From what I'm seeing, in order extend RealmBase/GenericPrincipal, your class
MUST exist in server/lib (given the default configuration). I see no other
way, unless I'm missing something. RealmBase is in catalina.jar, which is in
server/lib and is in the catalina classloader. In order for a class to
extend this, it too must be in the catalina classloader.

I tried this modification to catalina.properties:

common.loader=${catalina.base}/common/classes,${catalina.base}/common/endors
ed/*.jar,
${catalina.base}/common/lib/*.jar,${catalina.base}/server/classes,${catalina
.base}/server/lib/*.jar

(note my extension classes are in bbarealm.jar, which is in server/lib)

Withouth making any more changes (other than moving tomcat's jar's back to
their original locations), this worked. This seems exactly like moving all
the files from server/lib (including my bbarealm.jar) to common/lib, though.

Then I tried this: I moved my bbarealm.jar to shared/lib (making it visible
to the apps), changed the common loader back to it's original form, and
added
${catalina.home}/shared/lib/bbarealm.jar to the sever.loader line. This
results in a NCDF for org.apache.catalina.realm.RealmBase

*pulls hair* I'm not sure how catalina.policies is going to help me. This
isn't an priviledges issue. It's a classloader issue. The only classloader
that seems to allow me to extend RealmBase/GenericPrincipal is the catalina
classloader, and can't see a way to add a class to this classloader (other
than sticking it in server/lib, which makes it invisible to my apps!). There
is no 'catalina.loader' line in catalina.properties.

*sigh* Any thoughts?

- Original Message - 
From: Jeanfrancois Arcand [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 2:55 PM
Subject: Re: Extending GenericPrincipal/RealmBase: Essentially a classloader
question




 John H wrote:

 HI all,
 
 He have implemented our own realm and principal buy extending
org.apache.catalina.realm.RealmBase and GenericPrincipal.
 
 (Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)
 
 By doing this, however, we've got ourselves into sort of a catch 22 in
terms of classloading. Hopefully someone can offer some assistance.
 
 I've referenced the Class Loader HOW-TO at
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html, so
I'll use it's terminology.
 
 RealmBase and GenericPrincipal are located in catalina.jar, which resides
physically in server/lib. The howo defines this jar as in the Catalina class
loader. The definition says that the Catalina classes are totally invisible
to web applications, which seems true enough. In order to extend these, I
must locate my jar in server/lib. So far so good.
 
 The problem is that I need to use my extension of GenericPrincipal within
my webapps.
 
 I tried moving my jar to common/lib, since, according to the parent tree
in the howto, it is visible to both the Catalina branch and the webapp
branch. Doing this causes a NoClassDefFoundError for GenericPrincipal.
Apparently since the Catalina classloader is below the common classloader,
it can't find GenericPrincipal.
 
 The only solution that appears to work is moving the entire contents of
server/lib to common/lib, essentially 'promoting' all of the classes
normally in the Catalina class loader to the common class loader.
 
 Is this the best solution? It seems to me that I should be able to extend
RealmBase/GenericPrincipal without having to move jars around.
 
 Any ideas?
 
 
 One way will be to define, in your context.xml, the attribute
 privileged=true. This will give the web app access to all the
 server/lib classes (but that's not secure since your web app can play
 with the catalina internal).

 If you can turn the SecurityManager on, then  what you can do after is
 turning it on (this will protected all catalina classes from package
 definition/insertionsee catalina.properties for the list of
 protection), you can then add your web app codebase in the
 catalina.policy so only your web app will be able to use the catalina.jar.

 I don't see any other way to achieve what you want to do.

 -- Jeanfrancois



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-16 Thread Jeanfrancois Arcand


John H wrote:

Thanks for the replies.

I've tried some of the suggestions, and I guess I've hit a wall again.

From what I'm seeing, in order extend RealmBase/GenericPrincipal, your class
MUST exist in server/lib (given the default configuration). I see no other
way, unless I'm missing something. RealmBase is in catalina.jar, which is in
server/lib and is in the catalina classloader. In order for a class to
extend this, it too must be in the catalina classloader.
I tried this modification to catalina.properties:

common.loader=${catalina.base}/common/classes,${catalina.base}/common/endors
ed/*.jar,
${catalina.base}/common/lib/*.jar,${catalina.base}/server/classes,${catalina
.base}/server/lib/*.jar
(note my extension classes are in bbarealm.jar, which is in server/lib)

Withouth making any more changes (other than moving tomcat's jar's back to
their original locations), this worked. This seems exactly like moving all
the files from server/lib (including my bbarealm.jar) to common/lib, though.
Then I tried this: I moved my bbarealm.jar to shared/lib (making it visible
to the apps), changed the common loader back to it's original form, and
added
${catalina.home}/shared/lib/bbarealm.jar to the sever.loader line. This
results in a NCDF for org.apache.catalina.realm.RealmBase
 

StrangeLet me investigate :-)

Have you tried the privileged attribute in context.xml instead? I'm 
confident it will work for what you are trying to do.

*pulls hair* I'm not sure how catalina.policies is going to help me. This
isn't an priviledges issue. It's a classloader issue. The only classloader
that seems to allow me to extend RealmBase/GenericPrincipal is the catalina
classloader, and can't see a way to add a class to this classloader (other
than sticking it in server/lib, which makes it invisible to my apps!). There
is no 'catalina.loader' line in catalina.properties.
 

Yes, but if all the web app you are deploying needs to have the 
privileged attribute, then you might want to turn on the SecurityManager.

-- Jeanfrancois

*sigh* Any thoughts?

- Original Message - 
From: Jeanfrancois Arcand [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 2:55 PM
Subject: Re: Extending GenericPrincipal/RealmBase: Essentially a classloader
question

 

John H wrote:

   

HI all,

He have implemented our own realm and principal buy extending
 

org.apache.catalina.realm.RealmBase and GenericPrincipal.
 

(Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)

By doing this, however, we've got ourselves into sort of a catch 22 in
 

terms of classloading. Hopefully someone can offer some assistance.
 

I've referenced the Class Loader HOW-TO at
 

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html, so
I'll use it's terminology.
 

RealmBase and GenericPrincipal are located in catalina.jar, which resides
 

physically in server/lib. The howo defines this jar as in the Catalina class
loader. The definition says that the Catalina classes are totally invisible
to web applications, which seems true enough. In order to extend these, I
must locate my jar in server/lib. So far so good.
 

The problem is that I need to use my extension of GenericPrincipal within
 

my webapps.
 

I tried moving my jar to common/lib, since, according to the parent tree
 

in the howto, it is visible to both the Catalina branch and the webapp
branch. Doing this causes a NoClassDefFoundError for GenericPrincipal.
Apparently since the Catalina classloader is below the common classloader,
it can't find GenericPrincipal.
 

The only solution that appears to work is moving the entire contents of
 

server/lib to common/lib, essentially 'promoting' all of the classes
normally in the Catalina class loader to the common class loader.
 

Is this the best solution? It seems to me that I should be able to extend
 

RealmBase/GenericPrincipal without having to move jars around.
 

Any ideas?

 

One way will be to define, in your context.xml, the attribute
privileged=true. This will give the web app access to all the
server/lib classes (but that's not secure since your web app can play
with the catalina internal).
If you can turn the SecurityManager on, then  what you can do after is
turning it on (this will protected all catalina classes from package
definition/insertionsee catalina.properties for the list of
protection), you can then add your web app codebase in the
catalina.policy so only your web app will be able to use the catalina.jar.
I don't see any other way to achieve what you want to do.

-- Jeanfrancois

   



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-15 Thread John H
HI all,

He have implemented our own realm and principal buy extending 
org.apache.catalina.realm.RealmBase and GenericPrincipal.

(Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)

By doing this, however, we've got ourselves into sort of a catch 22 in terms of 
classloading. Hopefully someone can offer some assistance.

I've referenced the Class Loader HOW-TO at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html, so I'll use 
it's terminology.

RealmBase and GenericPrincipal are located in catalina.jar, which resides physically 
in server/lib. The howo defines this jar as in the Catalina class loader. The 
definition says that the Catalina classes are totally invisible to web applications, 
which seems true enough. In order to extend these, I must locate my jar in server/lib. 
So far so good.

The problem is that I need to use my extension of GenericPrincipal within my webapps.

I tried moving my jar to common/lib, since, according to the parent tree in the howto, 
it is visible to both the Catalina branch and the webapp branch. Doing this causes a 
NoClassDefFoundError for GenericPrincipal. Apparently since the Catalina classloader 
is below the common classloader, it can't find GenericPrincipal. 

The only solution that appears to work is moving the entire contents of server/lib to 
common/lib, essentially 'promoting' all of the classes normally in the Catalina class 
loader to the common class loader. 

Is this the best solution? It seems to me that I should be able to extend 
RealmBase/GenericPrincipal without having to move jars around. 

Any ideas?

John

RE: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-15 Thread Benjamin Armintor
Can your webapps see GenericPrincipal?  Looking at the JavaDocs for the Catalina api, 
it looks like the session façade your get app gets is going to have access to a 
java.security.Principal (likely also a façade), not a GenericPrincipal.  Maybe instead 
of extending a class in the server/Catalina classloader, you could implement another 
subclass of java.security.Principal, and have that class loaded in the common 
classloader.  

Benjamin J. Armintor
Systems Analyst
ITS-Systems: Mainframe Group
University of Texas - Austin
tele: (512) 232-6562
email: [EMAIL PROTECTED]
 


-Original Message-
From: John H [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 15, 2004 11:25 AM
To: Tomcat Users List
Subject: Extending GenericPrincipal/RealmBase: Essentially a classloader question


HI all,

He have implemented our own realm and principal buy extending 
org.apache.catalina.realm.RealmBase and GenericPrincipal.

(Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)

By doing this, however, we've got ourselves into sort of a catch 22 in terms of 
classloading. Hopefully someone can offer some assistance.

I've referenced the Class Loader HOW-TO at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html, so I'll use 
it's terminology.

RealmBase and GenericPrincipal are located in catalina.jar, which resides physically 
in server/lib. The howo defines this jar as in the Catalina class loader. The 
definition says that the Catalina classes are totally invisible to web applications, 
which seems true enough. In order to extend these, I must locate my jar in server/lib. 
So far so good.

The problem is that I need to use my extension of GenericPrincipal within my webapps.

I tried moving my jar to common/lib, since, according to the parent tree in the howto, 
it is visible to both the Catalina branch and the webapp branch. Doing this causes a 
NoClassDefFoundError for GenericPrincipal. Apparently since the Catalina classloader 
is below the common classloader, it can't find GenericPrincipal. 

The only solution that appears to work is moving the entire contents of server/lib to 
common/lib, essentially 'promoting' all of the classes normally in the Catalina class 
loader to the common class loader. 

Is this the best solution? It seems to me that I should be able to extend 
RealmBase/GenericPrincipal without having to move jars around. 

Any ideas?

John

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-15 Thread John H
Webapps can see GenericPrincipal only when I move catalina.jar to
common/lib. That's the kicker. Catalina has supplied a nice generic
principal that implements java.security.Principal in useful ways, but then
prevents me from using it in my webapps (directly or through extensions).

I must be missing the reasoning behind that.

- Original Message - 
From: Benjamin Armintor [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 12:34 PM
Subject: RE: Extending GenericPrincipal/RealmBase: Essentially a classloader
question


Can your webapps see GenericPrincipal?  Looking at the JavaDocs for the
Catalina api, it looks like the session façade your get app gets is going to
have access to a java.security.Principal (likely also a façade), not a
GenericPrincipal.  Maybe instead of extending a class in the server/Catalina
classloader, you could implement another subclass of
java.security.Principal, and have that class loaded in the common
classloader.

Benjamin J. Armintor
Systems Analyst
ITS-Systems: Mainframe Group
University of Texas - Austin
tele: (512) 232-6562
email: [EMAIL PROTECTED]



-Original Message-
From: John H [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 11:25 AM
To: Tomcat Users List
Subject: Extending GenericPrincipal/RealmBase: Essentially a classloader
question


HI all,

He have implemented our own realm and principal buy extending
org.apache.catalina.realm.RealmBase and GenericPrincipal.

(Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)

By doing this, however, we've got ourselves into sort of a catch 22 in terms
of classloading. Hopefully someone can offer some assistance.

I've referenced the Class Loader HOW-TO at
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html, so
I'll use it's terminology.

RealmBase and GenericPrincipal are located in catalina.jar, which resides
physically in server/lib. The howo defines this jar as in the Catalina class
loader. The definition says that the Catalina classes are totally invisible
to web applications, which seems true enough. In order to extend these, I
must locate my jar in server/lib. So far so good.

The problem is that I need to use my extension of GenericPrincipal within my
webapps.

I tried moving my jar to common/lib, since, according to the parent tree in
the howto, it is visible to both the Catalina branch and the webapp branch.
Doing this causes a NoClassDefFoundError for GenericPrincipal. Apparently
since the Catalina classloader is below the common classloader, it can't
find GenericPrincipal.

The only solution that appears to work is moving the entire contents of
server/lib to common/lib, essentially 'promoting' all of the classes
normally in the Catalina class loader to the common class loader.

Is this the best solution? It seems to me that I should be able to extend
RealmBase/GenericPrincipal without having to move jars around.

Any ideas?

John

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-15 Thread Jeanfrancois Arcand


John H wrote:

HI all,

He have implemented our own realm and principal buy extending org.apache.catalina.realm.RealmBase and GenericPrincipal.

(Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)

By doing this, however, we've got ourselves into sort of a catch 22 in terms of classloading. Hopefully someone can offer some assistance.

I've referenced the Class Loader HOW-TO at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html, so I'll use it's terminology.

RealmBase and GenericPrincipal are located in catalina.jar, which resides physically in server/lib. The howo defines this jar as in the Catalina class loader. The definition says that the Catalina classes are totally invisible to web applications, which seems true enough. In order to extend these, I must locate my jar in server/lib. So far so good.

The problem is that I need to use my extension of GenericPrincipal within my webapps.

I tried moving my jar to common/lib, since, according to the parent tree in the howto, it is visible to both the Catalina branch and the webapp branch. Doing this causes a NoClassDefFoundError for GenericPrincipal. Apparently since the Catalina classloader is below the common classloader, it can't find GenericPrincipal. 

The only solution that appears to work is moving the entire contents of server/lib to common/lib, essentially 'promoting' all of the classes normally in the Catalina class loader to the common class loader. 

Is this the best solution? It seems to me that I should be able to extend RealmBase/GenericPrincipal without having to move jars around. 

Any ideas?
 

One way will be to define, in your context.xml, the attribute 
privileged=true. This will give the web app access to all the 
server/lib classes (but that's not secure since your web app can play 
with the catalina internal).

If you can turn the SecurityManager on, then  what you can do after is 
turning it on (this will protected all catalina classes from package 
definition/insertionsee catalina.properties for the list of 
protection), you can then add your web app codebase in the 
catalina.policy so only your web app will be able to use the catalina.jar.

I don't see any other way to achieve what you want to do.

-- Jeanfrancois



John
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-15 Thread Rossen Raykov
Probably you can define interface and use casting while you are accessing
your Principle implementation. Frankly, I didn’t try it but it seems like
usable solution.

There is another technique that is quarantined to work though. It is very
simple and employs only Java’s Reflection.
Four days ago I send an e-mail to [EMAIL PROTECTED] explaining how
Reflection may be used to extract user’s password from
org.apache.catalina.realm.GenericPrincipal and so fare I didn’t get any
response.
Probably this is not treated as security issue so let me make it public.

Attached you will find my original e-mail to [EMAIL PROTECTED] explaining
how this may be accomplished and how one can protect himself from such
exposure.

Regards,
Rossen Raykov


 -Original Message-
 From: John H [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 15, 2004 1:32 PM
 To: Tomcat Users List
 Subject: Re: Extending GenericPrincipal/RealmBase: 
 Essentially a classloader question
 
 
 Webapps can see GenericPrincipal only when I move 
 catalina.jar to common/lib. That's the kicker. Catalina has 
 supplied a nice generic principal that implements 
 java.security.Principal in useful ways, but then prevents me 
 from using it in my webapps (directly or through extensions).
 
 I must be missing the reasoning behind that.
 
 - Original Message - 
 From: Benjamin Armintor [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Thursday, April 15, 2004 12:34 PM
 Subject: RE: Extending GenericPrincipal/RealmBase: 
 Essentially a classloader question
 
 
 Can your webapps see GenericPrincipal?  Looking at the 
 JavaDocs for the Catalina api, it looks like the session 
 façade your get app gets is going to have access to a 
 java.security.Principal (likely also a façade), not a 
 GenericPrincipal.  Maybe instead of extending a class in the 
 server/Catalina classloader, you could implement another 
 subclass of java.security.Principal, and have that class 
 loaded in the common classloader.
 
 Benjamin J. Armintor
 Systems Analyst
 ITS-Systems: Mainframe Group
 University of Texas - Austin
 tele: (512) 232-6562
 email: [EMAIL PROTECTED]
 
 
 
 -Original Message-
 From: John H [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 15, 2004 11:25 AM
 To: Tomcat Users List
 Subject: Extending GenericPrincipal/RealmBase: Essentially a 
 classloader question
 
 
 HI all,
 
 He have implemented our own realm and principal buy extending 
 org.apache.catalina.realm.RealmBase and GenericPrincipal.
 
 (Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)
 
 By doing this, however, we've got ourselves into sort of a 
 catch 22 in terms of classloading. Hopefully someone can 
 offer some assistance.
 
 I've referenced the Class Loader HOW-TO at 
 http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-h
owto.html, so I'll use it's terminology.

RealmBase and GenericPrincipal are located in catalina.jar, which resides
physically in server/lib. The howo defines this jar as in the Catalina class
loader. The definition says that the Catalina classes are totally invisible
to web applications, which seems true enough. In order to extend these, I
must locate my jar in server/lib. So far so good.

The problem is that I need to use my extension of GenericPrincipal within my
webapps.

I tried moving my jar to common/lib, since, according to the parent tree in
the howto, it is visible to both the Catalina branch and the webapp branch.
Doing this causes a NoClassDefFoundError for GenericPrincipal. Apparently
since the Catalina classloader is below the common classloader, it can't
find GenericPrincipal.

The only solution that appears to work is moving the entire contents of
server/lib to common/lib, essentially 'promoting' all of the classes
normally in the Catalina class loader to the common class loader.

Is this the best solution? It seems to me that I should be able to extend
RealmBase/GenericPrincipal without having to move jars around.

Any ideas?

John

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---BeginMessage---
Title: Principal's password exposure






Tomcat's implementation of java.security.Principal

org.apache.catalina.realm.GenericPrincipal is exposing user's password to

the applications.


Class info:

GenericPrincipal is having method declared as:

code

 public String getPassword()

/code

which returns principal's password.

This method is used by the various realm implementations in the same

package.


Problem description:

Although GenericPrincipal is instantiated by a different class loader an

application may use Java's reflection to obtain principal's password.

This problem exists in both 4.x and 5.x implementations

RE: Extending GenericPrincipal/RealmBase: Essentially a classloader question

2004-04-15 Thread Benjamin Armintor
To be fair, the reflection API makes it difficult to hide much of anything- even if 
the accessor methods aren't public.  If you're really security conscious, and can't 
vette all the code in your app server, you should be running with the security manager 
on.  This allows you to prohibit both reflection and access to other classloaders.


-Original Message-
From:   Rossen Raykov [mailto:[EMAIL PROTECTED]
Sent:   Thu 4/15/2004 9:50 PM
To: 'Tomcat Users List'
Cc: 
Subject:RE: Extending GenericPrincipal/RealmBase: Essentially a classloader 
question
Probably you can define interface and use casting while you are accessing
your Principle implementation. Frankly, I didnt try it but it seems like
usable solution.

There is another technique that is quarantined to work though. It is very
simple and employs only Javas Reflection.
Four days ago I send an e-mail to [EMAIL PROTECTED] explaining how
Reflection may be used to extract users password from
org.apache.catalina.realm.GenericPrincipal and so fare I didnt get any
response.
Probably this is not treated as security issue so let me make it public.

Attached you will find my original e-mail to [EMAIL PROTECTED] explaining
how this may be accomplished and how one can protect himself from such
exposure.

Regards,
Rossen Raykov


 -Original Message-
 From: John H [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 15, 2004 1:32 PM
 To: Tomcat Users List
 Subject: Re: Extending GenericPrincipal/RealmBase: 
 Essentially a classloader question
 
 
 Webapps can see GenericPrincipal only when I move 
 catalina.jar to common/lib. That's the kicker. Catalina has 
 supplied a nice generic principal that implements 
 java.security.Principal in useful ways, but then prevents me 
 from using it in my webapps (directly or through extensions).
 
 I must be missing the reasoning behind that.
 
 - Original Message - 
 From: Benjamin Armintor [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Thursday, April 15, 2004 12:34 PM
 Subject: RE: Extending GenericPrincipal/RealmBase: 
 Essentially a classloader question
 
 
 Can your webapps see GenericPrincipal?  Looking at the 
 JavaDocs for the Catalina api, it looks like the session 
 faade your get app gets is going to have access to a 
 java.security.Principal (likely also a faade), not a 
 GenericPrincipal.  Maybe instead of extending a class in the 
 server/Catalina classloader, you could implement another 
 subclass of java.security.Principal, and have that class 
 loaded in the common classloader.
 
 Benjamin J. Armintor
 Systems Analyst
 ITS-Systems: Mainframe Group
 University of Texas - Austin
 tele: (512) 232-6562
 email: [EMAIL PROTECTED]
 
 
 
 -Original Message-
 From: John H [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 15, 2004 11:25 AM
 To: Tomcat Users List
 Subject: Extending GenericPrincipal/RealmBase: Essentially a 
 classloader question
 
 
 HI all,
 
 He have implemented our own realm and principal buy extending 
 org.apache.catalina.realm.RealmBase and GenericPrincipal.
 
 (Using TC5.0.19 on Solaris and Windows. Realm defined in Context.)
 
 By doing this, however, we've got ourselves into sort of a 
 catch 22 in terms of classloading. Hopefully someone can 
 offer some assistance.
 
 I've referenced the Class Loader HOW-TO at 
 http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-h
owto.html, so I'll use it's terminology.

RealmBase and GenericPrincipal are located in catalina.jar, which resides
physically in server/lib. The howo defines this jar as in the Catalina class
loader. The definition says that the Catalina classes are totally invisible
to web applications, which seems true enough. In order to extend these, I
must locate my jar in server/lib. So far so good.

The problem is that I need to use my extension of GenericPrincipal within my
webapps.

I tried moving my jar to common/lib, since, according to the parent tree in
the howto, it is visible to both the Catalina branch and the webapp branch.
Doing this causes a NoClassDefFoundError for GenericPrincipal. Apparently
since the Catalina classloader is below the common classloader, it can't
find GenericPrincipal.

The only solution that appears to work is moving the entire contents of
server/lib to common/lib, essentially 'promoting' all of the classes
normally in the Catalina class loader to the common class loader.

Is this the best solution? It seems to me that I should be able to extend
RealmBase/GenericPrincipal without having to move jars around.

Any ideas?

John

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe

  1   2   3   4   >