You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2003/03/17 20:16:13 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

costin      2003/03/17 11:16:13

  Modified:    catalina/src/share/org/apache/catalina ServerFactory.java
  Log:
  Default.
  
  I'm trying a different path that will reduce the breakage and make /admin
  work with embeded as well.
  Basically I'm creating the Service and Server, even for embeded ( where only
  engine is used ). That will make the model consistent - even if Server and Service
  are barely used.
  
  Revision  Changes    Path
  1.2       +8 -5      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ServerFactory.java
  
  Index: ServerFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ServerFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerFactory.java	18 Jul 2002 16:47:36 -0000	1.1
  +++ ServerFactory.java	17 Mar 2003 19:16:13 -0000	1.2
  @@ -64,6 +64,8 @@
   
   package org.apache.catalina;
   
  +import org.apache.catalina.core.StandardServer;
  +
   
   /**
    * <p><strong>ServerFactory</strong> allows the registration of the
  @@ -95,7 +97,8 @@
        * Return the singleton <code>Server</code> instance for this JVM.
        */
       public static Server getServer() {
  -
  +        if( server==null )
  +            server=new StandardServer();
           return (server);
   
       }
  
  
  

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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Mladen Turk <mt...@apache.org>.

> -----Original Message-----
> From: news [mailto:news@main.gmane.org] On Behalf Of Costin Manolache
> 
> Well - you need at least something in the classpath :-) That 
> something can create a class loader with all the other jars - 
> and call a method inside.
>

Why?
The java/lang/ClassLoader is all that I have.

> What you should call is Registry.loadMBeans() or ant or 
> something like that
> - which in turn will load an mbeans.xml file ( either ant 
> tasks or just extended mlet or even plain mlet ).
> 

No .xml & co., all the config is set by the JNI.

> The target is to allow it to start with only jmx.jar, 
> commons-modeler.jar, an xml parser - but I need to implement 
> a class loader in modeler ( so classpath can be declared in 
> mbeans.xml ). If you use ant as JMX controler
> - that should work fine - and you'll need ant.jar. jmx.jar, 
> commons-modeler.jar and a parser in your path.
> 

Remember I don't have nothing in the classpath.
I'm trying to start the TC simply with the following:

java SomeClass

MT.


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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Costin Manolache <cm...@yahoo.com>.
Mladen Turk wrote:

> 
> 
>> -----Original Message-----
>> From: news [mailto:news@main.gmane.org] On Behalf Of Costin Manolache
>> 
>> > What I ment was a catalina.bat or catalina.sh embedded calling
>> > o.a.c.s.Embedded
>> 
>> I think Embedded class should be deprecated in 5.0, and all
>> 'embedding' should be done via JMX.
>> 
>> I haven't tested Embedded recently ( but it was working about a
>> week ago ).
>> 
>> You can create your own main() ( or use the small startup
>> class in modeler ) and load an mbeans.xml file.
>> 
>> Controlling everything via JMX is much more flexible and
>> powerfull than using wrappers or helpers like Embedded.
>> 
> 
> Well what I want to do is TC distribution from JK2 point of view, where
> I will install the TC into the web server, and not adapt the web server
> to Tomcat.
> 
> Want I need is a single java class that will be loaded from bytes,
> launch the 'light' TC without it's own http server, set all the
> configuration from workers2.properties, ... Think you follow me.
> 
> The problem is that all that has to be able to start from _dirty_ JVM,
> meaning that the web server already has loaded JVM, with the different
> classpath from the one that I want.
> 
> Do you have some leads on that?

Well - you need at least something in the classpath :-) That something can
create a class loader with all the other jars - and call a method inside.

What you should call is Registry.loadMBeans() or ant or something like that
- which in turn will load an mbeans.xml file ( either ant tasks or just
extended mlet or even plain mlet ).

