cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Götz Botterweck <botte...@uni-koblenz.de>
Subject ESQL producing incorrect code: "Duplicate variable declaration: PoolBrokerService"
Date Wed, 16 May 2001 22:00:28 GMT
I'm trying to use the ESQL logicsheet, but get a java compilation error
as output. Somehow the logicsheet is producing illegal java code.

Below you find
(1) the XSP file
(2) the output I receive in my webbrowser
(3) the java source code that was generated from the XSP file

Of course I can see that (3) contains illegal java code (duplicate
declaration of variable, duplicate declaration of innner class).

But what can I do about that:
Where is the code for establishing a db-connection produced twice?
Do I have to change some settings in cocoon.properties?

Thanks a LOT for any suggestions.
Goetz



----- (1) XSP-FILE ---------------------------
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?xml-logicsheet
href="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?>
<xsp:page language="java" xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
	<page>
		<esql:execute-query>
			<esql:driver>postgresql.Driver</esql:driver>
	
<esql:dburl>jdbc:postgresql://server/database</esql:dburl>
			<esql:username>test</esql:username>
			<esql:password>test</esql:password>
			<esql:query>select * from table</esql:query>
			<esql:results>
					<name>
						<esql:get-string
column="name"/>
					</name>
			</esql:results>
		</esql:execute-query>
	</page>
</xsp:page>
----- (2) OUTPUT IN WEBBROWSER ---------------------------
java.lang.Exception: XSP Java Compiler: Compilation failed for
_esql.java
103: Duplicate variable declaration: PoolBrokerService _esql_pool was
PoolBrokerService _esql_pool

          static PoolBrokerService _esql_pool =
PoolBrokerService.getInstance();
                                              ^
106: Class _C_._apps._tomcat_3_2_1._webapps._cocoon._postgres._esql.
EsqlConnection already defined in
C:\apps\tomcat-3.2.1\bin\repository\_C_\_apps\_tomcat_3_2_1\_webapps\_co
coon\_postgres\_esql.java.

      class EsqlConnection {
            ^
106: Duplicate inner class declaration: nested type
_C_._apps._tomcat_3_2_1._webapps._cocoon._postgres._esql. EsqlConnection
is already defined in this scope.

      class EsqlConnection {
            ^
116: Class _C_._apps._tomcat_3_2_1._webapps._cocoon._postgres._esql.
EsqlQuery already defined in
C:\apps\tomcat-3.2.1\bin\repository\_C_\_apps\_tomcat_3_2_1\_webapps\_co
coon\_postgres\_esql.java.

      class EsqlQuery {
            ^
116: Duplicate inner class declaration: nested type
_C_._apps._tomcat_3_2_1._webapps._cocoon._postgres._esql. EsqlQuery is
already defined in this scope.

      class EsqlQuery {
            ^
5 errors

	at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(X
SPJavaProcessor.java:146)
	at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:5
22)
	at org.apache.cocoon.Engine.handle(Engine.java:384)
	at org.apache.cocoon.Cocoon.service(Cocoon.java:183)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
	at org.apache.tomcat.core.Handler.service(Handler.java:286)
	at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.jav
a:797)
	at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(H
ttpConnectionHandler.java:210)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416
)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:49
8)
	at java.lang.Thread.run(Thread.java:484)

----- (3) JAVA CODE ---------------------------

    package _C_._apps._tomcat_3_2_1._webapps._cocoon._postgres;

    import java.io.*;
    import java.net.*;
    import java.util.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    import org.apache.cocoon.parser.*;
    import org.apache.cocoon.producer.*;
    import org.apache.cocoon.framework.*;

    import org.apache.cocoon.processor.xsp.*;
    import org.apache.cocoon.processor.xsp.library.*;

    /* User Imports */
    
      import java.sql.DriverManager;
      import java.sql.Connection;
      import java.sql.Statement;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.ResultSetMetaData;
      import java.sql.SQLException;
      import java.text.SimpleDateFormat;
      import java.text.DecimalFormat;
      import java.io.StringWriter;
      import java.io.PrintWriter;
      import org.apache.turbine.services.db.PoolBrokerService;
      import org.apache.turbine.util.db.pool.DBConnection;
      import java.sql.DriverManager;
      import java.sql.Connection;
      import java.sql.Statement;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.ResultSetMetaData;
      import java.sql.SQLException;
      import java.text.SimpleDateFormat;
      import java.text.DecimalFormat;
      import java.io.StringWriter;
      import java.io.PrintWriter;
      import org.apache.turbine.services.db.PoolBrokerService;
      import org.apache.turbine.util.db.pool.DBConnection;
    

    public class _esql extends XSPPage {
      /* User Class Declarations */
      
          static PoolBrokerService _esql_pool =
PoolBrokerService.getInstance();
        
      
      class EsqlConnection {
        
            DBConnection db_connection = null;
          
        
        Connection connection = null;
        String dburl = null;
        String username = null;
        String password = null;
      }
      class EsqlQuery {
        String query;
        Statement statement;
        PreparedStatement prepared_statement;
        ResultSet resultset;
        ResultSetMetaData resultset_metadata;
        /** the position of the current row in the resultset **/
        int position = -1;
        int max_rows = -1;
        int skip_rows = 0;
        boolean results;
      }
    
          static PoolBrokerService _esql_pool =
PoolBrokerService.getInstance();
        
      
      class EsqlConnection {
        
            DBConnection db_connection = null;
          
        
        Connection connection = null;
        String dburl = null;
        String username = null;
        String password = null;
      }
      class EsqlQuery {
        String query;
        Statement statement;
        PreparedStatement prepared_statement;
        ResultSet resultset;
        ResultSetMetaData resultset_metadata;
        /** the position of the current row in the resultset **/
        int position = -1;
        int max_rows = -1;
        int skip_rows = 0;
        boolean results;
      }
    

      public void populateDocument(
...
(REST OF CODE DELETED)

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

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


Mime
View raw message