You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lars Huttar <la...@sil.org> on 2003/10/20 22:50:09 UTC

"The declared package does not match the expected package"?

Hi all,
I'm having a problem that I wasn't having a short time ago.
This morning the URL request http://localhost:8080/cocoon-2.1.2/mount/Ethnologue/checks/list-tables
worked fine. Now it gives me this error:

Failed to execute pipeline.

org.apache.cocoon.ProcessingException: Failed to execute pipeline.: java.lang.RuntimeException:
org.apache.cocoon.ProcessingException: Language Exception:
org.apache.cocoon.components.language.LanguageException: Error compiling count_rows_xsp: ERROR 1
(org\apache\cocoon\www\mount\ethnologue\sources\count_rows_xsp.java): ... // start error (lines
3-3) "The declared package does not match the expected package
org.apache.cocoon.www.mount.ethnologue.sources" package
org.apache.cocoon.www.mount.Ethnologue.sources; // end error import java.io.File; import
java.io.IOException; import java.io.StringReader; ... Line 3, column 0: The declared package does
not match the expected package org.apache.cocoon.www.mount.ethnologue.sources


I don't think I changed *anything* in between. Except that I added
some Microsoft SQL - JDBC driver .jar's into Tomcat 4.1\common\lib.
And I took them out again to see if that could by some wild stretch
be the problem. No difference.

I'm running Cocoon 2.1.2.

Any ideas about what the above error *means*? I couldn't
find it in the Cocoon sources.

Here's the file ethnologue/sources/count-rows.xsp:

<?xml version="1.0" encoding="UTF-8"?>
<!-- count-rows?table=___
     Output <table name="table-parameter" count="num of rows" />
     L. Huttar, Aug 2003
-->
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-request="http://apache.org/xsp/request/2.0" xmlns:esql="http://apache.org/cocoon/SQL/v2">
  <table>
    <esql:connection>
      <esql:pool>ethnolog</esql:pool>
      <esql:execute-query>
        <esql:query>
  SELECT count(*) TOTAL FROM <xsp-request:get-parameter name="table"/>
        </esql:query>
        <esql:results>
          <esql:row-results>
            <name>
              <xsp-request:get-parameter name="table" />
            </name>
            <count>
              <esql:get-string column="TOTAL" />
            </count>
          </esql:row-results>
        </esql:results>
      </esql:execute-query>
    </esql:connection>
  </table>
</xsp:page>


Here's the relevant ethnologue/sitemap.xmap section:
      <map:match pattern="checks/list-columns">
        <map:generate src="sources/ethnologue-schema.xml"/>
        <!-- Generate cinclude statements for checks/count-columns from <table> elements. -->
        <map:transform src="transforms/list-columns-cinclude.xsl" type="xslt-with-parameters"
label="raw"/>
        <!-- Process cinclude statements. -->
        <map:transform type="cinclude" label="raw2"/>
        <!-- Transform XML data into formatted (x)html. -->
        <map:transform src="styles/list-columns.xsl" type="xslt-with-parameters" />
        <map:serialize/>
      </map:match>


Here's what cinclude is receiving (I.e. the view at cocoon-view=raw)

<tables>
<cinclude:include src="cocoon:/checks/count-rows?table=Development_Status"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Development_Type"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Ethnologue_Continent"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Ethnologue_Country"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Function_in_Country"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Identified_Language"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Language_Contact"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Language_Function"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Language_in_Country"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Writing_Script"/>
<cinclude:include src="cocoon:/checks/count-rows?table=Writing_System"/>
</tables>

Thanks for any help!

Lars



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


RE: "The declared package does not match the expected package"?

Posted by Lars Huttar <la...@sil.org>.
Hi all,
FYI, in case you run into this kind of mysterious error, here's
what was happening in our case. The problem DID have to do
with the upper/lowercase 'E' in the URL.

When starting up the server (Tomcat) with a new version of Cocoon,
or a clean work/ directory, the first URL request entered caused
compilation of the XSP page according to the case in the URL.
E.g. the URL
   http://mamre/cocoon/mount/Ethnologue/checks/list-tables
going through the Cocoon pipeline invoked
    .../Ethnologue/sources/count-rows.xsp
which got compiled as
    org.apache.cocoon.www.mount.Ethnologue.sources

Then if a later request URL used lowercase,
   http://mamre/cocoon/mount/ethnologue/checks/list-tables
it invoked the same pipeline (because Cocoon in Windows is case-
tolerant I guess), and everything still worked *except* for
the XSP page. Apparently part of the XSP handler thought
the compiled page already existed (or it would have compiled
a second copy), but another part said "No, there's no compiled
XSP page by that name."

So the solution was,
1) Only access the data by the correct URL.
2) If somebody messes things up by making the first access
  with an incorrect URL, you have to shut down Tomcat,
  delete the work directory (or if you're smart maybe you
  can just delete a certain file), and restart Tomcat.