The target is to allow it to start with only jmx.jar, commons-modeler.jar,
an xml parser - but I need to implement a class loader in modeler ( so
classpath can be declared in mbeans.xml ). If you use ant as JMX controler
- that should work fine - and you'll need ant.jar. jmx.jar,
commons-modeler.jar and a parser in your path.

Costin   










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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Amy Roh <am...@apache.org>.
Costin Manolache wrote:
> Mladen Turk wrote:
> 
> 
>>What I ment was a catalina.bat or catalina.sh embedded
>>calling o.a.c.s.Embedded
> 
> 
> I think Embedded class should be deprecated in 5.0, and all
> 'embedding' should be done via JMX.

-1 for deprecating the current Embedded class.

I totally agree that JMX is very flexible and powerful way to go and I 
think it's great. :-)  However, for backward compatibility I don't think 
we should just deprecate it easily and force whoever was using tomcat 
Embedded class to change his/her implementation to use JMX.

Amy

> 
> I haven't tested Embedded recently ( but it was working about a 
> week ago ). 
> 
> You can create your own main() ( or use the small startup class in
> modeler ) and load an mbeans.xml file. 
> 
> Controlling everything via JMX is much more flexible and powerfull
> than using wrappers or helpers like Embedded.
> 
> Costin
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 




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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Mladen Turk <mt...@apache.org>.

> -----Original Message-----
> From: news [mailto:news@main.gmane.org] On Behalf Of Costin Manolache
> 
> > What I ment was a catalina.bat or catalina.sh embedded calling 
> > o.a.c.s.Embedded
> 
> I think Embedded class should be deprecated in 5.0, and all 
> 'embedding' should be done via JMX.
> 
> I haven't tested Embedded recently ( but it was working about a 
> week ago ). 
> 
> You can create your own main() ( or use the small startup 
> class in modeler ) and load an mbeans.xml file. 
> 
> Controlling everything via JMX is much more flexible and 
> powerfull than using wrappers or helpers like Embedded.
> 

Well what I want to do is TC distribution from JK2 point of view, where
I will install the TC into the web server, and not adapt the web server
to Tomcat.

Want I need is a single java class that will be loaded from bytes,
launch the 'light' TC without it's own http server, set all the
configuration from workers2.properties, ... Think you follow me.

The problem is that all that has to be able to start from _dirty_ JVM,
meaning that the web server already has loaded JVM, with the different
classpath from the one that I want.

Do you have some leads on that?

MT.


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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Costin Manolache <cm...@yahoo.com>.
Mladen Turk wrote:

> What I ment was a catalina.bat or catalina.sh embedded
> calling o.a.c.s.Embedded

I think Embedded class should be deprecated in 5.0, and all
'embedding' should be done via JMX.

I haven't tested Embedded recently ( but it was working about a 
week ago ). 

You can create your own main() ( or use the small startup class in
modeler ) and load an mbeans.xml file. 

Controlling everything via JMX is much more flexible and powerfull
than using wrappers or helpers like Embedded.

Costin


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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Mladen Turk <mt...@apache.org>.

> -----Original Message-----
> From: news [mailto:news@main.gmane.org] On Behalf Of Costin Manolache
> 
> If you execute the "emebed" target in tomcat5, you'll get an 
> embed/ dir, and inside you'll have a lib/ with an ( almost ) 
> minimal set of jars - you can rejar them in a single jar if 
> you really want.
> 

What I ment was a catalina.bat or catalina.sh embedded
calling o.a.c.s.Embedded

> The tomcat-ant.xml file is a sample on how to embed tomcat - 
> all you have to do is to make the same JMX calls in your 
> favorite application ( where you embed tomcat ).
> 
> In other words - you'll need to create 
> o.a.commons.modeler.BaseModelMBean
> components, with a String constructor ( the name of the 
> tomcat class ). Then set all the attributes you want, and 
> call init()/start().
> 
> Get it first working with ant, it's easier.
> 

I'll try.

> It works for me :-)
> 
Cool ;-)

MT.


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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Costin Manolache <cm...@yahoo.com>.
Mladen Turk wrote:

