I need a Servlet to be started when the web container is starting

2008-10-13 Thread Juan David

Hi All 

I have a problem to set up a framework application on Geronimo. I need a
Servlet to be started when the web container is starting.

As I previously did this configuration on Tomcat y try to add the Servlet
definition on installDir\var\catalina\conf\web.xml and it loads the Servlet
the problem is that the servlet has dependency classes and does not found
them on runtime. I try to add the jar containing the classes to
installDir\var\shared\lib and did not work.

What is the right way to accomplish this?

Is there a default application like in OAS or Tomcat?
Do I have to add my own module to Geronimo (If so can you give me some
directions?)
The stack trace says that the class can not be found on Tomcat6/2.0.1/car do
I have to add the dependence on that module for the dependent jars? (how can
I do that?)

Module 14/37 org.apache.geronimo.configs/tomcat6/2.0.1/car  
13:59:43,750 ERROR [Digester] End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

….
Caused by: 
java.lang.RuntimeException:
suramericana.swb.environment.InitContainerProperties in classloader
org.apache.geronimo.configs/tomcat6/2.0.1/car
at
org.apache.geronimo.tomcat.GeronimoStandardContext.addChild(GeronimoStandardContext.java:267)
... 71 more
Caused by: 
java.lang.ClassNotFoundException:
suramericana.swb.environment.InitContainerProperties in classloader
org.apache.geronimo.configs/tomcat6/2.0.1/car

Thanks in advance 

JuanDa

-- 
View this message in context: 
http://www.nabble.com/I-need-a-Servlet-to-be-started-when-the-web-container-is-starting-tp19958545s134p19958545.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: I need a Servlet to be started when the web container is starting

2008-10-13 Thread David Jencks


On Oct 13, 2008, at 9:50 AM, Juan David wrote:



Hi All

I have a problem to set up a framework application on Geronimo. I  
need a

Servlet to be started when the web container is starting.

As I previously did this configuration on Tomcat y try to add the  
Servlet
definition on installDir\var\catalina\conf\web.xml and it loads the  
Servlet
the problem is that the servlet has dependency classes and does not  
found

them on runtime. I try to add the jar containing the classes to
installDir\var\shared\lib and did not work.

What is the right way to accomplish this?

Is there a default application like in OAS or Tomcat?
Do I have to add my own module to Geronimo (If so can you give me some
directions?)
The stack trace says that the class can not be found on  
Tomcat6/2.0.1/car do
I have to add the dependence on that module for the dependent jars?  
(how can

I do that?)

Module 14/37 org.apache.geronimo.configs/tomcat6/2.0.1/car
13:59:43,750 ERROR [Digester] End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

….
Caused by:
java.lang.RuntimeException:
suramericana.swb.environment.InitContainerProperties in classloader
org.apache.geronimo.configs/tomcat6/2.0.1/car
at
org 
.apache 
.geronimo 
.tomcat 
.GeronimoStandardContext.addChild(GeronimoStandardContext.java:267)

... 71 more
Caused by:
java.lang.ClassNotFoundException:
suramericana.swb.environment.InitContainerProperties in classloader
org.apache.geronimo.configs/tomcat6/2.0.1/car


What exactly are you trying to accomplish with this servlet?  There  
may be a better way to do this in geronimo.


I can't keep track of how tomcat starts.  There might be a default  
application with a configuration under var/tomcat.


If this default application actually exists and you decide adding your  
servlet to it is the best way to proceed then the most controllable  
way to proceed is to build a replacement tomcat plugin that includes  
your jar as an additional dependency.  You should upgrade to g. 2.1.3  
and copy the source plugins/tomcat/tomcat6 module, alter the  
artifactId, include your jar as a maven dependency, and add an  
artifact-alias so your tomcat assembly will replace the normal one.


If you need some code to execute before your actual apps start you  
could write a gbean to execute the code and deploy it in a plugin that  
depends on the tomcat plugin.  If your apps depend on this service  
plugin it is sure to get started before the apps.


If you need this code to execute before any connectors start you might  
be able to include it in one of the apps and use the techniques shown  
in the app-per-port sample to start the connectors after your app.


thanks
david jencks




Thanks in advance

JuanDa

--
View this message in context: 
http://www.nabble.com/I-need-a-Servlet-to-be-started-when-the-web-container-is-starting-tp19958545s134p19958545.html
Sent from the Apache Geronimo - Users mailing list archive at  
Nabble.com.






Re: I need a Servlet to be started when the web container is starting

2008-10-13 Thread Lin Sun
Hi, Did you try write a simple geronimo-web.xml and deploy it along
with your war file when you use sharedlib?

