2017-05-15 22 views
0

Tomcatサーバー上に静的ファイル(例:html)を読み込む際に他の人に見られた問題があります。 guide on accessing local files from a tomcat serverに続いて、私は<Context docBase="F:/Sprint000" path="/static" />server.xmlファイルに追加しました。私は404エラーを取得し続けます。私はルートフォルダが `webapps 'であると仮定していますか?Tomcatサーバーに静的ファイルをロードする

アイデア?

ディレクトリ:ファイルcontext.xmlをお探しwebapps/Sprint000/index.htm

Server.xmlを

<Engine name="Catalina" defaultHost="localhost"> 

     <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> 

     <Realm className="org.apache.catalina.realm.LockOutRealm"> 

     <Realm className="org.apache.catalina.realm.UserDatabaseRealm" 
       resourceName="UserDatabase"/> 
     </Realm> 

     <Host name="localhost" appBase="webapps" 
      unpackWARs="true" autoDeploy="true"> 

      Documentation at: /docs/config/valve.html --> 

     <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> 

     <Context docBase="/Sprint000" path="/static" /> 
     <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
       prefix="localhost_access_log." suffix=".txt" 
       pattern="%h %l %u %t &quot;%r&quot; %s %b" /> 

     </Host> 
    </Engine> 
+0

に '文書ベース= ...'を変更してみてください絶対パス。 –

答えて

0

、それがになる編集:

<?xml version="1.0" encoding="UTF-8"?> 
<Context reloadable="true"> 
    <Resources> 
     <PreResources 
      base="F://Sprint000" 
      className="org.apache.catalina.webresources.DirResourceSet" 
      webAppMount="/static" /> 
    </Resources> 
    <Valve className="org.apache.catalina.valves.RemoteAddrValve" 
     allow=".*" /> 
</Context> 
+0

まだ404エラーです。入力したURLは 'http:// localhost:8080/static/index.htm'です。正しい? –

+0

'server.xml'は元の状態と同じですか? (configの前に 'context.xml'で) –

+0

元の' server.xml'ファイルに戻って 'context.xml'を変更しました。 Still 404 error –

関連する問題