You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Volker Schneider <vo...@danet.de> on 2002/11/13 12:52:58 UTC

Just another bug with Cocoon 2.0.2

Dear colleagues,

within Cocoon 2.0.2 I've found another bug which causes a class cast
exception. Maybe it is fixed in Cocoon 2.0.3 but I'm not able to find the
class in the cocoon code repository. If not, please fix it.

If you use a form with

<form method="post" enctype="multipart/form-data" ...>

and you will use an array of checkboxes (<input type="checkbox"...) with
equal names, but different values, you only can select one checkbox. If you
select more than one checkbox and try to get the parameters via
getParameterValues() you will get a class cast excpetion.

This was a bug in the getParameterValues() method in class
"MultipartRequestWrapper.java":

    public String[] getParameterValues(String name) {

        if (values != null)
        {
          Object value = get(name);

          if (value != null)
          {
            if (value instanceof Vector)
            {
              //---- Bug fix (class cast exception)
              //old code:
              //return (String[]) ((Vector) value).toArray();

              //---- begin bug fix
              Vector theVector = (Vector)value;
              String[] theArray = new String[theVector.size()];
              for (int i=0; i<theArray.length; i++)
              {
              	theArray[i] = (String)theVector.elementAt(i);
              }

              return theArray;
              //---- end bug fix
            }
            else
            {
              return new String[]{value.toString()};
            }
          }

          return null;
        }
        else
        {
          return request.getParameterValues(name);
        }
      }

Best regards
- Volker -


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Trying to use PostgresSQL with Cocoon-2.0.2

Posted by Martin Holz <ho...@fiz-chemie.de>.
Hi,

On Wednesday 13 November 2002 21:11, Simon Elbaz wrote:
> I am trying to use a PostgreSQL with Cocoon-2.0.2, JDK-1.4. I have
> downloaded the PostgreSQL driver pgjdbc2.jar for Java-1.4. The connection
> between Tomcat-4.0.3/postgresql  at the startings done (started the
> postgresql server with -i option).
>

> HttpProcessor[10500][4]/LogKitLogger: Could not return Connection
> java.lang.ClassCastException:
> org.apache.avalon.excalibur.datasource.Jdbc3Connection at
> org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcConnectionPool.n
>ewPoolable(ResourceLimitingJdbcConnectionPool.java:81)

Looks like excalibur datasource expects a JDBC 3 driver.
Your driver supports JDBC2 only.

Try http://jdbc.postgresql.org/download/pg73b3jdbc1.jar
I did not yet tested it with cocoon, but it works fine with other
programs.

Martin

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Trying to use PostgresSQL with Cocoon-2.0.2

Posted by Simon Elbaz <si...@free.fr>.
Hi,
I am trying to use a PostgreSQL with Cocoon-2.0.2, JDK-1.4. I have downloaded the PostgreSQL driver pgjdbc2.jar for Java-1.4.
The connection between Tomcat-4.0.3/postgresql  at the startings done (started the postgresql server with -i option).
When I try to launch the Simple SQL sample, here is what i am getting:

>ps -ef | grep postgres

postgres   142     1  0 09:35 ?        00:00:00 /usr/local/pgsql/bin/postmaster -iS
postgres   143   142  0 09:35 ?        00:00:00 postgres: stats buffer process    
postgres   144   143  0 09:35 ?        00:00:00 postgres: stats collector process   
postgres  3489   142  0 20:53 ?        00:00:00 [postmaster]
postgres  3500   142  0 20:54 ?        00:00:00 [postmaster]
postgres  3532   142  0 21:02 ?        00:00:00 postgres: simon test 127.0.0.1 idle
postgres  3535   142  0 21:02 ?        00:00:00 postgres: simon test 127.0.0.1 idle
postgres  3536   142  1 21:02 ?        00:00:00 postgres: simon test 127.0.0.1 idle

