Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Tomcat-Struts Data Source problem

Reply
Thread Tools

Tomcat-Struts Data Source problem

 
 
Kris74
Guest
Posts: n/a
 
      07-18-2005
hello! I develop a Struts application and I have a problem with
starting my Tomcat. I sought why and I know that the problem is of Data
Source. But I did not find a solution.

Here my declaration of Data Source in Sruts-config.xml :

<data-sources> <data-source
type="org.apache.commons.dbcp.BasicDataSource"> <set-property
property="driverClassName" value="com.mysql.jdbc.Driver" />
<set-property property="url" value="jdbc:mysql://localhost/bddStruts"
/> <set-property property="username" value="root" /> <set-property
property="password" value="struts" /> <set-property
property="maxActive" value="12" /> <set-property property="maxWait"
value="5000" /> <set-property property="defaultAutoCommit" value="true"
/> <set-property property="defaultReadOnly" value="false" />
<set-property property="validationQuery" value="SELECT COUNT(*) FROM
users" /> </data-source> </data-sources>

I use NetBeans, and I have this error in the console:

GRAVE: Initializing application data source
org.apache.struts.action.DATA_SOURCE

org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (Communication link failure:
java.io.IOException, underlying cause: Unexpected end of input stream

If somebody could help me it would be very nice.

I have been blocked for one week.

I cannot any more what make.

Thank you for your help.

Ps: Sorry for the expression, I am French.

 
Reply With Quote
 
 
 
 
Wendy Smoak
Guest
Posts: n/a
 
      07-18-2005
"Kris74" <(E-Mail Removed)> wrote in message:

> hello! I develop a Struts application and I have a problem with
> starting my Tomcat. I sought why and I know that the problem is of Data
> Source. But I did not find a solution.
>
> Here my declaration of Data Source in Sruts-config.xml :
>
> <data-sources>


I'm not entirely sure if that _should_ work, but you're encouraged to
configure the data sources in your container rather than within Struts.

For Tomcat 5.5:
http://jakarta.apache.org/tomcat/tom...les-howto.html

If you need more help, please come join us on the Struts User mailing list:
http://struts.apache.org/mail.html

--
Wendy Smoak


 
Reply With Quote
 
 
 
 
Kris74
Guest
Posts: n/a
 
      07-18-2005
Thank you for your answer, but I already read the Website that you
propose for Tomcat 5.

I don't undertand how ask my questions on struts.apache.org

Thank

Kris74

 
Reply With Quote
 
Wendy Smoak
Guest
Posts: n/a
 
      07-18-2005
"Kris74" <(E-Mail Removed)> wrote

>
> I don't undertand how ask my questions on struts.apache.org
>


First search the archives of struts-user to see if your question has already
been answered:
http://www.mail-archive.com/user%40struts.apache.org/

If you still need to post a question to the list, visit
http://struts.apache.org/mail.html and click on the 'Subscribe' link under
STRUTS-USER Mailing List. There are other options, including news.gmane.org
which may be more attractive since you're (obviously) familiar with Usenet.

Sorry, I'm just not familiar enough with DataSource to be able to help, but
there are plenty of people on the list who can.

--
Wendy Smoak


 
Reply With Quote
 
Kris74
Guest
Posts: n/a
 
      07-20-2005
Wendy Smoak a écrit :

> First search the archives of struts-user to see if your question has already
> been answered:
> http://www.mail-archive.com/user%40struts.apache.org/


ok thank you for the web page, but some people have the same problem
but they do not have the solutions.

> If you still need to post a question to the list, visit
> http://struts.apache.org/mail.html and click on the 'Subscribe' link under
> STRUTS-USER Mailing List.


I send an e-mail at http://www.velocityreviews.com/forums/(E-Mail Removed) for subscribe

thank,

Kris74

 
Reply With Quote
 
Kris74
Guest
Posts: n/a
 
      07-29-2005
I can connect to my database with a simple classe Java like this :
package javappli;

import java.sql.*;

public class Main {

public static void main(String[] args){

String pilote = "com.mysql.jdbc.Driver";

try{
Class.forName(pilote);
Connection connexion =
DriverManager.getConnection("jdbc:mysql://localhost/articles","root","root");
connexion.setAutoCommit( true );
Statement instruction = connexion.createStatement();
ResultSet resultat = instruction.executeQuery("SELECT *
FROM articles");
while(resultat.next()){

System.out.println("code:
"+resultat.getString("code"));
System.out.println("nom:
"+resultat.getString("nom"));
System.out.println("Prix:
"+resultat.getFloat("prix"));
System.out.println("Stock actuel:
"+resultat.getInt("stockActuel"));
System.out.println("Stock minimum:
"+resultat.getInt("stockMinimum"));

}
}
catch (Exception e){

System.out.println("driver failed : "+e);
}
}
}
In Another test, I create a datasource with Tomcat Admin in
Ressources->datasources like this:
JNDI Name: jdbc/test
Data Source URL:jdbc: mysql://localhost:3306/test?autoReconnect=true
JDBC Driver Class: com.mysql.jdbc.Driver
User Name: root
Password: root
Max. Active Connections: 4
Max. Idle Connections: 2
Max. Wait for Connection:5000

And modify a context.xml like this:

<Context path="/test">
<ResourceLink name="jdbc/test"
type="javax.sql.DataSource"
global="jdbc/test"/>
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="test" suffix=".log" timestamp="true"/>

And the web.xml like this :

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

But I doesn't work, if I try to execute an application with a simple
JSP.

If you have ideas, give me them
Thank

Kris

 
Reply With Quote
 
Kris74
Guest
Posts: n/a
 
      07-29-2005
I forgot to give my error message :

javax.servlet.ServletException: Unable to get connection, DataSource
invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create
JDBC driver of class ''

thank,

Kris74

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object data source, setting parameter source to Page.Partner.Guid Allan Ebdrup ASP .Net Web Controls 2 10-06-2006 10:24 AM
ReportViewer "A data source instance has not been supplied for the data " problem Burak Gunay ASP .Net Web Controls 0 06-14-2006 03:08 PM
Need advice on paging data from data source. Ken Varn ASP .Net 4 01-19-2005 05:35 PM
Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software ) Author Tarun Tyagi C Programming 0 12-29-2004 05:10 PM
Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software ) Author Tarun Tyagi Cisco 0 12-29-2004 05:03 PM



Advertisments