I tried the Embedded class to work with Tomcat5
from the jakarta-tomcat-5.0.28-embed.tar.gz and am not
getting very far, ie not able to deploy even the
/manager webapp included in the webapps/.   
   I also tried the JMX style using an xml file (not
exactly sure why is this better than starting with the
startup.sh from a full blown Tomcat5) and coming to a
slightly different difficulties.  I used the
minmgr.xml (attached file)from Wrox book Tomcat5 and
am not able to log in because it seems to use
JAASRealm even though I do not see it define under any
<mbean>. As matter of factly it is defined to use
MemmoryRealm.  
1) So where does it gets this JAASRealm?
snippet error from running:

await:
      [jmx] Oct 22, 2004 11:49:26 AM
org.apache.catalina.realm.JAASRealm authenticate
      [jmx] SEVERE: Unexpected error
      [jmx] java.lang.SecurityException: Unable to
locate a login configuration



2) The tomcat-users.xml is slightly different from
what came with a regular Tomcat 5. Specifically using
"name" as oppose to "username".
the tomcat-users.xml that came with the tarball:

      1 <!--
      2   NOTE:  By default, no user is included in
the "manager" role         required
      3   to operate the "/manager" web application. 
If you wish to u        se this app,
      4   you must define such a user - the username
and password are         arbitrary.
      5 -->
      6 <tomcat-users>
      7   <user name="tomcat" password="tomcat"
roles="tomcat" />
      8   <user name="role1"  password="tomcat"
roles="role1"  />
      9   <user name="both"   password="tomcat"
roles="tomcat,role1" /        >
     10 </tomcat-users>

Snippet of minmgr.xml specifically for the Realm:

<mbean name="${domain}:type=Engine"
 code="org.apache.catalina.core.StandardEngine"
              modeler="true">
 <attribute name="name"
value="Tomcat-Min-Standalone"/>
 <attribute name="baseDir" value="${tomcat.home}"/>
 <attribute name="defaultHost" value="localhost"/>
</mbean>
<mbean name="${domain}:type=Realm"
 code="org.apache.catalina.realm.MemoryRealm"         
 modeler="true">
  <attribute name="pathname"
   value="${tomcat.home}/conf/tomcat-users.xml" />   
</mbean>
<mbean name="${domain}:type=Connector,port=9080"
 code="org.apache.coyote.tomcat5.CoyoteConnector"
           modeler="true">
 <attribute name="port" value="9080" />





                
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 
<project name="min-tc5" default="start" basedir=".">
  <property file="${user.home}/build.properties"/>
  <property file="build.properties"/>
  <property name="tomcat.home" location="." />
  <property name="tomcat.webapps" location="${tomcat.home}/webapps" />
  <path id="tomcatCP-extra" /> 
  <target name="init" unless="init.done">
    <path id="tomcatCP" >
      <path refid="tomcatCP-extra"/>
      <fileset dir="${tomcat.home}/lib" includes="*.jar"/>
      <pathelement  path="${tomcat.home}/conf"/>
    </path>
    <taskdef resource="org/apache/commons/modeler/ant/ant.properties"
             classpathref="tomcatCP" />
    <property name="init.done" value="true"/>
   </target>
  <property name="domain" value="Tomcat-Min-Standalone" />
  <property name="jsr77Domain" value="Tomcat-Min-Standalone" />
   <target name="run" depends="init"
        description="Start tomcat as an mbean, no server.xml">
    <modelerRegistry resource="org/apache/catalina/mbeans/mbeans-descriptors.xml" />
    <modelerRegistry resource="org/apache/catalina/loader/mbeans-descriptors.xml" />
    <mkdir dir="${tomcat.home}/work/${domain}/" />
    <jmx-service>
   <mbean name="${domain}:type=Server" 
              code="org.apache.catalina.core.StandardServer"
              modeler="true">
         <attribute name="port" value="9005"/>
       </mbean>
       <mbean name="${domain}:type=Service" 
              code="org.apache.catalina.core.StandardService"
              modeler="true">
         <attribute name="name" value="Tomcat-Min-Standalone"/>
       </mbean>
       <mbean name="${domain}:type=Engine" 
              code="org.apache.catalina.core.StandardEngine"
              modeler="true">
         <attribute name="name" value="Tomcat-Min-Standalone"/>
         <attribute name="baseDir" value="${tomcat.home}"/>
         <attribute name="defaultHost" value="localhost"/>
       </mbean>
       <mbean name="${domain}:type=Realm" 
              code="org.apache.catalina.realm.MemoryRealm" modeler="true">
         <attribute name="pathname"
                    value="${tomcat.home}/conf/tomcat-users.xml" />
       </mbean>
       <mbean name="${domain}:type=Connector,port=9080" 
              code="org.apache.coyote.tomcat5.CoyoteConnector"
              modeler="true">
          <attribute name="port" value="9080" />
       </mbean>
       <mbean name="${jsr77Domain}:j2eeType=WebModule,name=//localhost/,J2EEApplication=none,J2EEServer=none" 
              code="org.apache.catalina.core.StandardContext"  modeler="true">
         <attribute name="docBase" value="${tomcat.webapps}/ROOT" />
         <attribute name="privileged" value="true" />
         <attribute name="engineName" value="${domain}" />
       </mbean>

       <mbean name="${jsr77Domain}:j2eeType=WebModule,name=//localhost/servlets-examples,J2EEApplication=none,J2EEServer=none" 
              code="org.apache.catalina.core.StandardContext"  modeler="true">
         <attribute name="docBase" value="${tomcat.webapps}/servlets-examples" />
         <attribute name="privileged" value="true" />
         <attribute name="engineName" value="${domain}" />
       </mbean>

       <mbean name="${jsr77Domain}:j2eeType=WebModule,name=//localhost/manager,J2EEApplication=none,J2EEServer=none" 
              code="org.apache.catalina.core.StandardContext"  modeler="true">
         <attribute name="docBase" value="${tomcat.webapps}/manager" />
         <attribute name="engineName" value="${domain}" />
         <attribute name="privileged" value="true" />
       </mbean>
     </jmx-service>
    <echo message="Tomcat5 running"/>
  </target>
  <target name="await" depends="init"
        description="Wait for tomcat stop. Call this target after run">
    <jmx objectName="${domain}:type=Server"
         operation="await" />
    <sleep hours="1"/>
  </target>
  <target name="start"
              depends="init,run,await" 
  			  description="Start tomcat, wait for stop message"/>
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to