web.xml
-------

    <init-param>
      <param-name>load-class</param-name>
      <param-value>
        <!-- For IBM WebSphere:
        com.ibm.servlet.classloader.Handler -->

        <!-- For Database Driver: -->
        org.postgresql.Driver

        <!-- For parent ComponentManager sample:
        org.apache.cocoon.samples.parentcm.Configurator
        -->
      </param-value>
    </init-param>

cocoon.xconf
------------
  <!-- Datasources: -->
  <datasources>
    <jdbc logger="core.datasources.personnel" name="personnel">
      <!--
          If you have an Oracle database, and are using the the
      pool-controller below, you should add the attribute
      "oradb" and set it to true.

      <pool-controller min="5" max="10" oradb="true"/>

      That way the test to see if the server has disconnected
      the JdbcConnection will function properly.
      -->
      <pool-controller max="10" min="5"/>
      <!--
          If you need to ensure an autocommit is set to true or
      false, then create the "auto-commit" element below.

      <auto-commit>false</auto-commit>

      The default is true.
      -->
      <dburl>jdbc:postgresql://127.0.0.1/test</dburl>
<user>simon</user>
<password>simon123</password>
    </jdbc>
  </datasources>

sitemap.log
-----------

DEBUG   (2002-11-11) 21:36.08:593   [sitemap.transformer.sql] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/SQLTransformer: RECEIVED END ELEMENT execute-query(http://apache.org/cocoon/SQL/2.0)
DEBUG   (2002-11-11) 21:36.08:596   [sitemap.transformer.sql] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/SQLTransformer: SQLTransformer executing query nr 0
DEBUG   (2002-11-11) 21:36.08:641   [sitemap.transformer.sql] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/SQLTransformer$Query: EXECUTING
        select id,name from department

	DEBUG   (2002-11-11) 21:36.12:296   [sitemap.transformer.sql] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/SQLTransformer$Query: SQLTransformer$Query: could not acquire a Connection -- waiting 5000 ms to try again.
	DEBUG   (2002-11-11) 21:36.22:343   [sitemap.transformer.sql] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/SQLTransformer$Query: SQLTransformer$Query: could not acquire a Connection -- waiting 5000 ms to try again.
	DEBUG   (2002-11-11) 21:36.31:123   [sitemap.transformer.sql] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/SQLTransformer$Query: SQLTransformer$Query: could not acquire a Connection -- waiting 5000 ms to try again.

core.log
--------
DEBUG   (2002-11-11) 21:36.03:449   [core.event-pipeline] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/CachingEventPipeline: Caching content for further requests of 'sql/sql-page'.
DEBUG   (2002-11-11) 21:36.09:022   [core.datasources.personnel] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/LogKitLogger: Marking 0 objects as old in pool.
DEBUG   (2002-11-11) 21:36.10:565   [core.datasources.personnel] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/LogKitLogger: JdbcConnection object created
WARN    (2002-11-11) 21:36.10:975   [core.datasources.personnel] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/LogKitLogger: Could not return Connection
java.lang.ClassCastException: org.apache.avalon.excalibur.datasource.Jdbc3Connection
        at org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcConnectionPool.newPoolable(ResourceLimitingJdbcConnectionPool.java:81)
        at org.apache.avalon.excalibur.pool.ResourceLimitingPool.get(ResourceLimitingPool.java:314)
        at org.apache.avalon.excalibur.pool.ValidatedResourceLimitingPool.get(ValidatedResourceLimitingPool.java:91)
        at org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource.getConnection(ResourceLimitingJdbcDataSource.java:131)
        at org.apache.cocoon.transformation.SQLTransformer$Query.getConnection(SQLTransformer.java:951)
        at org.apache.cocoon.transformation.SQLTransformer$Query.execute(SQLTransformer.java:1007)
        at org.apache.cocoon.transformation.SQLTransformer.executeQuery(SQLTransformer.java:271)
        at org.apache.cocoon.transformation.SQLTransformer.endExecuteQueryElement(SQLTransformer.java:417)
        at org.apache.cocoon.transformation.SQLTransformer.endElement(SQLTransformer.java:702)
        at org.apache.cocoon.components.sax.XMLTeePipe.endElement(XMLTeePipe.java:124)
        at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
        at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
        at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1204)
        at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
        at org.apache.avalon.excalibur.xml.JaxpParser.parse(JaxpParser.java:241)
        at org.apache.cocoon.components.source.AbstractStreamSource.toSAX(AbstractStreamSource.java:206)
        at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:142)
        at org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEventPipeline.java:251)
        at org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingStreamPipeline.java:399)
        at org.apache.cocoon.www.sitemap_xmap.matchN107F0(/usr/src/jakarta-tomcat-4.0.3/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/sitemap_xmap.java:10025)
        at org.apache.cocoon.www.sitemap_xmap.process(/usr/src/jakarta-tomcat-4.0.3/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/sitemap_xmap.java:3687)
        at org.apache.cocoon.www.sitemap_xmap.process(/usr/src/jakarta-tomcat-4.0.3/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/sitemap_xmap.java:3085)
        at org.apache.cocoon.sitemap.Handler.process(Handler.java:222)
        at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179)
        at org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:154)
        at org.apache.cocoon.Cocoon.process(Cocoon.java:575)
        at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:998)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
        at java.lang.Thread.run(Thread.java:536)