Unresolved issue:
Should this be considered a bug in Cocoon (and/or Tomcat)?
I think so, because Cocoon in Windows is case-insensitive
up to a point, but not completely. The inconsistency is
what makes these problems sneaky.
And even the XSP handling is inconsistent with regard to
case; if it were truly case-sensitive, (I think) it
should have given an error saying there was no such file
as .../Ethnologue/sources/count-rows.xsp, instead of
acting as if the reference to the xsp file was valid but
then choking on its compiled class name.

How it could bite:
Besides the potential for confusing problems such as I
experienced, this behavior leaves the door open for misinformed
or malicious users (or weird browsers) to "break" a Cocoon
system for everybody else, if they happen to be the "first
one in" on any particular URL involving an XSP. They could,
by accident or on purpose, use the "wrong" case, thus creating
a compiled class package whose name was not the one expected;
hence most subsequent users would encounter a mysterious error.

Should I file a bug report? Does anybody have thoughts on
whether this is a bug in Cocoon, Tomcat, or some component thereof?

Lars


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


RE: "The declared package does not match the expected package"?

Posted by Lars Huttar <la...@sil.org>.
Thank you Thank you!!  and God be praised.

That did it. The error is fixed.

I don't really understand why the error occurred,
but knowing that it had to do with compiling the XSP
into Java and having a way to treat the problem
goes a long way!

Lars

> From: Geoff Howard 
> Subject: Re: "The declared package does not match the 
> expected package"?
> 
> Lars Huttar wrote:
> > Geoff,
> > Thanks for your reply.
> > 
> >>From: Geoff Howard
> >>
> >>
> >>>I don't think I changed *anything* in between. Except that I added
> >>>some Microsoft SQL - JDBC driver .jar's into Tomcat 4.1\common\lib.
> >>>And I took them out again to see if that could by some wild stretch
> >>>be the problem. No difference.
> >>
> >>I interpret the above to mean there _was_ a difference.  Now 
> >>it's giving 
> >>you this "does not match expected package" error.  I missed 
> the first 
> >>part of this thread.
> > 
> > 
> > No, that was the first message in the thread...
> > What I meant was, there was no difference between the time before
> > I took out the Microsoft drivers and the time after. In both cases,
> > I got the error.
> > 
> > 
> >>>Here's the file ethnologue/sources/count-rows.xsp:
> >>
> >>I'd guess that the current or earlier version of this was 
> actually in 
> >>Ethnologue/sources/count-rows.xsp.  Is "ethnologue" really 
> lower case 
> >>everywhere?
> > 
> > 
> > Good question. It's actually uppercase in the file system,
> > and it may be that we're referencing it in lowercase, and that
> > works sometimes but not always.
> > So I'll look into that more.
> > 
> > On the other hand, it used to work, and I know I didn't change
> > the case of Ethnologue...
> 
> The specific error you were getting there looked like a 
> compiler error 
> when your xsp was turned into a java class (which is what 
> happens behind 
> the scenes).  The fact that it seemed to work before I can't explain, 
> but you may try stopping the servlet container (tomcat or jetty for 
> example), deleting the work directory (ignore that part for Jetty) and
> restarting Cocoon.  If that makes it work again it'll be a major clue.
> 
> Geoff
> 
> 

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


Re: "The declared package does not match the expected package"?

Posted by Geoff Howard <co...@leverageweb.com>.
Lars Huttar wrote:
> Geoff,
> Thanks for your reply.
> 
> 
>>From: Geoff Howard
>>
>>
>>>I don't think I changed *anything* in between. Except that I added
>>>some Microsoft SQL - JDBC driver .jar's into Tomcat 4.1\common\lib.
>>>And I took them out again to see if that could by some wild stretch
>>>be the problem. No difference.
>>
>>I interpret the above to mean there _was_ a difference.  Now 
>>it's giving 
>>you this "does not match expected package" error.  I missed the first 
>>part of this thread.
> 
> 
> No, that was the first message in the thread...
> What I meant was, there was no difference between the time before
> I took out the Microsoft drivers and the time after. In both cases,
> I got the error.
> 
> 
>>>Here's the file ethnologue/sources/count-rows.xsp:
>>
>>I'd guess that the current or earlier version of this was actually in 
>>Ethnologue/sources/count-rows.xsp.  Is "ethnologue" really lower case 
>>everywhere?
> 
> 
> Good question. It's actually uppercase in the file system,
> and it may be that we're referencing it in lowercase, and that
> works sometimes but not always.
> So I'll look into that more.
> 
> On the other hand, it used to work, and I know I didn't change
> the case of Ethnologue...

The specific error you were getting there looked like a compiler error 
when your xsp was turned into a java class (which is what happens behind 
the scenes).  The fact that it seemed to work before I can't explain, 
but you may try stopping the servlet container (tomcat or jetty for 
example), deleting the work directory (ignore that part for Jetty) and
restarting Cocoon.  If that makes it work again it'll be a major clue.

Geoff


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


RE: "The declared package does not match the expected package"?

Posted by Lars Huttar <la...@sil.org>.
Geoff,
Thanks for your reply.

