• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Data Source

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nicolas
I already have struts.jar in my classpath.
C:\jboss-3.2.5\server\default\deploy\Sample.war\WEB-INF\lib
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
DVVN Sudhakara Rao
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pradeep,
I tried your suggestion. But still I am getting the same problem.
reply
    Bookmark Topic Watch Topic
  • New Topic