Domanda

I have a Lift-based REST application. My dev environment is running the Jetty server built into SBT, and the application is deployed on Tomcat 7.

I recently integrated Ehcache to my setup, discarding a custom cache. It works flawlessly in my Jetty dev server. When I deploy to tomcat however, any URL's served by my Lift application get 404's. There are no exceptions, and no log items as far as I can find that are relevant, aside from the 404 in the log.

When I comment out the lines referring to Ehcache and remove it as a dependency, Tomcat fires up and works fine and serves those urls. As soon as I uncomment Ehcache, it's all 404's again.

Does anyone know what is going on? I know Ehcache uses SLF4J to log, is that somehow stopping ehcache errors from appearing in my logs?

Relevant section of build.sbt:

  Seq(
"net.liftweb"       %% "lift-webkit"        % liftVersion        % "compile",
"net.liftweb"       %% "lift-mapper"        % liftVersion        % "compile",
"com.typesafe.slick" %% "slick" % "2.0.0-M3",
"org.eclipse.jetty" % "jetty-webapp"        % "8.1.7.v20120910"  % "container,test",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
"ch.qos.logback"    % "logback-classic"     % "1.0.6",
"org.specs2"        %% "specs2"             % "1.14"             % "test",
"mysql"             % "mysql-connector-java" % "5.1.25",
"net.sf.ehcache"    % "ehcache"             % "2.8.2",
"javax.transaction"    % "transaction-api"  % "1.1",
"org.slf4j"         % "slf4j-simple"        % "1.7.7"

)

Relevant seciont of ehcache.xml

<cache  name="mycache" 
        maxEntriesLocalHeap="10000" 
        maxEntriesLocalDisk="1000" 
        eternal="false" 
        diskSpoolBufferSizeMB="20" 
        timeToIdleSeconds="21600" 
        timeToLiveSeconds="43200" 
        memoryStoreEvictionPolicy="LFU" 
        transactionalMode="off">
</cache>

Any help would be greatly appreciated. Thanks in advance.

È stato utile?

Soluzione

Finally solved this. It was two separate problems. First, there was a bug (or multiple) with Tomcat 7.0.42 I was running in production. EhCache was failing silently.

In a separate installation of 7.0.52, It was throwing an Exception, saying it was unable to locate my ehcache.xml file. Moving the file to WEB-INF/classes/ solved that exception and the application spun up. Moving back to my 7.0.42 installation however, it still would not fire up.

After forcing my production installation to 7.0.52, the application fires up and works fine.

So in summary, I had two problems:

  1. Ehcache was unable to find my config file
  2. Tomcat 7.0.42 seemed to have a bug

Solutions:

  1. Move ehcache.xml to WEB-INF/classes
  2. Upgrade Tomcat from 7.0.42 -> 7.0.52
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top