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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:39:36+00:00 2026-06-14T19:39:36+00:00

I registered a domain www.mywebapp.com and pointed the name servers to my tomcat hosting.

  • 0

I registered a domain http://www.mywebapp.com and pointed the name servers to my tomcat hosting.
So when I give http://www.mywebapp.com is given , it hits the

tomcat/webapps/mywebapp.com

and pages get loaded with no issues.So that much part is correct.

But I am not able to establish DB connection ( using JNDI datasource ) for my application,because When I call –

DBConnection.ds = (DataSource)ctx.lookup("java:comp/env/jdbc/atfdb"); 

It says

DB Connection NamingException error-->Name atfdb is not bound in this Context.

Note:

I am using tomcat7.

The DB connection is established if I deploy the app directly under tomcat/webapps folder,the problem comes only when I deploy it inside webapps/mywebapp.com.

Is there any special case for JNDI lookup if we deploy the war file inside webapps/mywebapp.com ?

Below are my configurations

server.xml  inside tomcat/conf/server.xml
-------------------------------------------

<Host appBase="webapps/mywebapp.com" name="mywebapp.com" unpackWARs="true" autoDeploy="true">
      <Alias>www.mywebapp.com</Alias>
      <Context path="" docBase="ROOT" debug="0" reloadable="true"/>
      <Logger className="org.apache.catalina.logger.FileLogger" prefix="mywebapp.com"   suffix=".txt" timestamp="true"/>
      </Host>


context.xml in which I am configuring my datasource.


context.xml   inside webapps/mywebapp.com/META-INF
--------------------------------------------------

<Context>

  <Resource name="jdbc/atfdb" auth="Container" type="javax.sql.DataSource"
               removeAbandoned="true" maxActive="100" maxIdle="30" maxWait="10000"
               removeAbandonedTimeout="30" username="spadmin" password="password" 
               driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/socialdb?autoReconnect=true"/>

</Context>
  • 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-14T19:39:38+00:00Added an answer on June 14, 2026 at 7:39 pm

    I would add a resource reference into your web.xml:

    <resource-ref>
        <description>atfdb description</description>
        <res-ref-name>jdbc/atfdb</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    

    This is what is expected as per Java EE standard, so the fact that it works when you use the other folder could just be a fluke…

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

Sidebar

Related Questions

I have obtained hosting space and they registered domain(say www.abc.com ) with an ip(say
I have a domain name registered with Network Solutions, www.anoneo.com. My domain is redirected
I registered domain www.a.com I then forwarded with masking (using GoDaddy) traffic from www.a.com
I registered a sub domain on my server using DNS: client.henrybuilt.com If I wanted
How would I go about checking if a domain name is registered? I was
I have a SSL certificate that is registered to my www domain, but all
I have a website http://www.domain1.com . Is it possible to register a second domain,
I have registered a domain in iPage.com. But recently i learnt that they are
Current URL : http://www.domain.com/billing/signup.php?a=1&b=2 What I need : http://billing.domain.com/register.php I'm not really good at
Given a URL, how do I extract the registered domain using the Public Suffix

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.