> From: Geoff Howard
> 
> > I don't think I changed *anything* in between. Except that I added
> > some Microsoft SQL - JDBC driver .jar's into Tomcat 4.1\common\lib.
> > And I took them out again to see if that could by some wild stretch
> > be the problem. No difference.
> 
> I interpret the above to mean there _was_ a difference.  Now 
> it's giving 
> you this "does not match expected package" error.  I missed the first 
> part of this thread.

No, that was the first message in the thread...
What I meant was, there was no difference between the time before
I took out the Microsoft drivers and the time after. In both cases,
I got the error.

> > Here's the file ethnologue/sources/count-rows.xsp:
> 
> I'd guess that the current or earlier version of this was actually in 
> Ethnologue/sources/count-rows.xsp.  Is "ethnologue" really lower case 
> everywhere?

Good question. It's actually uppercase in the file system,
and it may be that we're referencing it in lowercase, and that
works sometimes but not always.
So I'll look into that more.

On the other hand, it used to work, and I know I didn't change
the case of Ethnologue...

Lars


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


Re: "The declared package does not match the expected package"?

Posted by Geoff Howard <co...@leverageweb.com>.
Lars Huttar wrote:
> Hi all,
> I'm having a problem that I wasn't having a short time ago.
> This morning the URL request http://localhost:8080/cocoon-2.1.2/mount/Ethnologue/checks/list-tables
> worked fine. Now it gives me this error:
> 
> Failed to execute pipeline.
> 
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.: java.lang.RuntimeException:
> org.apache.cocoon.ProcessingException: Language Exception:
> org.apache.cocoon.components.language.LanguageException: Error compiling count_rows_xsp: ERROR 1
> (org\apache\cocoon\www\mount\ethnologue\sources\count_rows_xsp.java): ... // start error (lines
> 3-3) "The declared package does not match the expected package
> org.apache.cocoon.www.mount.ethnologue.sources" package
> org.apache.cocoon.www.mount.Ethnologue.sources; // end error import java.io.File; import
> java.io.IOException; import java.io.StringReader; ... Line 3, column 0: The declared package does
> not match the expected package org.apache.cocoon.www.mount.ethnologue.sources
> 
> 
> I don't think I changed *anything* in between. Except that I added
> some Microsoft SQL - JDBC driver .jar's into Tomcat 4.1\common\lib.
> And I took them out again to see if that could by some wild stretch
> be the problem. No difference.

I interpret the above to mean there _was_ a difference.  Now it's giving 
you this "does not match expected package" error.  I missed the first 
part of this thread.

> I'm running Cocoon 2.1.2.
> 
> Any ideas about what the above error *means*? I couldn't
> find it in the Cocoon sources.
> 
> Here's the file ethnologue/sources/count-rows.xsp:

I'd guess that the current or earlier version of this was actually in 
Ethnologue/sources/count-rows.xsp.  Is "ethnologue" really lower case 
everywhere?

Geoff

> <?xml version="1.0" encoding="UTF-8"?>
> <!-- count-rows?table=___
>      Output <table name="table-parameter" count="num of rows" />
>      L. Huttar, Aug 2003
> -->
> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
> xmlns:xsp-request="http://apache.org/xsp/request/2.0" xmlns:esql="http://apache.org/cocoon/SQL/v2">
>   <table>
>     <esql:connection>
>       <esql:pool>ethnolog</esql:pool>
>       <esql:execute-query>
>         <esql:query>
>   SELECT count(*) TOTAL FROM <xsp-request:get-parameter name="table"/>
>         </esql:query>
>         <esql:results>
>           <esql:row-results>
>             <name>
>               <xsp-request:get-parameter name="table" />
>             </name>
>             <count>
>               <esql:get-string column="TOTAL" />
>             </count>
>           </esql:row-results>
>         </esql:results>
>       </esql:execute-query>
>     </esql:connection>
>   </table>
> </xsp:page>
> 
> 
> Here's the relevant ethnologue/sitemap.xmap section:
>       <map:match pattern="checks/list-columns">
>         <map:generate src="sources/ethnologue-schema.xml"/>
>         <!-- Generate cinclude statements for checks/count-columns from <table> elements. -->
>         <map:transform src="transforms/list-columns-cinclude.xsl" type="xslt-with-parameters"
> label="raw"/>
>         <!-- Process cinclude statements. -->
>         <map:transform type="cinclude" label="raw2"/>
>         <!-- Transform XML data into formatted (x)html. -->
>         <map:transform src="styles/list-columns.xsl" type="xslt-with-parameters" />
>         <map:serialize/>
>       </map:match>
> 
> 
> Here's what cinclude is receiving (I.e. the view at cocoon-view=raw)
> 
> <tables>
> <cinclude:include src="cocoon:/checks/count-rows?table=Development_Status"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Development_Type"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Ethnologue_Continent"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Ethnologue_Country"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Function_in_Country"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Identified_Language"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Language_Contact"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Language_Function"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Language_in_Country"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Writing_Script"/>
> <cinclude:include src="cocoon:/checks/count-rows?table=Writing_System"/>
> </tables>
> 
> Thanks for any help!
> 
> Lars
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 
> 



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