Here's some information on geronimo-web.xml (geronimo specific web
deployment plan) -
http://cwiki.apache.org/GMOxDOC21/geronimo-webxml.html

You can also try use the plan creator portlet
(http://cwiki.apache.org/GMOxDOC21/plan-creator.html) to do that.

In the geronimo-web.xml, you can specify the sharedlib as the
depedency (I sent you the sample in the other reply).

To deploy the war file at GERONIMO_HOME/bin dir, issue ./deploy.sh
deploy file.war geronimo-web.xml

HTH Lin



On Mon, Oct 13, 2008 at 12:50 PM, Juan David [EMAIL PROTECTED] wrote:

 Hi All

 I have a problem to set up a framework application on Geronimo. I need a
 Servlet to be started when the web container is starting.

 As I previously did this configuration on Tomcat y try to add the Servlet
 definition on installDir\var\catalina\conf\web.xml and it loads the Servlet
 the problem is that the servlet has dependency classes and does not found
 them on runtime. I try to add the jar containing the classes to
 installDir\var\shared\lib and did not work.


Re: I need a Servlet to be started when the web container is starting

2008-10-13 Thread Juan David

Hi David

I think what I need is descrived for you “If you need some code to execute
before your actual apps start you could write a gbean to execute the code
and deploy it in a plugin that depends on the tomcat plugin.  If your apps
depend on this service plugin it is sure to get started before the apps.” I
would just get the code out of the servlet and put on a gbean , what I would
need is a example of the gbean implementation and deployment if there is one
available.

Thank you very much


djencks wrote:
 
 
 On Oct 13, 2008, at 9:50 AM, Juan David wrote:
 

 Hi All

 I have a problem to set up a framework application on Geronimo. I  
 need a
 Servlet to be started when the web container is starting.

 As I previously did this configuration on Tomcat y try to add the  
 Servlet
 definition on installDir\var\catalina\conf\web.xml and it loads the  
 Servlet
 the problem is that the servlet has dependency classes and does not  
 found
 them on runtime. I try to add the jar containing the classes to
 installDir\var\shared\lib and did not work.

 What is the right way to accomplish this?

 Is there a default application like in OAS or Tomcat?
 Do I have to add my own module to Geronimo (If so can you give me some
 directions?)
 The stack trace says that the class can not be found on  
 Tomcat6/2.0.1/car do
 I have to add the dependence on that module for the dependent jars?  
 (how can
 I do that?)

 Module 14/37 org.apache.geronimo.configs/tomcat6/2.0.1/car
 13:59:43,750 ERROR [Digester] End event threw exception
 java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 ….
 Caused by:
 java.lang.RuntimeException:
 suramericana.swb.environment.InitContainerProperties in classloader
 org.apache.geronimo.configs/tomcat6/2.0.1/car
  at
 org 
 .apache 
 .geronimo 
 .tomcat 
 .GeronimoStandardContext.addChild(GeronimoStandardContext.java:267)
  ... 71 more
 Caused by:
 java.lang.ClassNotFoundException:
 suramericana.swb.environment.InitContainerProperties in classloader
 org.apache.geronimo.configs/tomcat6/2.0.1/car
 
 What exactly are you trying to accomplish with this servlet?  There  
 may be a better way to do this in geronimo.
 
 I can't keep track of how tomcat starts.  There might be a default  
 application with a configuration under var/tomcat.
 
 If this default application actually exists and you decide adding your  
 servlet to it is the best way to proceed then the most controllable  
 way to proceed is to build a replacement tomcat plugin that includes  
 your jar as an additional dependency.  You should upgrade to g. 2.1.3  
 and copy the source plugins/tomcat/tomcat6 module, alter the  
 artifactId, include your jar as a maven dependency, and add an  
 artifact-alias so your tomcat assembly will replace the normal one.
 
 If you need some code to execute before your actual apps start you  
 could write a gbean to execute the code and deploy it in a plugin that  
 depends on the tomcat plugin.  If your apps depend on this service  
 plugin it is sure to get started before the apps.
 
 If you need this code to execute before any connectors start you might  
 be able to include it in one of the apps and use the techniques shown  
 in the app-per-port sample to start the connectors after your app.
 
 thanks
 david jencks
 


 Thanks in advance

 JuanDa

 -- 
 View this message in context:
 http://www.nabble.com/I-need-a-Servlet-to-be-started-when-the-web-container-is-starting-tp19958545s134p19958545.html
 Sent from the Apache Geronimo - Users mailing list archive at  
 Nabble.com.

 
 
 

-- 
View this message in context: 
http://www.nabble.com/I-need-a-Servlet-to-be-started-when-the-web-container-is-starting-tp19958545s134p19959908.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.



Re: I need a Servlet to be started when the web container is starting

2008-10-13 Thread David Jencks


On Oct 13, 2008, at 11:11 AM, Juan David wrote:



Hi David

I think what I need is descrived for you “If you need some code to  
execute
before your actual apps start you could write a gbean to execute the  
code
and deploy it in a plugin that depends on the tomcat plugin.  If  
your apps
depend on this service plugin it is sure to get started before the  
apps.” I
would just get the code out of the servlet and put on a gbean , what  
I would
need is a example of the gbean implementation and deployment if  
there is one

available.


A simple example of a gbean is (in the geronimo 2.1 branch) at plugins/ 
clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/config/ 
BasicClusterInfo.java

You can view it at 
https://svn.apache.org/repos/asf/geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/config/BasicClusterInfo.java

This one uses constructor dependency injection.  The important points  
to note are:

- you can use constructor or setter dependency injection
- dependencies can be simple objects (strings, numbers, or something  
you provide a PropertyEditor for) via attributes or other gbeans via  
references
- references can be single valued in which case they are required or  
collection-valued in which case they are optional and gbeans that  
satisfy the criteria are added as they start.
- you have to provide meatadata for the gbean as GBeanInfo, as shown  
at the end of the class
- there are a few special attributes such as the plugin classloader  
and the geronimo kernel
- if you need to do something on shutdown your gbean can implement the  
GBeanLifecycle interface.


The plan using this gbean is

https://svn.apache.org/repos/asf/geronimo/server/branches/2.1/plugins/clustering/farming/src/main/plan/plan.xml

This particular gbean has this configuration:
gbean name=ClusterInfo  
class=org.apache.geronimo.farm.config.BasicClusterInfo

attribute name=name${PlanClusterName}/attribute
reference name=NodeInfos/reference
/gbean

This particular attribute is overridden in a config.xml fragment and  
eventually the value comes from a property in var/config/config- 
substitutions.properties however you probably wont need such  
customization features for your first gbean.
The reference is blank which means that any gbean implementing the  
NodeInfo interface specified in the GBeanInfo for BasicClusterInfo  
will be added to the NodeInfos collection.


hope this helps, please ask questions as needed
david jencks






Thank you very much


djencks wrote:



On Oct 13, 2008, at 9:50 AM, Juan David wrote:



Hi All

I have a problem to set up a framework application on Geronimo. I
need a
Servlet to be started when the web container is starting.

As I previously did this configuration on Tomcat y try to add the
Servlet
definition on installDir\var\catalina\conf\web.xml and it loads the
Servlet
the problem is that the servlet has dependency classes and does not
found
them on runtime. I try to add the jar containing the classes to
installDir\var\shared\lib and did not work.

What is the right way to accomplish this?

Is there a default application like in OAS or Tomcat?
Do I have to add my own module to Geronimo (If so can you give me  
some

directions?)
The stack trace says that the class can not be found on
Tomcat6/2.0.1/car do
I have to add the dependence on that module for the dependent jars?
(how can
I do that?)

Module 14/37 org.apache.geronimo.configs/tomcat6/2.0.1/car
13:59:43,750 ERROR [Digester] End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

….
Caused by:
java.lang.RuntimeException:
suramericana.swb.environment.InitContainerProperties in classloader
org.apache.geronimo.configs/tomcat6/2.0.1/car
at
org
.apache
.geronimo
.tomcat
.GeronimoStandardContext.addChild(GeronimoStandardContext.java:267)
... 71 more
Caused by:
java.lang.ClassNotFoundException:
suramericana.swb.environment.InitContainerProperties in classloader
org.apache.geronimo.configs/tomcat6/2.0.1/car


What exactly are you trying to accomplish with this servlet?  There
may be a better way to do this in geronimo.

I can't keep track of how tomcat starts.  There might be a default
application with a configuration under var/tomcat.

If this default application actually exists and you decide adding  
your

servlet to it is the best way to proceed then the most controllable
way to proceed is to build a replacement tomcat plugin that includes
your jar as an additional dependency.  You should upgrade to g. 2.1.3
and copy the source plugins/tomcat/tomcat6 module, alter the
artifactId, include your jar as a maven dependency, and add an
artifact-alias so your tomcat assembly will replace the normal one.

If you need some code to execute before your actual apps start you
could write a gbean to execute the code and deploy it in a plugin  
that

depends on