RE: Not able to start WebApp on JDK 11

2024-06-18 Thread Ed Rouse
Update on shared

From: Shivaanand Verma 
Sent: Tuesday, June 18, 2024 1:30 PM
To: users@tomcat.apache.org
Subject: Not able to start WebApp on JDK 11

[External email: Use caution! Do not open attachments or click on links from 
unknown senders or unexpected emails.]
Hi All,

We are having a Jersey Servlet application running on the 9.0.80 version of
Apache Tomcat. Recently we've been trying to migrate our application from
JDK 8 to JDK 11.

The application used to run smoothly on JDK 8, but when compiled against
JDK 11, it does not start up. The tomcat webapps directory expands the
application.war file into its directory but the control never reaches
initialising classes. We are not able to understand what is blocking the
application from running since catalina.out and juli.log are not showing
any exceptions or error traces.

We've enabled debug logging using the 
logging.properties
 file too, but
still we don't see any logs in catalina.out. Is there a way to determine
why is tomcat not able to start the application or what classes it is
trying to load and is failing to do so?

Any help would be appreciated.

Thanks
Shivanand Verma


RE: Tomcat SSL stops working after an undetermined amount of time

2021-05-24 Thread Ed Rouse
This works for me. In server.xml:









From: Ezsra McDonald 
Sent: Monday, May 24, 2021 4:10 PM
To: Tomcat Users List 
Subject: Re: Tomcat SSL stops working after an undetermined amount of time

[External email: Use caution! Do not open attachments or click on links from 
unknown senders or unexpected emails.]
Chris,

Thanks for your response.

These Tomcat servers are something I inherited. I do not know what this
bouncycastle.crypto is. If it is making my setup complicated how do I get
around it? Is it part of the org.apache.coyote.http11.Http11NioProtocol?
What would you recommend I use instead? My end goal is to just enable
TLS/SSL on the connectors.

--Ez


On Mon, May 24, 2021 at 1:56 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Ezsra,
>
> On 5/24/21 10:30, Ezsra McDonald wrote:
> > I am enabling SSL debugging this morning. I did catch this in the log for
> > an instance that started erroring out this morning. Seems like it may be
> > too generic to help solve my problem. Here it is:
> >
> > 24-May-2021 09:25:44.609 SEVERE [catalina-exec-51]
> > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
> > java.lang.NullPointerException
> > at org.bouncycastle.crypto.signers.PSSSigner.generateSignature(Unknown
> > Source)
> > at org.bouncycastle.jce.provider.JDKPSSSigner.engineSign(Unknown Source)
>
> Oh. You are using BouncyCastle. I've never tried to do that. I'm not
> sure how well BC will work with Tomcat. We don't officially support that
> configuration, but that doesn't mean we won't try to help.
>
> There will be a presentation at this year's ApacheCon @Home 2021 about
> configuring Tomcat for FIPS and it will include how to configure Tomcat
> with BC (including FIPS). Obviously, you don't want to wait around until
> the conference to get things working, but perhaps the presenter is
> lurking on the list ... ?
>
> I don't have an email address for the presenter, so I can't give you a
> reference. :/
>
> -chris
>
> -
> To unsubscribe, e-mail: 
> users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: 
> users-h...@tomcat.apache.org
>
>


Problrm with resources added using DirResourceSet

2015-05-20 Thread Ed Rouse
Server version: Apache Tomcat/8.0.14
Server built:   Sep 24 2014 09:01:51
Server number:  8.0.14.0
OS Name:Linux
OS Version: 3.8.0-29-generic
Architecture:   amd64
JVM Version:1.7.0_55-b14
JVM Vendor: Oracle Corporation

I have implemented a custom WebappClassLoaderBase and StandardRoot, and it 
looks like it is working; but the resources added are not available to the web 
app. What follows is a bit long and I apologize for that, but didn't want to 
leave out potentially important information. Any ideas on what's wrong?

This is the code snippet:

wsRoot = IDWMPluginRegistry.getInstance().getWebRoot();
log.info(IDWMClassLoader init:  + wsRoot.getContext().getName());
SetIDWMPlugin plugins = IDWMPluginRegistry.getInstance().getPlugins();
for(IDWMPlugin plugin: plugins)
{
  log.info(Loading plugin:  + plugin.getLoaderClassName());
  try
  {
if(wsRoot == null)
{
  log.info(wsRoot not set.);
  wsRoot = new StandardRoot();
}
if(wsRoot.getContext() == null)
{
  throw new Exception(NO CONTEXT!!!);
}
File pFile = plugin.getRoot();
log.info(Adding plugin root  + pFile.getAbsolutePath() +  to the 
WebResourceRoot as a DirResourceSet.);

DirResourceSet drs = new DirResourceSet(wsRoot, /, 
pFile.getAbsolutePath(), /);
log.info(DirResourceSet base URL =  + drs.getBaseUrl().toString());
wsRoot.addPostResources(drs);
  }
  catch(Exception e)
  {
log.log(Level.SEVERE, Error setting up class path, e);
  }
}

And here is the catalina.out log pertaining to this section of code.

17-May-2015 23:27:52.399 INFO [localhost-startStop-1] 
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web 
application directory /usr/local/apache-tomcat-8.0.14/webapps/ROOT
17-May-2015 23:27:53.243 INFO [localhost-startStop-1] 
org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for 
TLDs yet contained no TLDs. Enable debug logging for this logger for a complete 
list of JARs that were scanned but no TLDs were found in them. Skipping 
unneeded JARs during scanning can improve startup time and JSP compilation time.
17-May-2015 23:27:53.385 INFO [localhost-startStop-1] 
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web 
application directory /usr/local/apache-tomcat-8.0.14/webapps/ROOT has finished 
in 986 ms
17-May-2015 23:27:53.388 INFO [localhost-startStop-1] 
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web 
application directory /usr/local/apache-tomcat-8.0.14/webapps/idwm
17-May-2015 23:27:53.424 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMFileDirContext.init Default Constructor.
17-May-2015 23:27:53.425 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMFileDirContext.importPlugins System 
property idwm.plugins not set; using default plugin path /usr/us/idwm/plugins
17-May-2015 23:27:53.431 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMFileDirContext.importFromDirectory Found 
plugin at /usr/us/idwm/plugins/idw-plugins-role_change_attribute_audit
17-May-2015 23:27:54.146 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMClassLoader.init parent constructor.class 
java.net.URLClassLoader
17-May-2015 23:27:54.147 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMClassLoader.init IDWMClassLoader init: /idwm
17-May-2015 23:27:54.148 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMClassLoader.init Loading plugin: 
idwplugin.RoleChangeAttributeAudit.RoleChangeAttributeAuditPluginLoader
17-May-2015 23:27:54.148 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMClassLoader.init Adding plugin root 
/usr/us/idwm/plugins/idw-plugins-role_change_attribute_audit to the 
WebResourceRoot as a DirResourceSet.
17-May-2015 23:27:54.148 INFO [localhost-startStop-1] 
com.comsquared.idw.catalina.ext.IDWMClassLoader.init DirResourceSet base URL = 
file:/usr/us/idwm/plugins/idw-plugins-role_change_attribute_audit/
17-May-2015 23:28:05.198 INFO [localhost-startStop-1] 
com.comsquared.idwm.DataSourceFactory.getObjectInstance Get JNDI datasource 
ImageDirectorWorkflowDS from app config
log4j:WARN No such property [maxBackupIndex] in 
org.apache.log4j.DailyRollingFileAppender.
17-May-2015 23:28:15.367 INFO [localhost-startStop-1] 
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web 
application directory /usr/local/apache-tomcat-8.0.14/webapps/idwm has finished 
in 21,978 ms
17-May-2015 23:28:15.371 INFO [localhost-startStop-1] 
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web 
application directory /usr/local/apache-tomcat-8.0.14/webapps/docs
17-May-2015 23:28:15.425 INFO [localhost-startStop-1] 
org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for 
TLDs yet contained no TLDs. Enable debug logging for this 

RE: [Tomcat8] What happened to WebappLoader.addRepository()?

