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 7572615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:58:10+00:00 2026-05-30T15:58:10+00:00

I try to move some services from my Tomcat Server to Jetty, just to

  • 0

I try to move some services from my Tomcat Server to Jetty, just to make some comparisons. Obviously I don’t want to change my services, but I experiment some issues to deploy them with JDBC.

My services all use the same database to access datas, so I wrote my own library to make my requests. The services don’t have any informations about the database, they just know they have to use the library. In this library I make connections with the database using this kind of code:

InitialContext ictx = new InitialContext();
Context envCtx = (Context) ictx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/mysql");

In Tomcat my services work well just adding a line in context.xml:

<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/mysql" username="login" password="password" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/mysql" />

So I just want to do the same in Jetty. I added the following block in my jetty.xml:

<New id="mysql" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg></Arg>
    <Arg>jdbc/mysql</Arg>
    <Arg>
        <New class="org.apache.commons.dbcp.BasicDataSource">
            <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
            <Set name="url">jdbc:mysql://localhost:3306/mysql</Set>
            <Set name="username">login</Set>
            <Set name="password">password</Set>
        </New>
    </Arg>
</New>

The server starts well and seem to work, but I get an error when I try to access to my services. In jetty’s manual I found it’s explictly written that I have to add some informations in web.xml like:

<resource-ref>
    <description>My DataSource Reference</description>
    <res-ref-name>jdbc/DSTest</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

So I wonder if there is any other solution, than write the same lines in all my web.xml services’ files? Like adding a common xml file for all my server with the same informations ?

  • 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-05-30T15:58:12+00:00Added an answer on May 30, 2026 at 3:58 pm

    You can add it to the webdefault.xml that is used as the foundation for processing web.xml.

    This file is typically located in etc/webdefault.xml of the distribution.

    cheers

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

Sidebar

Related Questions

Hello there I try to move down some pixels an image I just centered,
I try to move some dos command from my batch file into python but
I'm new to EF 4.1 and try to move some code from to EF
In Delphi 2007, in a mouse move event, I try to change the mouse
I want to move some code that takes a couple seconds to generate a
I'm using Rails 3 and I'd like to move some controller files from app/controllers
I want to handle window move events. My first try was to handle DWebBrowserEvents2::WindowSetHeight
My android project crashes when I try to move from one class to another,
I've used the 'hg convert' command to try to move my SVN repository to
I've built a Django web application and some Django-Piston services. Using a web interface

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.