facebook

in Struts config created with wrong valu

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #264572 Reply

    Struts config editor does not create <data-source> with proper keys and attributes. It is missing the following:
    1. Attribute type is mandatory for <data-source> element. Struts config editor shows the value of type as org.apache.struts.util.GenericDataSource however, when it creates the configuration in the .xml file it eats it up so there is no type.
    2. Nested property for driver class in <data-source> element is misspelled. It is not driverClass rather driverClassName.

    Both of this causes the datasource to fail.

    Kam

    #264573 Reply

    Here is a sample that it creates

    <data-source key=”org.apache.struts.action.DATA_SOURCE”>
    <set-property property=”minCount” value=”3″ />
    <set-property property=”password” value=”xxxxxx” />
    <set-property property=”maxCount” value=”10″ />
    <set-property property=”user” value=”myusr” />
    <set-property property=”driverClass” value=”org.postgresql.Driver” />
    <set-property property=”description” value=”PostgreSQL Driver” />
    <set-property property=”url” value=”jdbc:postgresql://localhost:5432/mydb” />
    <set-property property=”autoCommit” value=”false” />
    <set-property property=”readOnly” value=”false” />
    <set-property property=”loginTimeout” value=”100″ />
    </data-source>

    Additionally I noticed that the property user is also incorrect, it should be user. Here is the corrected version of the above that your tool should create:
    <data-source key=”org.apache.struts.action.DATA_SOURCE”
    type=”org.apache.tomcat.dbcp.dbcp.BasicDataSource”>
    <set-property property=”password” value=”xxxx” />
    <set-property property=”minCount” value=”3″ />
    <set-property property=”maxCount” value=”10″ />
    <set-property property=”username” value=”myusr” />
    <set-property property=”driverClassName”
    value=”org.postgresql.Driver” />
    <set-property property=”description”
    value=”PostgreSQL Driver” />
    <set-property property=”url”
    value=”jdbc:postgresql://localhost:5432/mydb” />
    <set-property property=”readOnly” value=”false” />
    <set-property property=”autoCommit” value=”false” />
    <set-property property=”loginTimeout” value=”1000″ />
    </data-source>

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: in Struts config created with wrong valu

You must be logged in to post in the forum log in