aspose file tools*
The moose likes JBoss/WildFly and the fly likes Data Source Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Data Source" Watch "Data Source" New topic
Author

Data Source

DVVN Sudhakara Rao
Greenhorn

Joined: Oct 04, 2004
Posts: 17
Hi,
I am trying to configure Datasource for my applicaiton.I am using struts. My Jboss version is 3.2.5. I am using postgres. I place my postgres jdbc driver in server/defafult/deploy/lib.
My Struts-config.xml file is as below.
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="userDB">
<set-property
property="driverClassName"
value="org.postgresql.Driver" />
<set-property
property="url"
value="jdbc ostgresql://192.168.1.25:5432/sudhakar" />
<set-property
property="username"
value="postgres" />
<set-property
property="password"
value="postgres" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="true" />
<set-property
property="defaultReadOnly"
value="false" />
</data-source>
</data-sources>

<form-beans>
<form-bean
name="loginForm"
type="com.wiley.LoginForm"/>
<form-bean
name="employeeForm"
type="com.wiley.EmployeeForm"/>
</form-beans>

<global-forwards>
<forward name="login" path="/login.jsp"/>
</global-forwards>

<action-mappings type="com.wiley.EmployeesActionMapping">

<action
path="/Login"
type="com.wiley.LoginAction"
name="loginForm"
input="/login.jsp"
validate="true"
scope="request">

<forward name="success" path="/EmployeeList.do"/>
</action>

<action
path="/EmployeeList"
type="com.wiley.EmployeeListAction"
scope="request">

<set-property property="loginRequired" value="true"/>
<forward name="success" path="/employeelist.jsp"/>
</action>

<action
path="/Edit"
type="com.wiley.GetEmployeeAction"
name="employeeForm"
scope="request"
validate="false">

<set-property property="loginRequired" value="true"/>
<forward name="success" path="/editemployee.jsp"/>
<forward name="error" path="/EmployeeList.do"/>
</action>

<action
path="/EditEmployee"
type="com.wiley.EditEmployeeAction"
name="employeeForm"
scope="request"
validate="true">

<set-property property="loginRequired" value="true"/>
<forward name="error" path="/editemployee.jsp"/>
<forward name="success" path="/EmployeeList.do"/>
</action>

<action
path="/Delete"
type="com.wiley.DeleteEmployeeAction"
scope="request"
validate="false">

<set-property property="loginRequired" value="true"/>
<forward name="error" path="/EmployeeList.do"/>
<forward name="success" path="/EmployeeList.do"/>
</action>

<action
path="/EditEmployee"
type="com.wiley.EditEmployeeAction"
name="employeeForm"
scope="request"
validate="true">

<set-property property="loginRequired" value="true"/>
<forward name="error" path="/editemployee.jsp"/>
<forward name="success" path="/EmployeeList.do"/>
</action>


</action-mappings>

<message-resources parameter="application" />
<!--
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
-->
</struts-config>

My postgres-ds.xml is as follows.
<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: postgres-ds.xml,v 1.1.2.1 2003/09/05 16:38:24 patriot1burke Exp $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Postgres -->
<!-- ==================================================================== -->


<datasources>
<local-tx-datasource>
<jndi-name>PostgresDS</jndi-name>
<connection-url>jdbc ostgresql://192.168.1.25:5432/sudhakar</connection-url>;
<driver-class>org.postgresql.Driver</driver-class>
<user-name>postgres</user-name>
<password>postgres</password>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->

<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->

</local-tx-datasource>

</datasources>

I am getting the follwing error.
java.lang.NoClassDefFoundError: org/apache/struts/util/GenericDataSource

Can Any body explain why I am getting this error.
Thanks in Advance
Nicolas Taillepied
Greenhorn

Joined: Jul 23, 2004
Posts: 8
Hi,
Have you got struts.jar in your classpath ?
If you don't, you have to download jakarta-struts from
http://struts.apache.org/download.cgi
Hope that's helpfull
Nicolas
DVVN Sudhakara Rao
Greenhorn

Joined: Oct 04, 2004
Posts: 17
Hi Nicolas
I already have struts.jar in my classpath.
C:\jboss-3.2.5\server\default\deploy\Sample.war\WEB-INF\lib
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by DVVN Sudhakara Rao:
Hi Nicolas
I already have struts.jar in my classpath.
C:\jboss-3.2.5\server\default\deploy\Sample.war\WEB-INF\lib


Since you have put the struts jar inside of web application it is available only to sample.war web application and not to JBOSS that deploys the ds file. I suggest you to move the jar file to $JBOSS_HOME/server/default/lib dir.


Groovy
DVVN Sudhakara Rao
Greenhorn

Joined: Oct 04, 2004
Posts: 17
Hi Pradeep,
I tried your suggestion. But still I am getting the same problem.
 
Consider Paul's rocket mass heater.
 
subject: Data Source