2015-03-17 Thread Ed Rouse


 -Original Message-
 From: Pilkington, Simon [mailto:simo...@amazon.com]
 Sent: Tuesday, March 17, 2015 12:45 PM
 To: users@tomcat.apache.org
 Subject: [Tomcat8] What happened to WebappLoader.addRepository()?
 
 Hey tomcat users,
 
 The javadoc for WebappLoader still tells me to use addRepository(), but
 that method no longer exists. My team has implemented an extension of
 WebappLoader that looked like this:
 
 http://cp.mcafee.com/d/1jWVIq3zqb2rzydPhOCYrKrhKCqenTzhOe7cCQrFCzBZUQsL
 9ICQrFCzBZUQszxP1J6WpEVvd7aabPxLURrFUalAv3UYKrlAv3UYKrKXHXRTT-LPz5TCnA-
 LsKyev7szsQsIFICzBzBHEShhlKYPOEuvkzaT0QSyrjdTdTdAVPmEBCjGHrpZGSS9_M079R
 lJIOUXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc2WrWr9EVjb
 _6HtfelAv3UYK2FRlJI-
 Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
 IiNEEd598S-UrI1Lf5-sL
 http://cp.mcafee.com/d/2DRPoAd3hJ5xdNN6VEVjudTdETjd7bXNEV73CjqdQPhO-
 YqenASjqdQPhO-
 YqehMVwSztcQsLCzB55VMTYqJQY5aOfxYundGOfxYundTtRZWXX_nVNyXPbOvnKnh7fzKhK
 qemkSjhONORQr8EGTupVkffGhBrwqrjdFCXCXCOsVHkiP9RlJI-
 Rrr4_U03AWGSSptXHBQaSPlFo01PlJIj_brfjVgT3WWxYs0nO6Hb1mKEv7wsrrFYq5U_dKc
 2WrWr9EVjb_6HtfelAv3UYK2FRlJI-
 Rrr4_U02rs7e3zpFr1dlrrdUQKCy01iuPd41flBLxW1EwDkQg0bV3lBwHnkfzSE80LRGQBe
 IiNEEd598S-UrHrI5
 
@Override
protected void startInternal() throws LifecycleException {
// validate the context, which is used for debugging messages
Context context;
{
Container container = getContainer();
if (container == null) {
throw new LifecycleException(Container is null?!);
}
if (!(container instanceof Context)) {
throw new LifecycleException(Container is not an
 instance of Context?!);
}
context = (Context) container;
}
 
if (ENVIRONMENT_ROOT != null  ENVIRONMENT_ROOT.length()  0) {
// validate targetPackage
if (null == targetPackage) {
throw new LifecycleException(
Missing required Loader attribute
 \targetPackage\ in Context configuration  +
context.getConfigFile());
}
 
try {
// Excluded jars are those already pulled in by tomcat.
SetString allExcludedJars = getAllExcludedJars();
SetString reallyExcludedJars = new HashSetString();
// add JARs from target package as repositories
// getPackageClasspath finds the list of jars I want to
 include for this webapp.
for (String jar : getPackageClasspath(targetPackage)) {
File file = new File(ENVIRONMENT_ROOT, jar);
// skip bad and unwanted JARs
if (allExcludedJars.contains(jar) || isBadJar(file))
 {
reallyExcludedJars.add(jar);
} else {
// TODO: HOW TO FIX ME??
addRepository(file.toURI().toString());
}
}
log.info(Context path \ + context.getPath() + \
 excluding JARs:  + reallyExcludedJars);
} catch (IOException e) {
throw new LifecycleException(
Problem setting classpath for context path \
 + context.getPath() + \,
e);
}
 
// getRepositoriesString() has been renamed to
 getLoaderRepositoriesString()...
log.info(Context path \ + context.getPath() + \ using
 classpath:  + getRepositoriesString());
} else {
log.warning(MyWebappLoader seems to be used outside of my
 environment. Delegating to parent.);
}
 
super.startInternal();
}
 
 Can the community help me figure out how to upgrade this for tomcat 8?

JarResourceSet jrs = new JarResourceSet(Context.getResources(), /, 
file.getAbsolutePath(), /);
Context.getResources().addPostResources(jrs);

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



