*
The moose likes Struts and the fly likes Struts+Weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts+Weblogic" Watch "Struts+Weblogic" New topic
Author

Struts+Weblogic

vikas mishra
Greenhorn

Joined: Jan 28, 2004
Posts: 26
Hi
I am new to struts , i trying to connect with oracle useing datasource
and i m getting follwoing error.

Error 503--Service Unavailable

javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE
at org.apache.struts.action.ActionServlet.initModuleDataSources(Lorg.apache.struts.config.ModuleConfig V(ActionServlet.java:1091)
at org.apache.struts.action.ActionServlet.init()V(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(Ljavax.servlet.ServletConfig V(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run()Ljava.lang.Object;(ServletStubImpl.java:1018)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction Ljava.lang.Object;(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction Ljava.lang.Object;(SecurityManager.java:118)
at weblogic.servlet.internal.ServletStubImpl.createServlet()Ljavax.servlet.Servlet;(ServletStubImpl.java:894)
at weblogic.servlet.internal.ServletStubImpl.createInstances()V(ServletStubImpl.java:873)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(Lweblogic.servlet.internal.RequestCallback V(ServletStubImpl.java:812)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(Ljava.lang.String V(WebAppServletContext.java:3281)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets()V(WebAppServletContext.java:3226)
at weblogic.servlet.internal.WebAppServletContext.preloadResources()V(WebAppServletContext.java:3207)
at weblogic.servlet.internal.WebAppServletContext.setStarted(Z)V(WebAppServletContext.java:5737)
at weblogic.servlet.internal.WebAppModule.start()V(WebAppModule.java:874)
at weblogic.j2ee.J2EEApplicationContainer.start([Lweblogic.j2ee.J2EEApplicationContainer$Component V(J2EEApplicationContainer.java:2106)
at weblogic.j2ee.J2EEApplicationContainer.activate([Lweblogic.management.configuration.ComponentMBean V(J2EEApplicationContainer.java:2147)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer()V(SlaveDeployer.java:2434)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit()V(SlaveDeployer.java:2352)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit()V(SlaveDeployer.java:2136)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit()V(SlaveDeployer.java:2235)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare()V(SlaveDeployer.java:2130)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare()V(SlaveDeployer.java:2315)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Lweblogic.management.deploy.OamVersion;Lweblogic.management.runtime.DeploymentTaskRuntimeMBean;Z)V(SlaveDeployer.java:866)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(Lweblogic.management.deploy.OamDelta;Lweblogic.management.deploy.OamVersion;ZLjava.lang.StringBuffer Z(SlaveDeployer.java:594)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(Ljava.util.ArrayList;Z)V(SlaveDeployer.java:508)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(Lweblogic.kernel.ExecuteThread V(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread V(Unknown Source)




my datasource declaration is ...

<data-sources>

<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<set-property property="url" value="jdbc racle:thin:@192.168.5.199:1521:test" />
<set-property property="username" value="sys" />
<set-property property="password" value="sys" />
<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 COUNT(*) FROM testtable" />
</data-source>

</data-sources>
candy tang
Greenhorn

Joined: May 16, 2005
Posts: 2
Hi,maybe your struts-config.xml is wrong, looe mine:

<data-sources>
<data-source key="oracleDB1">
<set-property property="driverClass"
value="oracle.jdbc.driver.OracleDriver" />
<set-property property="url"
value="jdbc racle:thin:@127.0.0.1:1521:xdf" />
<set-property property="maxCount"
value="5"/>
<set-property property="minCount"
value="1"/>
<set-property property="user"
value="scott"/>
<set-property property="password"
value="ggg"/>
<set-property property="autoCommit"
value="true"/>
</data-source>
</data-sources>


Beyond me if you can!
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

hi even i am using the weblogic with struts 1.2.4 but i had created a data source conn pool in web logic console .
Do u think if u create a data source rather than thin driver ,do we hava any advantage???.
if yes let me know....
Only i will configuring everthing in console rather than config xml file...
Thx
-Gowtham G R
gowtham@eprosoft.com
grgowtham_cse@yahoo.com
[ May 19, 2005: Message edited by: Gowtham Ganamukala ]

Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Take a look at Struts - How to Access a Database, it doesn't look like they recommend using theirs. You should be able to create connection pool and datasource in weblogic and get the datasource using JNDI lookup and get connection from datasource. http://e-docs.bea.com


NOTE: It is preferred that data connectivity be handled directly by the business classes, usually via JNDI. The Struts DataSource manager should only be used with legacy business classes that don't provide their own connectivity. When possible, we strongly recommend use of the standard DAO pattern, so that the Action classes do not need to know anything about the persitence mechanism. The DataSource manager is being retained in Struts 1.x for backward compatibility but may not be retained in Struts 2.x or later.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts+Weblogic