aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "web.xml" Watch "web.xml" New topic
Author

web.xml

Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
Hello. If somebody has a minute, I am trying to fiddle with a CMP entity bean on resin 3.0.8. This is my web.xml with the database connectivity info...but everytime I try to deploy the war contining the bean and the servlet, I get this error message on the console...

'url is an unknown property of com.caucho.sql.DBPool

Here is my web.xml...

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app><resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="oracle.jdbc.driver.OracleDriver"/>
<init-param url="jdbc:0racle:thin:@mycompany:1521:myoracle"/>
<init-param user="userid"/>
<init-param password="password"/>
</resource-ref>
<resource-ref>
<res-ref-name>java:comp/env/cmp</res-ref-name>
<class-name>com.caucho.ejb.EJBServer</class-name>
<init-param data-source="java:comp/env/jdbc/test"/>
</resource-ref></web-app>

What I can find on the resin site indicates that url is indeed a property. It just doesn't seem to be clear as to what version a particular reference is talking about. In general terms, I can't seem to find anything definitive on how CMP beans know how and where to connect with a database. This always seems to be glanced over in books and stuff. I assume it's always indicated in the web.xml...but with unique tags dependent on the server and it's internal db pooling classes?...Anyway, thank you very much for reading this and for your time. Any advice and junk is really appreciated.
[ February 18, 2005: Message edited by: Tom Griffith ]
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
Perhaps this shall help you. There are some changes in tags in newer version of Resin.
http://www.caucho.com/support/resin-interest/0303/0334.html
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
Hi. Thank you very much for that. I came across that yesterday but I can't find anything specific to database pooling tags. There is a link somewhere on there called "database configuration" and it just takes you to a page (I suspect outdated?) that contains the very same properties that are bombing.
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
Oh, wait a minute, I found it thanks to further review. Man, I really appreciate the heads up. Like I said, I gave up on that site yesterday.

http://www.caucho.com/resin-3.0/features/resin-3.0.0.xtp#database-configurat
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
Hello. If anybody has another minute, I keep getting this error when I'm uploading the war with the EJB CMP components...

com.caucho.config.LineConfigException: WEB-INF/web.xml:17: can't instantiate 'class com.caucho.ejb.EJBServer'.

The good news is I think the tagging is right...but it doesn't seem to know where to find the EJB class. This is the web.xml...

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">


<web-app xmlns="http://caucho.com/ns/resin">

<database>
<jndi-name>jdbc/test</jndi-name>
<driver type="oracle.jdbc.driver.OracleDriver">
<url>jdbc:0racle:thin:@mycompany:1521:myoracle</url>
<user>userid</user>
<password>password</password>
</driver>
</database>

<ejb-server>
<jndi-name>java:comp/env/cmp</jndi-name>
<data-source>java:comp/env/jdbc/test</data-source>
</ejb-server>

<servlet servlet-name="turtle-servlet" servlet-class="com.turtle.TurtleServlet"/>
<servlet-mapping url-pattern="/turtle" servlet-name="turtle-servlet"/>

</web-app>

Thank you again.
[ February 22, 2005: Message edited by: Tom Griffith ]
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
<ejb-server>
<jndi-name>java:comp/env/cmp</jndi-name>
<data-source>java:comp/env/jdbc/test</data-source>
</ejb-server>


The tag <ejb-server> has replaced old <resource-ref> tag. Its for ejb server configuration. http://www.caucho.com/resin-3.0/features/resin-3.0.0.xtp#ejb-server-configuration

I found an example with old tag to specify EJBServer class in this tag.

<resource-ref res-ref-name='java:comp/env/cmp'
class-name='com.caucho.ejb.EJBServer'>
</resource-ref>

on this link : http://www.x-site.jp/cmp/ejb-tut/ejb-hello.xtp


I couldn't open the dtd file, so don't know how you can use <ejb-server> to specify the caucho EJBServer class. But I suppose instead of specifying
jndi-name of cmp bean with datasource ref, you need to specify EJBServer class.
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
Hi Dmanjit. There is so much contradictory stuff out there on resin. Looking at the error, it seems to a hack like me that the current tagging suffices because the error message explicitly states the com.caucho.ejb.EJBServer class...ie, the compiler seems to know what it's looking for without the "old" class-name attribute. I don't know if I'm missing some kinda jar?...maybe?...I don't see how becasue I compiled the interfaces and the bean class without problems. I'll check out your suggestion...but like you said, I've never seen an attribute with the "new" <ejb-server> tag that is the equivalent of class-name.
[ February 22, 2005: Message edited by: Tom Griffith ]
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
oh yeah, this is what I was using as a primary resin web.xml cmp reference thanks to following your link from the other day...

http://www.caucho.com/resin-3.0/cmp/ejb-server.xtp

it seems pretty straight forward. There isn't any kinda equivalent attribute for the class-name.
[ February 22, 2005: Message edited by: Tom Griffith ]
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
Ok Lets take another attempt, if still the problem is unsolved. May be you need to specify value for <ejb-config-dir> in <ejb-server> tag in case all ejb's are not in default i.e. WEB-INF folder. It might not able to instantiate the class because of some properties are not able to get initialized properly.
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
http://www.caucho.com/resin-3.0/cmp/ejb-server.xtp#The-EJBServer-resource
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
Hi Damanjit. Thank you again. I've tried it all to no avail. The attributes are kinda moot anyways, the compiler is bombing right when it hits the <ejb-server> tag. It's like a jar with the ejbserver driver/classes or something didn't come with the resin download. I even tried to dump all jar's from the resin default lib into the war's lib and it did nothing...same error.
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 275
Welp, I;ve downloaded resin 3.0.11 and now it compiles. Now I have something wrong with my SQL but at least the servlet displays. Geesh, I lost about a week on this. Thanks again Dmanjit, it would have been weeks more without your help and your time.
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
Please don't bombard me with lots of thanx.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: web.xml