Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:54:22+00:00 2026-06-04T17:54:22+00:00

I have a really simple webapp project with maven and jetty that has been

  • 0

I have a really simple webapp project with maven and jetty that has been working very well until now. But now I need to setup MySQL connection pooling with JNDI as the database connections always time out.

First of all here is the relevant content of my pom.xml:

<modelVersion>4.0.0</modelVersion>
...
<packaging>war</packaging>
...
<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jetty-version>8.1.0.v20120127</jetty-version>
</properties> 
<dependencies>
    ...
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.20</version>
    </dependency>
    <dependency>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty-version}</version>
        <type>maven-plugin</type>
    </dependency>
</dependencies>
...
<build>
    <plugins>
    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty-version}</version>
        <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
            </configuration>
        </plugin>
    </plugins>
    ...
</build>

Now I created a jetty-env.xml in the folder /src/main/webapp/WEB-INF with the following content:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">  
    <New id="project-db" class="org.eclipse.jetty.plus.jndi.Resource">
        <Arg>jdbc/db</Arg>
        <Arg>
            <New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
                <Set name="url">jdbc:mysql://www.example.com:3306/mydb</Set>
                <Set name="username">dbuser</Set>
                <Set name="password">dbpass</Set>
            </New>
        </Arg>
    </New>
</Configure>

But the problem is that I can’t even test if this connection works as the jetty-maven-plugin fails to start on the goal

mvn jetty:run

with the following error:

WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext
{/,file:/D:/documents/programmierung/workspace/battleships-trunk/src/main/webapp/}
,file:/D:/documents/programmierung/workspace/battleships-trunk/src/main/webapp/

java.lang.IllegalArgumentException: Object of class 
'org.mortbay.jetty.plugin.JettyWebAppContext' is not of type 
'org.eclipse.jetty.webapp.WebAppContext'. 
Object Class and type Class are from different loaders.

So how can I get this to work? I’m forced to use Jetty version 8.x as I need WebSocket support and as the remote productive server will be running Jetty 8.

EDIT
Before Pavel Veller’s answer I tried the following: Deployed the assembled war to the remote jetty8 server and got the same error only that the previous error now reads as follows:

java.lang.IllegalArgumentException: Object of class 
'org.eclipse.jetty.webapp.WebAppContext' is not of type 
'org.eclipse.jetty.webapp.WebAppContext'. 
Object Class and type Class are from different loaders.

So it seems as if there are multiple class loaders conflicting.

EDIT2
As requested by Pavel I recreated the error with a simplified webapp which you can find here on Dropbox. It is a zipped eclipse maven project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:54:24+00:00Added an answer on June 4, 2026 at 5:54 pm

    Try removing the dependency on jetty-maven-plugin– this dependency adds the plugin to the WAR, which you don’t want.

    If you need to use any classes from Jetty itself, add a dependency for the specific version of Jetty (rather than the plugin) with a scope of provided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple webapp that runs within HTML5's Canvas that doesn't have
I have a really simple XML file that I'm trying to read, but I
It's really simple, I just want one screen. Wow, that [shiny thing] must have
So our new webapp project is based on maven. I'm really liking the dependency
I'm working on a very simple web app, written in Go language. I have
I have a really simple Rails app. Basically an article with comments. I want
I have a really simple blog application and I want to add a really
I have a really simple mod-rewrite rule : RewriteRule ^(.*)$ index.php?url=$1 [PT,L] As an
I have a really simple table with two rows and two columns. I want
A really simple shell script question. I have a file with something like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.