Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Struts datasource

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this datasource set up in my struts config, running JBoss 4.0.4, and on starting the server I am getting the below error.

From what I can see from the error I might have the details of the datasource incorrect, so can someone tell me what is supposed to go where? I am on Oracle 9i.

This property should it be host :p ort atabase?

This property would be my service name in Oracle
<set-property property="username" value="BIZZ_COOP" />





Thanks for reading

cheers
Martin
[ June 23, 2006: Message edited by: Martin Thorpe ]
 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok after a lot of googling and messing around I got it to work like below.

This is a connection to a remote database, the main thing is using directly the connection string.

I am running JBoss 4.0.4 and in the server statup it shows that it is setting the servlet to not available because the connection to the database was refused.

Now the main problem with me was connecting remotley and my Oracle TNS not configured correctly, it is corrupt locally so having real problems with that.

The way it was sorted in the end was using a connection string to directly connect to Oracle

This is my struts-config datasource, the URL property is where all the action is:


Also make sure you have these classes visible to the server; I have mine in the WEB-INF/lib directory:

The last 2 are Oracle specific I think.

commons-pool-1.3.jar
commons-collections-3.2.jar
jdbc2_0-stdext.jar
classes12.jar
[ June 23, 2006: Message edited by: Martin Thorpe ]
 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello no I did not configure the oracle-ds.xml file where is this file found? All the connection information is in the string in the struts datasource.

What is happening that it is not working, any error? And what have you got set up in these properties in your struts-config:


cheers
Martin


Gerardo Casazza
greenhorn
Member # 129962 posted July 26, 2006 02:09 AM
--------------------------------------------------------------------------------
thank you martin, sorry if i bother you once again but my connection is not working yet, did you configure the oracle-ds.xml?

thank you

Gerardo Casazza
greenhorn
Member # 129962 posted July 25, 2006 11:11 AM
--------------------------------------------------------------------------------
Hi I read your post about oracle connection, i tried to do the same
i included classes12.jar where can i get the other jars
(commons-pool-1.3.jar, commons-collections-3.2.jar, jdbc2_0-stdext.jar) ?

thank you
--------------------------------------------------------------------------------
Posts: 0 | Registered: Jul 2006

Martin Thorpe
ranch hand
Member # 73745 posted July 26, 2006 01:30 AM
--------------------------------------------------------------------------------
Hello you will find them all in this list:

http://jakarta.apache.org/commons/components.html

cheers
Martin
[ July 26, 2006: Message edited by: Martin Thorpe ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martin,

here my data source, i'm using jboss 4.04 and oracle 8.1.6

<data-source key="myKey" type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<set-property property="url" value="jdbc racle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=1521))(CONNECT_DATA=(SID=mySid)))" /><set-property property="username" value="myUser" />
<set-property property="password" value="myPassword" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
<set-property property="validationQuery" value="SELECT SYSDATE FROM DUAL" />
</data-source>

thank you
 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That all looks fine to me, obviously I don't know if you host is correct, I found using the actual IP address to be more effective.

Do you have your Oracle on the standard 1521 port?

Other than that what is the problem do you get an error or?

Can you connect to the database from the machine you are setting up the web app on.

cheers
Martin
 
Gerardo Casazza
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martin,

oracle configuration is standard and it's ok (i use oracle connections from other application, moreover using myeclipse db explorer i was able to connect to oracle). I paste a part of the log

11:01:27,265 ERROR [ActionServlet] Initializing application data source bizzCoop
java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207)
at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1081)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)

thanks
 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well that error is saying that you do not have the class to run a basic datasource.
Do you have this JAR in your WEB-INF/lib directory:

commons-dbcp-versionNumber.jar

obviously versionNumber in the above would be a number.

You can get it from here:
http://jakarta.apache.org/commons/dbcp/

cheers
Martin
 
Gerardo Casazza
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i included all the library in my web-inf/lib....i configured the data source with the myeclipse editor and now i get the connection

thanks for your support
 
Martin Thorpe
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem I am glad it works.

cheers
Martin
 
reply
    Bookmark Topic Watch Topic
  • New Topic