Tomcat ? ROOT?

Ola forum,

como fazer para minha aplicação ser chamado por esse endereço …

http://localhost:8080 --> desta forma o tomcat chama os exemplos, como fazer para chamar minha aplicação ??

valeu !!!

em algum ponto do arquivo server.xml (TOMCAT_HOME/conf/server.xml) troque
<Context path="/"
docBase=“ROOT”
debug=“0”
reloadable=“true”
crossContext=“true”>
</Context>

por
<Context path="/"
docBase=“meuapp”
debug=“0”
reloadable=“true”
crossContext=“true”>
</Context>

o atributo “Context path” é relacionado ao sub-domínio em que vai estar localizada sua aplicação, isto é: se vc tem um aplicativo cujo nome seja “meuapp”, seu dominio seja “meusite.com.br” e o valor do Context path é igual a “meuapp”, então você vai acessar sua aplicação através do endereço “www.meusite.com.br/meuapp” (considerando que você mudou a porta em que o tomcat estará servindo para a porta 80).
já o atributo “docBase” se refere ao diretório físico em que seu aplicativo está instalado dentro do diretório TOMCAT_HOME/webapps.

maiores informações aqui: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html

:slight_smile:

cara, não deu certo, quando altero a linha que vc falou, o tomcat não starta … ainda não achei o problema…

valeu

Ele nao deu nenhuma mensagem de erro?

voce deve ter esquecido de fechar o tag do context, ja que por default ele usa o tag que coemca e termina no mesmo lugar (<context />) em vez de abrir e fechar (<context></context>)

o tomcat nao starta apenas por UM motivo: xml mal formado. ou se as portas ja estao em uso, mas ai o aviso eh facil de ler.

da uma olhada na tag context…

[code]- <!-- Tomcat Root Context
–>

  • <!–
    <Context path="" docBase="ROOT" debug="0"/>

    –>

  • <!-- Tomcat Examples Context
    –>

  • <Context path="/examples" docBase="examples" debug="0" reloadable="true" crossContext="true">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_examples_log." suffix=".txt" timestamp="true" />
    <Ejb name="ejb/EmplRecord" type="Entity" home="com.wombat.empl.EmployeeRecordHome" remote="com.wombat.empl.EmployeeRecord" />

  • <!–
    If you wanted the examples app to be able to edit the
    user database, you would uncomment the following entry.
    Of course, you would want to enable security on the
    application as well, so this is not done by default!
    The database object could be accessed like this:

             Context initCtx = new InitialContext&#40;&#41;;
             Context envCtx = &#40;Context&#41; initCtx.lookup&#40;&quot;java&#58;comp/env&quot;&#41;;
             UserDatabase database =
                  &#40;UserDatabase&#41; envCtx.lookup&#40;&quot;userDatabase&quot;&#41;;
    

    –>

  • <!–
    <ResourceLink name="userDatabase" global="UserDatabase"
    type="org.apache.catalina.UserDatabase"/>

    –>

  • <!–
    PersistentManager: Uncomment the section below to test Persistent
    Sessions.

             saveOnRestart&#58; If true, all active sessions will be saved
               to the Store when Catalina is shutdown, regardless of
               other settings. All Sessions found in the Store will be 
               loaded on startup. Sessions past their expiration are
               ignored in both cases.
             maxActiveSessions&#58; If 0 or greater, having too many active 
               sessions will result in some being swapped out. minIdleSwap
               limits this. -1 or 0 means unlimited sessions are allowed.
               If it is not possible to swap sessions new sessions will
               be rejected.
               This avoids thrashing when the site is highly active.
             minIdleSwap&#58; Sessions must be idle for at least this long
               &#40;in seconds&#41; before they will be swapped out due to 
               activity.
               0 means sessions will almost always be swapped out after
               use - this will be noticeably slow for your users.
             maxIdleSwap&#58; Sessions will be swapped out if idle for this
               long &#40;in seconds&#41;. If minIdleSwap is higher, then it will
               override this. This isn't exact&#58; it is checked periodically.
               -1 means sessions won't be swapped out for this reason,
               although they may be swapped out for maxActiveSessions.
               If set to &gt;= 0, guarantees that all sessions found in the
               Store will be loaded on startup.
             maxIdleBackup&#58; Sessions will be backed up &#40;saved to the Store,
               but left in active memory&#41; if idle for this long &#40;in seconds&#41;, 
               and all sessions found in the Store will be loaded on startup.
               If set to -1 sessions will not be backed up, 0 means they
               should be backed up shortly after being used.
    
             To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
             and minIdleBackup all to -1, saveOnRestart to false, then restart 
             Catalina.
    

    –>

  • <!–
    <Manager className="org.apache.catalina.session.PersistentManager"
    debug="0"
    saveOnRestart="true"
    maxActiveSessions="-1"
    minIdleSwap="-1"
    maxIdleSwap="-1"
    maxIdleBackup="-1">
    <Store className="org.apache.catalina.session.FileStore"/>
    </Manager>

    –>
    <Environment name="maxExemptions" type="java.lang.Integer" value="15" />
    <Parameter name="context.param.name" value="context.param.value" override="false" />
    <Resource name="jdbc/EmployeeAppDb" auth="SERVLET" type="javax.sql.DataSource" />

  • <ResourceParams name="jdbc/EmployeeAppDb">

  • <parameter>
    <name>username</name>
    <value>sa</value>
    </parameter>

  • <parameter>
    <name>password</name>
    <value />
    </parameter>

  • <parameter>
    <name>driverClassName</name>
    <value>org.hsql.jdbcDriver</value>
    </parameter>

  • <parameter>
    <name>url</name>
    <value>jdbc:HypersonicSQL:database</value>
    </parameter>
    </ResourceParams>
    <Resource name="mail/Session" auth="Container" type="javax.mail.Session" />

  • <ResourceParams name="mail/Session">

  • <parameter>
    <name>mail.smtp.host</name>
    <value>localhost</value>
    </parameter>
    </ResourceParams>
    <ResourceLink name="linkToGlobalResource" global="simpleValue" type="java.lang.Integer" />
    </Context>[/code]

desta forma, ainda não alterei, mais quando altero na erro…

obrigado

voce tem e falar qual eh o erro pra gente
e mostra como voce ta fazendo a alteracao

senao a gente nao consegue te ajudar!

eu altero a tag context

esta assim:
<Context path="/examples" docBase=“examples” debug=“0” reloadable=“true” crossContext=“true”>

altero assim:
<Context path="/" docBase=“SCP” debug=“0” reloadable=“true” crossContext=“true”>

SCP --> é o diretorio da minha aplicação.
desta forma da mal…porem no linux, não aparece nenhum erro, apenas não starta…

deu pra entendeu ? :smiley:

valeu…

Que tal isso?

<Context path="/SCP" docBase=“ROOT” debug=“0” reloadable=“true” crossContext=“true”>

é…não deu certo

<Context path="/SCP" docBase=“ROOT” debug=“0” reloadable=“true” crossContext=“true”>

assim:
<Context path="/SCP" docBase=“SCP” debug=“0” reloadable=“true” crossContext=“true”>

assim:
<Context path="/" docBase=“SCP” debug=“0” reloadable=“true” crossContext=“true”>

valeu !