>> -----Original Message-----
>> From: costin@apache.org [mailto:costin@apache.org]
>>   
>>   I'm trying a different path that will reduce the breakage
>> and make /admin
>>   work with embeded as well.
>>   Basically I'm creating the Service and Server, even for
>> embeded ( where only
>>   engine is used ). That will make the model consistent -
>> even if Server and Service
>>   are barely used.
>>   
> 
> Is the embedded working in 5.0?
> I've kill myself trying to make that operable, and the only one I've
> succeeded is the 4.0.6, but only when I put the entire distribution in a
> single jar or unpack all the classes, or make a 4k classpath.

> By the way, can we make a build for 5.0 that will be like sun's j2ee?

What do you mean ? A single jar ? I don't think that's a good idea :-)
( but it should work, as well as a flat jar directory - that's what 
embed uses )

If you execute the "emebed" target in tomcat5, you'll get an embed/
dir, and inside you'll have a lib/ with an ( almost ) minimal set
of jars - you can rejar them in a single jar if you really want.

The tomcat-ant.xml file is a sample on how to embed tomcat - all you
have to do is to make the same JMX calls in your favorite application
( where you embed tomcat ).

In other words - you'll need to create o.a.commons.modeler.BaseModelMBean
components, with a String constructor ( the name of the tomcat class ). Then
set all the attributes you want, and call init()/start().

Get it first working with ant, it's easier.

It works for me :-)

Costin


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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Costin Manolache <cm...@yahoo.com>.
Mladen Turk wrote:

> 
> 
>> -----Original Message-----
>> From: Remy Maucherat [mailto:remm@apache.org]
>> 
>> Just wanted to let you know that the new embedded in 5.0 is great.
>> Costin (and I, to some extent) got it running with JBoss 3.2
>> without any
>> problem. The big advantage is that it's just like Tomcat standalone,
>> except it also implements the Embedded API. The big trick however is
>> that if the embbedding component uses JMX already, you can do
>> everything
>> using MBeans. It's really cool :)
>> 
> 
> Well that's great, can you send some cookbook?
> 
> I'd like to make a class for JK2 that will call the embedded TC from
> _dirty_ JVM, something like LouncherBootstrap.
> The class will be in that case be injected in JVM from class file itself
> using DefineClass.

Sounds complicated :-) What is a 'dirty' JVM ? And what's the use case ?

For JK2, the code is already organized as almost independent MBeans - 
and in time we should increase this - ChannelSocket and many other
pieces should be made completely reusable ( for example it would be nice
to use it for HTTP as well ). 

JkMain was the "model" for the modeler Main - and I'll try to write a 
modeler source that supports a simple .properties ( jk2.properties is a sort
of mbeans.xml - and JkMain loades sort-of mbeans )

Costin


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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Costin Manolache <cm...@yahoo.com>.
You may notice that the JNDI stuff is not yet finished, and I haven't tested
the authentication ( JAAS realm works fine with our LoginModule, but it may
still have some non-standard behaviors it relies on ). Well - I wrote the 
code that would support the more sane pattern used by jboss for Principals
( the Group named "roles" ), but it needs to be tested.

Costin

Remy Maucherat wrote:

