Tomcat ? ROOT?

9 respostas
LN2EE

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 !!!

9 Respostas

Daniel_Quirino_Olive

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:

LN2EE

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

valeu

cv1

Ele nao deu nenhuma mensagem de erro?

Paulo_Silveira

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.

LN2EE

da uma olhada na tag context...

- &lt;!--  Tomcat Root Context 
  --&gt; 
- &lt;!-- 
          &lt;Context path=&quot;&quot; docBase=&quot;ROOT&quot; debug=&quot;0&quot;/&gt;
        

  --&gt; 
- &lt;!--  Tomcat Examples Context 
  --&gt; 
- &lt;Context path=&quot;/examples&quot; docBase=&quot;examples&quot; debug=&quot;0&quot; reloadable=&quot;true&quot; crossContext=&quot;true&quot;&gt;
  &lt;Logger className=&quot;org.apache.catalina.logger.FileLogger&quot; prefix=&quot;localhost_examples_log.&quot; suffix=&quot;.txt&quot; timestamp=&quot;true&quot; /&gt; 
  &lt;Ejb name=&quot;ejb/EmplRecord&quot; type=&quot;Entity&quot; home=&quot;com.wombat.empl.EmployeeRecordHome&quot; remote=&quot;com.wombat.empl.EmployeeRecord&quot; /&gt; 
- &lt;!-- 
 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&#58;

               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;;
          

  --&gt; 
- &lt;!-- 
          &lt;ResourceLink name=&quot;userDatabase&quot; global=&quot;UserDatabase&quot;
                        type=&quot;org.apache.catalina.UserDatabase&quot;/&gt;


  --&gt; 
- &lt;!-- 
 PersistentManager&#58; 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.
          

  --&gt; 
- &lt;!-- 
          &lt;Manager className=&quot;org.apache.catalina.session.PersistentManager&quot;
              debug=&quot;0&quot;
              saveOnRestart=&quot;true&quot;
              maxActiveSessions=&quot;-1&quot;
              minIdleSwap=&quot;-1&quot;
              maxIdleSwap=&quot;-1&quot;
              maxIdleBackup=&quot;-1&quot;&gt;
                &lt;Store className=&quot;org.apache.catalina.session.FileStore&quot;/&gt;
          &lt;/Manager&gt;
		  

  --&gt; 
  &lt;Environment name=&quot;maxExemptions&quot; type=&quot;java.lang.Integer&quot; value=&quot;15&quot; /&gt; 
  &lt;Parameter name=&quot;context.param.name&quot; value=&quot;context.param.value&quot; override=&quot;false&quot; /&gt; 
  &lt;Resource name=&quot;jdbc/EmployeeAppDb&quot; auth=&quot;SERVLET&quot; type=&quot;javax.sql.DataSource&quot; /&gt; 
- &lt;ResourceParams name=&quot;jdbc/EmployeeAppDb&quot;&gt;
- &lt;parameter&gt;
  &lt;name&gt;username&lt;/name&gt; 
  &lt;value&gt;sa&lt;/value&gt; 
  &lt;/parameter&gt;
- &lt;parameter&gt;
  &lt;name&gt;password&lt;/name&gt; 
  &lt;value /&gt; 
  &lt;/parameter&gt;
- &lt;parameter&gt;
  &lt;name&gt;driverClassName&lt;/name&gt; 
  &lt;value&gt;org.hsql.jdbcDriver&lt;/value&gt; 
  &lt;/parameter&gt;
- &lt;parameter&gt;
  &lt;name&gt;url&lt;/name&gt; 
  &lt;value&gt;jdbc&#58;HypersonicSQL&#58;database&lt;/value&gt; 
  &lt;/parameter&gt;
  &lt;/ResourceParams&gt;
  &lt;Resource name=&quot;mail/Session&quot; auth=&quot;Container&quot; type=&quot;javax.mail.Session&quot; /&gt; 
- &lt;ResourceParams name=&quot;mail/Session&quot;&gt;
- &lt;parameter&gt;
  &lt;name&gt;mail.smtp.host&lt;/name&gt; 
  &lt;value&gt;localhost&lt;/value&gt; 
  &lt;/parameter&gt;
  &lt;/ResourceParams&gt;
  &lt;ResourceLink name=&quot;linkToGlobalResource&quot; global=&quot;simpleValue&quot; type=&quot;java.lang.Integer&quot; /&gt; 
  &lt;/Context&gt;

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

obrigado

Paulo_Silveira

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!

LN2EE

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…

cv1

Que tal isso?

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

LN2EE

é…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 !

Criado 15 de abril de 2003
Ultima resposta 17 de abr. de 2003
Respostas 9
Participantes 4