DEBUG   (2002-11-11) 21:36.22:316   [core.datasources.personnel] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/LogKitLogger: JdbcConnection object created
WARN    (2002-11-11) 21:36.22:319   [core.datasources.personnel] (/cocoon/sql/sql-page) HttpProcessor[10500][4]/LogKitLogger: Could not return Connection
java.lang.ClassCastException: org.apache.avalon.excalibur.datasource.Jdbc3Connection
        at org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcConnectionPool.newPoolable(ResourceLimitingJdbcConnectionPool.java:81)

Can you help me please ?

Regards,
Simon Elbaz


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Just another bug with Cocoon 2.0.2

Posted by Joerg Heinicke <jo...@gmx.de>.
As you can see at 
http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/java/org/apache/cocoon/components/request/multipart/MultipartRequestWrapper.java?only_with_tag=cocoon_2_0_3_branch 
this bug is fixed since version 1.2 of the file (05.04.2002).

Regards,

Joerg

Volker Schneider wrote:
> Dear colleagues,
> 
> within Cocoon 2.0.2 I've found another bug which causes a class cast
> exception. Maybe it is fixed in Cocoon 2.0.3 but I'm not able to find the
> class in the cocoon code repository. If not, please fix it.
> 
> If you use a form with
> 
> <form method="post" enctype="multipart/form-data" ...>
> 
> and you will use an array of checkboxes (<input type="checkbox"...) with
> equal names, but different values, you only can select one checkbox. If you
> select more than one checkbox and try to get the parameters via
> getParameterValues() you will get a class cast excpetion.
> 
> This was a bug in the getParameterValues() method in class
> "MultipartRequestWrapper.java":
> 
>     public String[] getParameterValues(String name) {
> 
>         if (values != null)
>         {
>           Object value = get(name);
> 
>           if (value != null)
>           {
>             if (value instanceof Vector)
>             {
>               //---- Bug fix (class cast exception)
>               //old code:
>               //return (String[]) ((Vector) value).toArray();
> 
>               //---- begin bug fix
>               Vector theVector = (Vector)value;
>               String[] theArray = new String[theVector.size()];
>               for (int i=0; i<theArray.length; i++)
>               {
>               	theArray[i] = (String)theVector.elementAt(i);
>               }
> 
>               return theArray;
>               //---- end bug fix
>             }
>             else
>             {
>               return new String[]{value.toString()};
>             }
>           }
> 
>           return null;
>         }
>         else
>         {
>           return request.getParameterValues(name);
>         }
>       }
> 
> Best regards
> - Volker -


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>