RE: DirResourceSet

2014-11-18 Thread Ed Rouse


 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, November 18, 2014 5:59 AM
 To: Tomcat Users List
 Subject: Re: DirResourceSet
 
 On 17/11/2014 22:52, Ed Rouse wrote:
  I have 2 different issues setting up a DirResourceSet. I have an
  external war file I am trying to merge into the Root of my
  application. I have a custom root that extends StandardRoot.
 
 
  1.   DirResourceSet drs = new DirResourceSet(wsRoot,
  /WEB-INF/classes/, possible.getAbsolutePath() + /classes/, /);
 
  This only seems to give me the top level directory of the classes
  directory as indicated by drs.listWebAppPaths(/WEB-INF/classes/).
  Is there a way to get it to be recursive or is it just that the
  listWebAppPaths doesn't show it even though it actually does it?
 
 A DirResourceSet will include all resources recursively under the
 directory that is defined as the top of the resource set.
 
 I'm not sure if it really matters (I'd need to to back and review the
 code carefully) but I'd remove the trailing slashes from those
 directories. i.e. the above would be:
 
 DirResourceSet(wsRoot,
/WEB-INF/classes,
possible.getAbsolutePath() + /classes,
/);
 
  2.   The reason I can't check the first is because this one gives
  me an exception.
 
  DirResourceSet drs = new DirResourceSet(wsRoot, / +
  possible.getName(), possible.getAbsolutePath(), / +
  possible.getName());
 
 That doesn't look right. I'd expect the internalPath for a
 DirResourceSet to always be /. internalPath is really intended for
 JAR files where the resources you want to include might not be located
 at the root of the JAR.
 
 Something to consider is removing that parameter from the
 DirResourceSet constructor and other constructors where it is unlikely
 to be needed.
 
 Mark
 
 
  It looks like the one that seems to work but I
  get a:
 
  SEVERE [localhost-startStop-1] null.null Error setting up class path
 
  java.lang.IllegalStateException:
  org.apache.catalina.LifecycleException: Failed to initialize
 component
  [org.apache.catalina.webresources.DirResourceSet@6a38848c]
 
  at
 
 org.apache.catalina.webresources.DirResourceSet.init(DirResourceSet.
  java:83)
 
   I have tried to follow through the source but keep getting lost.
  Line 83 is when it calls Start on StandardRoot. Is it because it was
  already started by the first call? But then how would you add in
  multiple resources?
 
 
 
  I would like to step through it in debug mode, but the test server is
  remote and I don't know how to set up remote debugging. And it's
  remote due to other required resources that are not able to run
  locally.
 
 
 
  Thanks for the help.
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org

I finally figured it out. Everything I was doing was correct, but during all 
of the changes I was making I accidentally removed the root.addPostResources 
for that set. D'oh.

Sorry about that and thanks for all the help guys.


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



RE: Remote resources

2014-11-18 Thread Ed Rouse


 -Original Message-
 From: phi...@free.fr [mailto:phi...@free.fr]
 Sent: Tuesday, November 18, 2014 10:02 AM
 To: users@tomcat.apache.org
 Subject: Remote resources
 
 Hello,
 
 is there a way to access the contents of a directory (e.g., images) on
 a remote [Windows] network drive, which is mounted on a Linux
 filesystem (e.g., /mnt/myremotedrive), from a Java application running
 on a Tomcat Server?
 
 What makes this task problematic is the fact that the images are stored
 in a location which is not normally accessible by Tomcat
 (/mnt/myremotedrive), or by its applications.
 
 Many thanks.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org

There is, but it's not easy. You need to create a custom class loader 
that extends WebappClassLoaderBase, then create a DirResourceSet and 
add it to the root. The way I did it was with a custom context that I 
put into a singleton class so I could access it from the loader.
Then you just

DirResourceSet drs = new DirResourceSet(wsRoot, /images, 
  /mnt/myremotedrive/images, /);
wsRoot.addPostResources(drs);

Once this is working, you can access the images from /images as usual.

You have to set up a context.xml file in the META-INF directory of 
your app similar to this:

?xml version=1.0 encoding=UTF-8 ?
Context
Resources className=context package and class /
Loader loaderClass=classloader package and class delegate=false /
/Context


DirResourceSet

2014-11-17 Thread Ed Rouse
I have 2 different issues setting up a DirResourceSet. I have an external war 
file I am trying to merge into the Root of my application. I have a custom root 
that extends StandardRoot.


1.   DirResourceSet drs = new DirResourceSet(wsRoot, /WEB-INF/classes/, 
possible.getAbsolutePath() + /classes/, /);

This only seems to give me the top level directory of the classes directory as 
indicated by drs.listWebAppPaths(/WEB-INF/classes/). Is there a way to get it 
to be recursive or is it just that the listWebAppPaths doesn't show it even 
though it actually does it?

2.   The reason I can't check the first is because this one gives me an 
exception.

DirResourceSet drs = new DirResourceSet(wsRoot, / + possible.getName(), 
possible.getAbsolutePath(), / + possible.getName()); It looks like the one 
that seems to work but I get a:

SEVERE [localhost-startStop-1] null.null Error setting up class path

java.lang.IllegalStateException: org.apache.catalina.LifecycleException: Failed 
to initialize component 
[org.apache.catalina.webresources.DirResourceSet@6a38848c]

at 
org.apache.catalina.webresources.DirResourceSet.init(DirResourceSet.java:83)

I have tried to follow through the source but keep getting lost. Line 83 is 
when it calls Start on StandardRoot. Is it because it was already started by 
the first call? But then how would you add in multiple resources?



I would like to step through it in debug mode, but the test server is remote 
and I don't know how to set up remote debugging. And it's remote due to other 
required resources that are not able to run locally.



Thanks for the help.


RE: DirResourceSet

2014-11-17 Thread Ed Rouse


 -Original Message-
 From: Ed Rouse [mailto:ero...@milner.com]
 Sent: Monday, November 17, 2014 4:53 PM
 To: Tomcat Users List
 Subject: DirResourceSet
 
 I have 2 different issues setting up a DirResourceSet. I have an
 external war file I am trying to merge into the Root of my application.
 I have a custom root that extends StandardRoot.
 
 
 1.   DirResourceSet drs = new DirResourceSet(wsRoot, /WEB-
 INF/classes/, possible.getAbsolutePath() + /classes/, /);
 
 This only seems to give me the top level directory of the classes
 directory as indicated by drs.listWebAppPaths(/WEB-INF/classes/). Is
 there a way to get it to be recursive or is it just that the
 listWebAppPaths doesn't show it even though it actually does it?
 
 2.   The reason I can't check the first is because this one gives
 me an exception.
 
 DirResourceSet drs = new DirResourceSet(wsRoot, / +
 possible.getName(), possible.getAbsolutePath(), / +
 possible.getName()); It looks like the one that seems to work but I get
 a:
 
 SEVERE [localhost-startStop-1] null.null Error setting up class path
 
 java.lang.IllegalStateException:
 org.apache.catalina.LifecycleException: Failed to initialize component
 [org.apache.catalina.webresources.DirResourceSet@6a38848c]
 
 at
 org.apache.catalina.webresources.DirResourceSet.init(DirResourceSet.j
 ava:83)
 
 I have tried to follow through the source but keep getting lost. Line
 83 is when it calls Start on StandardRoot. Is it because it was already
 started by the first call? But then how would you add in multiple
 resources?
 
 
 
 I would like to step through it in debug mode, but the test server is
 remote and I don't know how to set up remote debugging. And it's remote
 due to other required resources that are not able to run locally.
 
 
 
 Thanks for the help.


I fixed #2. Turns out I needed to use / for the internal path. I don't 
suppose there is a how to on using these resource sets or a details on
what the internal structure is? I think the problem for me
is the base/internal path combination. Though my guess is that it won't
recurse through the structure by default so you add the files using the 
same base with differing internal paths?


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



RE: DirResourceSet

