You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steffen Heil <li...@steffen-heil.de> on 2008/04/15 22:35:44 UTC

tomcat embedded

Hi

I am searching for some documentation about tomcat embedded.
I am trying to convert a very simple setup (configuration below) to java
code, not using any xml file.

Any link, hint, etc. would be helpful.
Could someone give me a hint?

Regards,
  Steffen


=== server.xml ==========================================================

<Server port="8005" shutdown="SHUTDOWN">
  <Service name="applicationService">
    <Executor name="applicationExecutor" namePrefix="application-exec-"
maxThreads="150" minSpareThreads="4" />
    <Connector executor="applicationExecutor" port="80" protocol="HTTP/1.1"
connectionTimeout="20000" />
    <Connector executor="applicationExecutor" port="443" protocol="HTTP/1.1"
               SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
               keystoreFile="file.p12" keystorePass="password"
keystoreType="PKCS12" URIEncoding="UTF-8" />
    <Engine name="applicationEngine" defaultHost="applicationHost">
      <Host name="applicationHost" appBase="webapps" unpackWARs="false"
autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
        <Context path="" reloadable="false" docBase="/opt/application" />
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="access-" suffix=".txt" pattern="combined"
resolveHosts="false" fileDateFormat="yyyy-MM-dd"/>
      </Host>
    </Engine>
  </Service>
</Server>


=== context.xml =========================================================

<Context>
</Context>


=== web.xml =============================================================

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5">
    <servlet>
        <servlet-name>default</servlet-name>
 
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <mime-mapping>
        <extension>ext</extension>
        <mime-type>x-application/ext</mime-type>
    </mime-mapping>
</web-app>

RE: tomcat embedded

Posted by Steffen Heil <li...@steffen-heil.de>.
Hi

> > Sorry to ask again, but this is a common feature that I 
> > cannot find any
> > documentation for...
> 
> I think the answer is google like hell, that what we ended up 
> doing a long while ago...
> Its not that no one uses it, its everywhere... like inside 
> every application server out there. But its complex.

I think that's true, but it absolutely lacks documentations or even small
examples!


> Its not that easy getting from TC's xml config to what a full 
> TC needs because the xml is actually a class "waiting to be made".
> So embedded TC is not in the same league as the full TC...  
> no easy swap out.
>
> Its very likely that you'll start with embedded, and end up 
> backing out to the full version, so a good place to start 
>is actually with the full versions source.
> TC 6's are easier to understand than TC 5's

What do you mean by backing out to the full version?

I am using tomcat since 4.x (several years) as full version, but most
installations are one host, one app only.
Since this application requires tomcat and is seldomly used with anything
else, I think it would make perfect sense to include tomcat embedded into
that app.
One big reason is the ease of upgrades...


Do you have a minimal working example to start with?

Regards,
  Steffen

Re: tomcat embedded

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
Making the Java dream come true.
---------------------------------------------------------------------------
----- Original Message ----- 
From: "Steffen Heil" <li...@steffen-heil.de>
To: "'Tomcat Users List'" <us...@tomcat.apache.org>
Sent: Friday, April 18, 2008 8:31 PM
Subject: RE: tomcat embedded


> Hi
>
> Sorry to ask again, but this is a common feature that I cannot find any
> documentation for...

I think the answer is google like hell, that what we ended up doing a long 
while ago...
Its not that no one uses it, its everywhere... like inside every application 
server out there.
But its complex.

The emebedded TC sits under a "normal TC's" configuration layer, a thing 
called digester, which does a hell of a lot more than just read a little 
XML.
So if you embedding a simple thing, you'll find there are simple functions 
you call for setting up host, and ports and loading webapps, quite an 
elaborate model in itself, but when/if you decide to do JNDI or something 
not so simple, the embedded documentation out there lacks detail, and it 
gets complex.

Its not that easy getting from TC's xml config to what a full TC needs 
because the xml is actually a class "waiting to be made".
So embedded TC is not in the same league as the full TC...  no easy swap 
out.

Its very likely that you'll start with embedded, and end up backing out to 
the full version, so a good place to start is actually with the full 
versions source.
TC 6's are easier to understand than TC 5's

Have fun ;)


