sbtxsbt-web-pluginwebapp-runner

Need to provide addtional jars to for xsbt-web-plugin container


I am trying to run my war file using xsbt-web-plugin. My war itself does not contain tomcat-jdbc-pool jar and javax-servlet-api. I tried using container configuration. But sbt complains configuration does not exist. If I use provided configuration, webapp-runner fails.

I am sure I am missing something. But unable to figure it out.

WARNING: Failed to register in JMX: [javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSourceFactory]]


Solution

  • What version of xsbt-web-plugin are you using? Can you post the contents of your sbt build configuration?

    The Tomcat plugin in xsbt-web-plugin relies on webapp-runner, which does not appear to bundle the tomcat-jdbc library. You can add it via containerLibs in Tomcat:

    enablePlugins(TomcatPlugin)
    
    containerLibs in Tomcat += "org.apache.tomcat" % "tomcat-jdbc" % "8.5.15"