2014-11-17 Thread Ed Rouse
I still have some confusion about the DirResourceSet. When I add the 
/WEB-INF/classes it looks through recursively and finds all of the class files. 
I know because one of them adds an additional link to a menu bar and it's 
there. But when I add a regular directory, say /report, it only adds the first 
level under that. I know because when I click on the menu link I get an error 
saying that the task.jsp file is missing. It should be added under 
/report/data/duration/task.jsp. Are class files or files in WEB-INF handled 
differently than other files? It didn't seem so when I looked through the code, 
but I could be missing something.


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



custom classloader missing root

2014-11-11 Thread Ed Rouse
I am trying to convert a custom class loader from version 5.5 to version 
8.0.11, running under ubuntu.
I have the following line in my context.xml file.
Loader 
loaderClass=com.comsquared.idw.catalina.ext.IDWMClassLoader delegate=false 
/

I have tried the delegate as both true and false with no difference. I have 
found that the parent loader is java.net.URLClassLoader, not
org.apache.catalina.loader.WebappLoader or 
org.apache.catalina.loader.WebappClassLoaderBase as I expected. My class loader 
extends
org.apache.catalina.loader.WebappClassLoader. In order to add files, as far as 
I know I need an org.apache.catalina.WebResourceRoot
(probably StandardRoot) and an org.apache.catalina.Context (probably 
org.apache.catalina.core.StandardContext).

So how do I get, find or create these 2 classes? I think I can create a new 
StandardRoot if I have a Context, but what needs to be done to create
a proper context for a web application that is getting auto-loaded by the 
tomcat container at startup?

I am missing some information and have, as yet, not been able to find any 
details about how to accomplish this.

Thanks.


RE: custom classloader missing root

2014-11-11 Thread Ed Rouse


-Original Message-
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: Tuesday, November 11, 2014 11:49 AM
To: Tomcat Users List
Subject: Re: custom classloader missing root

On 11/11/2014 15:34, Ed Rouse wrote:
 I am trying to convert a custom class loader from version 5.5 to version 
 8.0.11, running under ubuntu.
 I have the following line in my context.xml file.
 Loader 
 loaderClass=com.comsquared.idw.catalina.ext.IDWMClassLoader 
 delegate=false /
 
 I have tried the delegate as both true and false with no difference. I 
 have found that the parent loader is java.net.URLClassLoader, not 
 org.apache.catalina.loader.WebappLoader or 
 org.apache.catalina.loader.WebappClassLoaderBase as I expected.

Your expectation is incorrect.

 My class loader extends org.apache.catalina.loader.WebappClassLoader. 
 In order to add files, as far as I know I need an 
 org.apache.catalina.WebResourceRoot
 (probably StandardRoot) and an org.apache.catalina.Context (probably 
 org.apache.catalina.core.StandardContext).

 So how do I get, find or create these 2 classes? 

You don't create them. You don't have access to the Context. Tomcat creates 
them and sets them on your class loader. You then access them with 
getResources() and getResources().getContext().

 I think I can create a new StandardRoot if I have a Context, but what 
 needs to be done to create a proper context for a web application that is 
 getting auto-loaded by the tomcat container at startup?

Tomcat does all of this for you.

 I am missing some information and have, as yet, not been able to find any 
 details about how to accomplish this.

The source code is usually a good place to start. If you can't figure out how 
stuff works from the source fire up a Tomcat instance, attach a debugger and 
step through the code.

Mark

I already tried getResources() but it returns null. hence my confusion. As far 
as I can tell, tomcat is not setting the root or context on my class loader.

As for looking through the source, I'm not even sure where to start. Is there a 
document somewhere that goes through the entire startup process of the tomcat 
container so I will at least have an idea of where the tomcat is supposed to be 
doing this?

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


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



RE: custom classloader missing root

