You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Nick Betteridge <n....@syntactics.com> on 2001/09/04 19:27:10 UTC
Security Manager, Embedded and Class Loading
I've a problem that I don't really understand.
I'm in the process of getting the security manager to work with an
Embedded setup and the bootstrap is virtually the same as Catalina's.
If I create, for example, a (Standard)Server and (Standard)Service, I
get objects generated. If I attempt to create an engine, the classloader
(catalinaLoader) finds the (Standard)Engine class, but is unable to
create a newInstance.
ie ...
/**
* Create a new server instance.
*/
public void serverCreate() {
try {
Class serverClass =
catalinaClassLoader.loadClass("org.apache.catalina.core.StandardServer");
Object server = serverClass.newInstance();
} catch (Exception ex) {
}
}
... will create a : org.apache.catalina.core.StandardServer@5d56d5
but a
public void engineCreate() {
try {
Class engineClass =
catalinaClassLoader.loadClass("org.apache.catalina.core.StandardEngine");
Object engine = engineClass.newInstance();
} catch (Exception ex) {
}
}
will give a : StandardEngine[null]
..... note that the full package name is missing and that engineClass is
found.
If anybody can shed any light on this, I'd be very grateful for comment
nick
Re: Security Manager, Embedded and Class Loading
Posted by "Craig R. McClanahan" <cr...@apache.org>.
This is actually pretty easy to understand.
When you do something like
StandardEngine engine = ...;
System.out.println("My engine is " + engine);
Java automatically calls engine.toString() for you. Most (but not quite
all, obviously) of the core Catalina components override toString() to
print out something reasonable. If you get
StandardEngine[null]
that just means you have not called engine.getName() yet -- afterwards, it
will print whatever name you've assigned it inside the square brackets.
Craig
On Tue, 4 Sep 2001, Nick Betteridge wrote:
> Date: Tue, 04 Sep 2001 18:27:10 +0100
> From: Nick Betteridge <n....@syntactics.com>
> Reply-To: tomcat-dev@jakarta.apache.org
> To: tomcat-dev@jakarta.apache.org
> Subject: Security Manager, Embedded and Class Loading
>
> I've a problem that I don't really understand.
>
> I'm in the process of getting the security manager to work with an
> Embedded setup and the bootstrap is virtually the same as Catalina's.
>
> If I create, for example, a (Standard)Server and (Standard)Service, I
> get objects generated. If I attempt to create an engine, the classloader
> (catalinaLoader) finds the (Standard)Engine class, but is unable to
> create a newInstance.
>
> ie ...
>
>
>
> /**
> * Create a new server instance.
> */
> public void serverCreate() {
> try {
> Class serverClass =
> catalinaClassLoader.loadClass("org.apache.catalina.core.StandardServer");
> Object server = serverClass.newInstance();
> } catch (Exception ex) {
> }
> }
>
> ... will create a : org.apache.catalina.core.StandardServer@5d56d5
>
>
> but a
>
>
>
> public void engineCreate() {
> try {
> Class engineClass =
> catalinaClassLoader.loadClass("org.apache.catalina.core.StandardEngine");
> Object engine = engineClass.newInstance();
> } catch (Exception ex) {
> }
> }
>
>
> will give a : StandardEngine[null]
>
>
> ..... note that the full package name is missing and that engineClass is
> found.
>
>
> If anybody can shed any light on this, I'd be very grateful for comment
>
> nick
>