In Netbeans 7.1.1. I have a Java project for a web application that I deploy on Tomcat 7. The project is migrated from an earlier version from Netbeans (together with all my other projects).
The problem is that my project now is in an error state. Its name is in red and it has a little yellow triangle in its blue globe project icon. When I right click on the project I see the option to "Resolve Data Source Problem.".
Unfortunately this option does not resolve the problem. When I choose the option I get a dialog with the text: "To resolve, select a Data Source name below then click Add Connection. Database connections for the Data Sources referenced in this project could not be located."
When I select the data source that can't be located (jdbc/mydb) and press the "Add Connection" button, it opens the "New Connection Wizard" but when I press the "Finish" button, I get an "Unable to add connection. Connection already exists."
The connection is already defined in my context.xml
and my project is running and deploying without any problems.
Here is my context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/myapp.com">
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver"
maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/mydb"
password="secret" type="javax.sql.DataSource"
url="jdbc:mysql://127.0.0.1:3306/mydb?autoReconnect=true"
username="user" validationQuery="select 1"/>
</Context>
How can I get my Netbeans project out of this "Resolve Data Source problem"?
I figured it out on that the solution had been right under my nose all along.
Right click the globe icon of your project > select resolve datasource problem > then select your jdbc name of your resource from the options available. > click add a connection.
A window appears and you should make sure that the resource reference URL is the same as the name of the database you are trying to connect to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With