2014-11-11 Thread Ed Rouse


 -Original Message-
 From: Mark Thomas [mailto:ma...@apache.org]
 Sent: Tuesday, November 11, 2014 12:14 PM
 To: Tomcat Users List
 Subject: Re: custom classloader missing root
 
 On 11/11/2014 17:01, Ed Rouse wrote:
 
 
  -Original Message- From: Mark Thomas
 [mailto:ma...@apache.org]
  Sent: Tuesday, November 11, 2014 11:49 AM
  To: Tomcat Users List Subject: Re: custom classloader missing root
 
  On 11/11/2014 15:34, Ed Rouse wrote:
  I am trying to convert a custom class loader from version 5.5 to
  version 8.0.11, running under ubuntu. I have the following line in
 my
  context.xml file. Loader
  loaderClass=com.comsquared.idw.catalina.ext.IDWMClassLoader
  delegate=false /
 
  I have tried the delegate as both true and false with no difference.
  I have found that the parent loader is java.net.URLClassLoader, not
  org.apache.catalina.loader.WebappLoader or
  org.apache.catalina.loader.WebappClassLoaderBase as I expected.
 
  Your expectation is incorrect.
 
  My class loader extends
  org.apache.catalina.loader.WebappClassLoader. In order to add files,
  as far as I know I need an org.apache.catalina.WebResourceRoot
  (probably StandardRoot) and an org.apache.catalina.Context (probably
  org.apache.catalina.core.StandardContext).
 
  So how do I get, find or create these 2 classes?
 
  You don't create them. You don't have access to the Context. Tomcat
  creates them and sets them on your class loader. You then access them
  with getResources() and getResources().getContext().
 
  I think I can create a new StandardRoot if I have a Context, but
 what
  needs to be done to create a proper context for a web application
  that is getting auto-loaded by the tomcat container at startup?
 
  Tomcat does all of this for you.
 
  I am missing some information and have, as yet, not been able to
 find
  any details about how to accomplish this.
 
  The source code is usually a good place to start. If you can't figure
  out how stuff works from the source fire up a Tomcat instance, attach
  a debugger and step through the code.
 
  Mark
 
  I already tried getResources() but it returns null. hence my
  confusion. As far as I can tell, tomcat is not setting the root or
  context on my class loader.
 
 That depends on when you call it.

Since it is the Loader in the context.xml file, I am not calling it, tomcat 
is. 
Is there another way to do this so I can call it manually from within the 
webapp?

 
 
  As for looking through the source, I'm not even sure where to start.
 
 How about the source for WebappClassLoader and look for where
 setResources() is called?
 
  Is there a document somewhere that goes through the entire startup
  process of the tomcat container so I will at least have an idea of
  where the tomcat is supposed to be doing this?
 
 Nothing current but it hasn't changed much since this was written:
 http://cp.mcafee.com/d/k-Kr6xASyMy-
 ejsK_sTsSztcQsLL6zAsepdETjd7bXNEVujpdETjd7bXNEV73C3qdQPhO-
 qekknD3vNGTjMkH8-7NVsSH8-7NVsSzXb2rz3_nV-
 UVB_HTbFILnUQsLfTd7fbnhIyyHt57BgY-
 F6lK1FJ4SyrKrKr01DRJFVeJ9UxmRcSdysF_qrsvOAZzdJrwsrrFYq5U_dKc2WrZTQTy_NG
 TjPBp7M-fbwGtlrrfJmSNf-
 00CS7DTzobZ8QgmrFeGFEwIvJa7RR3UCy1mlaiwhd44qRCrpvdBSUG
 
 Mark
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


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



tomcat 8 context.xml problems

2014-11-07 Thread Ed Rouse
Migrating to 8.0 and am having trouble with a custom Resource loader. Below is 
my context.xml file:

Context
Resources 
className=com.comsquared.idw.catalina.ext.MyCustomStandardRoot /
Loader 
loaderClass=com.comsquared.idw.catalina.ext.MyClassLoader delegate=true
useSystemClassLoaderAsParent=false /
Resource name=jdbc/ImageDirectorWorkflowDS 
type=javax.sql.DataSource factory=com.comsquared.idwm.DataSourceFactory /
/Context

I am not concerned about the datasource right now. But when I try to get the 
context

org.apache.catalina.Context ctx = this.getContext();

ctx is null. Do I need to add something to the context.xml file? The docs only 
mention this:

The standard implementation of Resources is 
org.apache.catalina.webresources.StandardRoot, and is configured by its parent 
Context element.

But no mention about how a custom implementation of Resources gets its Context. 
I would assume from its parent as well. But how do I get the parent context?

Thanks, Ed.