Jetty Runtime Error


(vivek prasad) #1

I am getting the following error while running my project on jetty

:jettyRun
failed org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext@b2bde5{/./WebContent/WEB-INF/jetty-env.xml,D:\gradleRou
\TSC_hca\Applications\HCA_J2EE\HCA\WebContent}: java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
failed ContextHandlerCollection@1ecb654: java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
failed HandlerCollection@14e5966: java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
Error starting handlers
java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructors(Class.java:1459)
        at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:599)
        at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:256)
        at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:190)
        at org.mortbay.jetty.plus.webapp.EnvConfiguration.configureWebApp(EnvConfiguration.java:130)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1269)

Although I have added the jar in the dependencies for both runtime and compiletime but still i am getting the same error.

Please help

Its important for my Project.


(vivek prasad) #2

I Have tried the followings

  1. Adding the jars in the Runtime
dependencies {
       compile group:'javax.transaction', name: 'jta', version: '1.1'
            runtime group:'javax.transaction', name: 'jta', version: '1.1'
       }
  1. Setting classpath in the jettyRun
jettyRun{
  webAppSourceDirectory = file('WebContent')
    jettyEnvXml = file('./WebContent/WEB-INF/jetty-test-r4-offshore.xml')
    webDefaultXml=file('WebContent/WEB-INF/webdefault.xml')
   webXml=file('WebContent/WEB-INF/web.xml')
                additionalRuntimeJars+=file('jta-1.1.jar')
                       parentLoaderPriority='true'
                     classpath=files(file('jta-1.1.jar'))
    }
 }

but still I am facing the same error


(vivek prasad) #3

anybody having answer please reply


(Peter Niederwieser) #4

Do you have a reproducible example build that you can upload somewhere so that we can give it a try? Please make it as small and simple as possible.