You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stephan Coboos <cr...@gmx.net> on 2004/06/01 20:23:22 UTC

[BUG] Registering of JavaFlow fails (was: [JavaFlow] java.lang.VerifyException)

Hello,

I have a problem using Objects in JavaFlow before a while loop. Please 
see my first posting [JavaFlow] java.lang.VerifyException. In my opinion 
it can be a bug in the JavaFlow block.

Because my fist posting was not so clear, I had tried to reproduce the 
error for a while and I had discovered the following code which creates 
such an error (you need the packages of Lucene):

package foo.bar;

import org.apache.cocoon.components.flow.java.AbstractContinuable;
import org.apache.lucene.queryParser.*;
import org.apache.lucene.search.*;
import org.apache.lucene.analysis.standard.StandardAnalyzer;

public class TestFlow extends AbstractContinuable {

    public void doTest() throws Exception {
       
         // This causes an error -> The class can not be registered at 
first call!!!
        Query query = null;
        Hits hits;
        IndexSearcher searcher = null;
       // end
 
        while(true) {
           
            this.sendPageAndWait("foo");
           
            query = QueryParser.parse("foo", "bar", new StandardAnalyzer());
            hits = searcher.search(query);
        }
    }
}

If you test this error you can see that the first call of any (!) url of 
the corresponding cocoon app causes in a empty page. The flow-log shows 
as last entry the following line:

registered java class "foo.bar.TestFlow" for flow

Then, Cocoon stops working and displays a empty page.
In the logs of my servlet container Tomcat I can see the follwing error 
message:

2004-06-01 19:58:33 StandardWrapperValve[Cocoon]: Servlet.service() for 
servlet Cocoon threw exception
java.lang.VerifyError: (class: foo/bar/TestFlow, method: doTest 
signature: ()V) Incompatible object argument for function call
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
    at java.lang.Class.privateGetPublicMethods(Class.java:1770)
    at java.lang.Class.getMethods(Class.java:824)
    at 
org.apache.cocoon.components.flow.java.JavaInterpreter.initialize(JavaInterpreter.java:96)
    at 
org.apache.cocoon.components.flow.java.JavaInterpreter.callFunction(JavaInterpreter.java:130)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.handleCocoonRedirect(TreeProcessor.java:382)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.access$000(TreeProcessor.java:66)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor$TreeProcessorRedirector.cocoonRedirect(TreeProcessor.java:543)
    at 
org.apache.cocoon.environment.ForwardRedirector.redirect(ForwardRedirector.java:58)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.RedirectToURINode.invoke(RedirectToURINode.java:69)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
    at org.apache.cocoon.Cocoon.process(Cocoon.java:619)
    at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1073)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
    at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
    at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
    at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
    at 
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
    at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
    at java.lang.Thread.run(Thread.java:534)

If I change the code of the JavaFlow class and declare the variables 
"query", "hits" and "searcher" outside the method "doTest", no error 
will occur. See as follow:

package foo.bar;

import org.apache.cocoon.components.flow.java.AbstractContinuable;
import org.apache.lucene.queryParser.*;
import org.apache.lucene.search.*;
import org.apache.lucene.analysis.standard.StandardAnalyzer;

public class TestFlow extends AbstractContinuable {

     // This works because it is ouside of doTest()
        Query query = null;
        Hits hits;
        IndexSearcher searcher = null;
    // end

    public void doTest() throws Exception {
 
        while(true) {
           
            this.sendPageAndWait("foo");
           
            query = QueryParser.parse("foo", "bar", new StandardAnalyzer());
            hits = searcher.search(query);
        }
    }
}

Is it really a bug? Why is it not possible to declare these three line 
within the method doTest? What can I do?

Thank you.

Regards
Stephan




Re: [BUG] Registering of JavaFlow fails (was: [JavaFlow] java.lang.VerifyException)

Posted by Stephan Coboos <cr...@gmx.net>.
Stephan Michels wrote:

>Am Do, den 03.06.2004 schrieb Stephan Michels um 15:00:
>  
>
>>Am Di, den 01.06.2004 schrieb Stephan Coboos um 20:23:
>>    
>>
>>>Hello,
>>>
>>>I have a problem using Objects in JavaFlow before a while loop. Please 
>>>see my first posting [JavaFlow] java.lang.VerifyException. In my opinion 
>>>it can be a bug in the JavaFlow block.
>>>
>>>Because my fist posting was not so clear, I had tried to reproduce the 
>>>error for a while and I had discovered the following code which creates 
>>>such an error (you need the packages of Lucene):
>>>
>>>java.lang.VerifyError: (class: foo/bar/TestFlow, method: doTest 
>>>signature: ()V) Incompatible object argument for function call
>>>
>>>Is it really a bug? Why is it not possible to declare these three line 
>>>within the method doTest? What can I do?
>>>      
>>>
>>Yes, it seems to be a bug. I guess its a problem the following line
>>
>>  query = QueryParser.parse("foo", "bar", new StandardAnalyzer());
>>
>>I had many problem in the past with uninitialized objects and saving the
>>continuation. I will take a look into it.
>>    
>>
>
>It was a problem with null objects, which were stored into the
>continuation. If the frame will be restored, the null object cannot
>be casted into the right type. So, at the end the correct signatur
>couldn't be found.
>
>Hits hits;
>IndexSearcher searcher = null;
>sendPageAndWait("foo");
>hits = searcher.search(query);
>
>I have fixed it now.
>
>Stephan.
>
>
>  
>
Wow, what a quick work!

Thank you very much!

Regards
Stephan

Re: [BUG] Registering of JavaFlow fails (was: [JavaFlow] java.lang.VerifyException)

Posted by Stephan Michels <st...@apache.org>.
Am Do, den 03.06.2004 schrieb Stephan Michels um 15:00:
> Am Di, den 01.06.2004 schrieb Stephan Coboos um 20:23:
> > Hello,
> > 
> > I have a problem using Objects in JavaFlow before a while loop. Please 
> > see my first posting [JavaFlow] java.lang.VerifyException. In my opinion 
> > it can be a bug in the JavaFlow block.
> > 
> > Because my fist posting was not so clear, I had tried to reproduce the 
> > error for a while and I had discovered the following code which creates 
> > such an error (you need the packages of Lucene):
> >
> > java.lang.VerifyError: (class: foo/bar/TestFlow, method: doTest 
> > signature: ()V) Incompatible object argument for function call
> >
> > Is it really a bug? Why is it not possible to declare these three line 
> > within the method doTest? What can I do?
> 
> Yes, it seems to be a bug. I guess its a problem the following line
> 
>   query = QueryParser.parse("foo", "bar", new StandardAnalyzer());
> 
> I had many problem in the past with uninitialized objects and saving the
> continuation. I will take a look into it.

It was a problem with null objects, which were stored into the
continuation. If the frame will be restored, the null object cannot
be casted into the right type. So, at the end the correct signatur
couldn't be found.

Hits hits;
IndexSearcher searcher = null;
sendPageAndWait("foo");
hits = searcher.search(query);

I have fixed it now.

Stephan.


Re: [BUG] Registering of JavaFlow fails (was: [JavaFlow] java.lang.VerifyException)

Posted by Stephan Michels <st...@apache.org>.
Am Di, den 01.06.2004 schrieb Stephan Coboos um 20:23:
> Hello,
> 
> I have a problem using Objects in JavaFlow before a while loop. Please 
> see my first posting [JavaFlow] java.lang.VerifyException. In my opinion 
> it can be a bug in the JavaFlow block.
> 
> Because my fist posting was not so clear, I had tried to reproduce the 
> error for a while and I had discovered the following code which creates 
> such an error (you need the packages of Lucene):
>
> java.lang.VerifyError: (class: foo/bar/TestFlow, method: doTest 
> signature: ()V) Incompatible object argument for function call
>
> Is it really a bug? Why is it not possible to declare these three line 
> within the method doTest? What can I do?

Yes, it seems to be a bug. I guess its a problem the following line

  query = QueryParser.parse("foo", "bar", new StandardAnalyzer());

I had many problem in the past with uninitialized objects and saving the
continuation. I will take a look into it.

Stephan.