File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Java Products and Servers and the fly likes resin-web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "resin-web.xml" Watch "resin-web.xml" New topic
Author

resin-web.xml

Brett Favro
Greenhorn

Joined: Mar 19, 2004
Posts: 8
I cannot seem to get connection pooling to working using my hosting co: Hostmatix.com and their Resin 2.0 config. I have tried using standard web.xml but the web-app_2.2 DTD doesn't allow for <init param> tags inside resource-ref.
*** So I'm trying a resin-web.xml. Here it is:
<web-app>
<database>
<jndi-name>jdbc/MySql</jndi-name>
<driver type="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<url>jdbc:mysql://localhost/mydb</url>
<user></user>
<password></password>
<max-connections>20</max-connections>
<max-idle-time>30s</max-idle-time>
</driver>
</database>
</web-app>
The user and password tags have text (omitted for posting).
I am then:
1) Context env = new InitialContext().lookup("java:comp.env");
2) DataSource ds = env.lookup("jdbc/MySql");
3) Connection con = ds.getConnection();
My Connection Object is always null.
What's going wrong? Is there a way of my Hosting co. to prevent reading web or resin-web.xml[s]? Is there a DTD for resin-web.xml?
I already cannot use JavaMail on my provider's box forcing me to user com.caucho.vfs class instead. I prefer not to use a non standard solution....

Any help appreciated...
Brett Favro
Greenhorn

Joined: Mar 19, 2004
Posts: 8
I mean to post "java:comp/env" for the initial JNDI context.
Brett Favro
Greenhorn

Joined: Mar 19, 2004
Posts: 8
This forum is really super lamOOOOOoooooooo!
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    1
Probably just not a lot of Resin users here.
Have you considered calling up Caucho and asking for support?
Tom Pridham
Ranch Hand

Joined: Feb 06, 2001
Posts: 92
This may sound dumb, but can you connect to the db via the command line? Also, it you don't do a cleanup in a finally block and release the connection, you will quickly run out of them :-(
Here is my mysql portion of the Resin config file:
resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="com.mysql.jdbc.Driver"/>
<init-param url="jdbc:mysql://127.0.0.1:3306/myDBName"/>
<init-param user="blah"/>
<init-param password="blah2"/>
<init-param max-connections="20"/>
<init-param max-idle-time="30"/>
</resource-ref>
Then I have a WebConstants.java file that contains the following snippet:
public static final String DEFAULT_DATASOURCE = "jdbc/test";
Then from anywhere, can get a connection by calling WebConstants.DEFAULT_DATASOURCE = "jdbc/test";
If this doesn't work, either email me at pridam@mindspring.com or my AOL IM is Tom365MT
Hope this helps!
Regards,
Tom Pridham
CIO
www.365MT.com
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 257
Hello. I am trying something similar with Resin 3.0.8. I am packaging my ejb/servlet in a war and I am entering the jndi resource info into the web.xml for the war. I keep getting an error message back saying "...'url' is an unknown property of com.caucho.sql.DBPool". Does anybody have any idea if the tags have changed or anything? I've looked everywhere. Thank you.
Brett Favro
Greenhorn

Joined: Mar 19, 2004
Posts: 8
A simple DTD would go a long way here. Thanks again Caucho..
I finally got my to work by modifying the resin.conf for my server (ISP gives dedicated JVMS to each account). This obviously isn't the RIGHT way to do things in a shared enterprise environment but
<resource-ref>
<res-ref-name>jdbc/MySQL</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="org.gjt.mm.mysql.Driver"/>
<init-param url="jdbc:mysql://localhost/someuser"/>
<init-param user="******"/>
<init-param password="*******"/>
<init-param max-connections="10"/>
</resource-ref>

Of course the username and password have been *[ed] out for obvious reasons.
Note: this is a Resin 2.x server.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: resin-web.xml
 
Similar Threads
Problem with database connection pooling resin+mysqlw
Resin DB-pooling + authentication. HELP!
Getting JNDI to work on Resin 2.1.14
Sample resin.conf file
Getting Error Message from Server