> Is there really no documentation for tomcat embedded nor anyone who uses 
> it?
>
> Regards,
>  Steffen
>
>
>> -----Original Message-----
>> From: Steffen Heil [mailto:lists@steffen-heil.de]
>> Sent: Tuesday, April 15, 2008 10:36 PM
>> To: 'Tomcat Users List'
>> Subject: tomcat embedded
>>
>> Hi
>>
>> I am searching for some documentation about tomcat embedded.
>> I am trying to convert a very simple setup (configuration
>> below) to java code, not using any xml file.
>>
>> Any link, hint, etc. would be helpful.
>> Could someone give me a hint?
>>
>> Regards,
>>   Steffen
>>
>>
>> === server.xml
>> ==========================================================
>>
>> <Server port="8005" shutdown="SHUTDOWN">
>>   <Service name="applicationService">
>>     <Executor name="applicationExecutor"
>> namePrefix="application-exec-"
>> maxThreads="150" minSpareThreads="4" />
>>     <Connector executor="applicationExecutor" port="80"
>> protocol="HTTP/1.1"
>> connectionTimeout="20000" />
>>     <Connector executor="applicationExecutor" port="443"
>> protocol="HTTP/1.1"
>>                SSLEnabled="true" scheme="https" secure="true"
>> clientAuth="false" sslProtocol="TLS"
>>                keystoreFile="file.p12" keystorePass="password"
>> keystoreType="PKCS12" URIEncoding="UTF-8" />
>>     <Engine name="applicationEngine" defaultHost="applicationHost">
>>       <Host name="applicationHost" appBase="webapps"
>> unpackWARs="false"
>> autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
>>         <Context path="" reloadable="false"
>> docBase="/opt/application" />
>>         <Valve className="org.apache.catalina.valves.AccessLogValve"
>> directory="logs"
>>                prefix="access-" suffix=".txt" pattern="combined"
>> resolveHosts="false" fileDateFormat="yyyy-MM-dd"/>
>>       </Host>
>>     </Engine>
>>   </Service>
>> </Server>
>>
>>
>> === context.xml
>> =========================================================
>>
>> <Context>
>> </Context>
>>
>>
>> === web.xml
>> =============================================================
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?> <web-app
>> xmlns="http://java.sun.com/xml/ns/javaee"
>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>>     version="2.5">
>>     <servlet>
>>         <servlet-name>default</servlet-name>
>>
>> <servlet-class>org.apache.catalina.servlets.DefaultServlet</se
>> rvlet-class>
>>         <init-param>
>>             <param-name>debug</param-name>
>>             <param-value>0</param-value>
>>         </init-param>
>>         <init-param>
>>             <param-name>listings</param-name>
>>             <param-value>false</param-value>
>>         </init-param>
>>         <load-on-startup>1</load-on-startup>
>>     </servlet>
>>     <servlet-mapping>
>>         <servlet-name>default</servlet-name>
>>         <url-pattern>/</url-pattern>
>>     </servlet-mapping>
>>     <mime-mapping>
>>         <extension>ext</extension>
>>         <mime-type>x-application/ext</mime-type>
>>     </mime-mapping>
>> </web-app>
>>
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat embedded

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Steffen Heil [mailto:lists@steffen-heil.de] 
> Subject: RE: tomcat embedded
> 
> Is there really no documentation for tomcat embedded nor 
> anyone who uses it?

If you're using Tomcat embedded, it's up to you to read and parse any
configuration information you might have, and call the appropriate APIs
to create the necessary Tomcat objects:
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/startup/
Embedded.html

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: tomcat embedded

Posted by Steffen Heil <li...@steffen-heil.de>.
Hi

Sorry to ask again, but this is a common feature that I cannot find any
documentation for...

Is there really no documentation for tomcat embedded nor anyone who uses it?

Regards,
  Steffen
 

> -----Original Message-----
> From: Steffen Heil [mailto:lists@steffen-heil.de] 
> Sent: Tuesday, April 15, 2008 10:36 PM
> To: 'Tomcat Users List'
> Subject: tomcat embedded
> 
> Hi
> 
> I am searching for some documentation about tomcat embedded.
> I am trying to convert a very simple setup (configuration 
> below) to java code, not using any xml file.
> 
> Any link, hint, etc. would be helpful.
> Could someone give me a hint?
> 
> Regards,
>   Steffen
> 
> 
> === server.xml 
> ==========================================================
> 
> <Server port="8005" shutdown="SHUTDOWN">
>   <Service name="applicationService">
>     <Executor name="applicationExecutor" 
> namePrefix="application-exec-"
> maxThreads="150" minSpareThreads="4" />
>     <Connector executor="applicationExecutor" port="80" 
> protocol="HTTP/1.1"
> connectionTimeout="20000" />
>     <Connector executor="applicationExecutor" port="443" 
> protocol="HTTP/1.1"
>                SSLEnabled="true" scheme="https" secure="true"
> clientAuth="false" sslProtocol="TLS"
>                keystoreFile="file.p12" keystorePass="password"
> keystoreType="PKCS12" URIEncoding="UTF-8" />
>     <Engine name="applicationEngine" defaultHost="applicationHost">
>       <Host name="applicationHost" appBase="webapps" 
> unpackWARs="false"
> autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
>         <Context path="" reloadable="false" 
> docBase="/opt/application" />
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="access-" suffix=".txt" pattern="combined"
> resolveHosts="false" fileDateFormat="yyyy-MM-dd"/>
>       </Host>
>     </Engine>
>   </Service>
> </Server>
> 
> 
> === context.xml 
> =========================================================
> 
> <Context>
> </Context>
> 
> 
> === web.xml 
> =============================================================
> 
> <?xml version="1.0" encoding="ISO-8859-1"?> <web-app 
> xmlns="http://java.sun.com/xml/ns/javaee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>     version="2.5">
>     <servlet>
>         <servlet-name>default</servlet-name>
>  
> <servlet-class>org.apache.catalina.servlets.DefaultServlet</se
> rvlet-class>
>         <init-param>
>             <param-name>debug</param-name>
>             <param-value>0</param-value>
>         </init-param>
>         <init-param>
>             <param-name>listings</param-name>
>             <param-value>false</param-value>
>         </init-param>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>default</servlet-name>
>         <url-pattern>/</url-pattern>
>     </servlet-mapping>
>     <mime-mapping>
>         <extension>ext</extension>
>         <mime-type>x-application/ext</mime-type>
>     </mime-mapping>
> </web-app>
>