> Mladen Turk wrote:
>> 
>>>-----Original Message-----
>>>From: Remy Maucherat [mailto:remm@apache.org]
>>>
>>>Just wanted to let you know that the new embedded in 5.0 is great.
>>>Costin (and I, to some extent) got it running with JBoss 3.2
>>>without any
>>>problem. The big advantage is that it's just like Tomcat standalone,
>>>except it also implements the Embedded API. The big trick however is
>>>that if the embbedding component uses JMX already, you can do
>>>everything
>>>using MBeans. It's really cool :)
>>>
>> 
>> 
>> Well that's great, can you send some cookbook?
>> 
>> I'd like to make a class for JK2 that will call the embedded TC from
>> _dirty_ JVM, something like LouncherBootstrap.
>> The class will be in that case be injected in JVM from class file itself
>> using DefineClass.
>> 
> 
> Here's the JBoss integration class. This should give you an idea.
> Note that the class can be compiled independently of TC 5. Zero coupling
> :)
> 
> Costin is awesome :-D
> Well, except when he's doing build related stuff, of course ;-)
> 
> Remy



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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Remy Maucherat <re...@apache.org>.
Mladen Turk wrote:
> 
>>-----Original Message-----
>>From: Remy Maucherat [mailto:remm@apache.org] 
>>
>>Just wanted to let you know that the new embedded in 5.0 is great. 
>>Costin (and I, to some extent) got it running with JBoss 3.2 
>>without any 
>>problem. The big advantage is that it's just like Tomcat standalone, 
>>except it also implements the Embedded API. The big trick however is 
>>that if the embbedding component uses JMX already, you can do 
>>everything 
>>using MBeans. It's really cool :)
>>
> 
> 
> Well that's great, can you send some cookbook?
> 
> I'd like to make a class for JK2 that will call the embedded TC from
> _dirty_ JVM, something like LouncherBootstrap.
> The class will be in that case be injected in JVM from class file itself
> using DefineClass.
> 

Here's the JBoss integration class. This should give you an idea.
Note that the class can be compiled independently of TC 5. Zero coupling :)

Costin is awesome :-D
Well, except when he's doing build related stuff, of course ;-)

Remy

RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Mladen Turk <mt...@apache.org>.

> -----Original Message-----
> From: Remy Maucherat [mailto:remm@apache.org] 
> 
> Just wanted to let you know that the new embedded in 5.0 is great. 
> Costin (and I, to some extent) got it running with JBoss 3.2 
> without any 
> problem. The big advantage is that it's just like Tomcat standalone, 
> except it also implements the Embedded API. The big trick however is 
> that if the embbedding component uses JMX already, you can do 
> everything 
> using MBeans. It's really cool :)
> 

Well that's great, can you send some cookbook?

I'd like to make a class for JK2 that will call the embedded TC from
_dirty_ JVM, something like LouncherBootstrap.
The class will be in that case be injected in JVM from class file itself
using DefineClass.


MT.



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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Remy Maucherat <re...@apache.org>.
Mladen Turk wrote:
>>  I'm trying a different path that will reduce the breakage 
>>and make /admin
>>  work with embeded as well.
>>  Basically I'm creating the Service and Server, even for 
>>embeded ( where only
>>  engine is used ). That will make the model consistent - 
>>even if Server and Service
>>  are barely used.
>>  
> 
> 
> Is the embedded working in 5.0?
> I've kill myself trying to make that operable, and the only one I've
> succeeded is the 4.0.6, but only when I put the entire distribution in a
> single jar or unpack all the classes, or make a 4k classpath.
> 
> By the way, can we make a build for 5.0 that will be like sun's j2ee?

Just wanted to let you know that the new embedded in 5.0 is great. 
Costin (and I, to some extent) got it running with JBoss 3.2 without any 
problem. The big advantage is that it's just like Tomcat standalone, 
except it also implements the Embedded API. The big trick however is 
that if the embbedding component uses JMX already, you can do everything 
using MBeans. It's really cool :)

Remy


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


RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina ServerFactory.java

Posted by Mladen Turk <mt...@apache.org>.

> -----Original Message-----
> From: costin@apache.org [mailto:costin@apache.org] 
>   
>   I'm trying a different path that will reduce the breakage 
> and make /admin
>   work with embeded as well.
>   Basically I'm creating the Service and Server, even for 
> embeded ( where only
>   engine is used ). That will make the model consistent - 
> even if Server and Service
>   are barely used.
>   

Is the embedded working in 5.0?
I've kill myself trying to make that operable, and the only one I've
succeeded is the 4.0.6, but only when I put the entire distribution in a
single jar or unpack all the classes, or make a 4k classpath.

By the way, can we make a build for 5.0 that will be like sun's j2ee?

MT.


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