Skip to Content
author's profile photo Former Member
Former Member

Exception when using JDO-QueryLanguage finder

Hello,

i get the following Exception:

java.util.EmptyStackException

at java.util.Stack.peek(Stack.java:79)

at com.sap.jdo.sql.jdbc.SQLQueryTreeWalker$SQLQueryTreeVisitor.getLastVariableValue(SQLQueryTreeWalker.java:1330)

at com.sap.jdo.sql.jdbc.SQLQueryTreeWalker$SQLQueryTreeVisitor.leave(SQLQueryTreeWalker.java:470)

at com.sap.jdo.common.query.tree.VariableAccessExpr.leave(VariableAccessExpr.java:63)

at com.sap.jdo.query.TreeWalker.walk(TreeWalker.java:55)

at com.sap.jdo.query.TreeWalker.walk(TreeWalker.java:53)

at com.sap.jdo.query.TreeWalker.walk(TreeWalker.java:53)

at com.sap.jdo.query.TreeWalker.walk(TreeWalker.java:53)

at com.sap.jdo.sql.jdbc.SQLQueryTreeWalker.<init>(SQLQueryTreeWalker.java:129)

at com.sap.jdo.sql.jdbc.SQLQueryTreeWalker.<init>(SQLQueryTreeWalker.java:103)

at com.sap.jdo.sql.jdbc.request.factory.JDBCRequestFactory.getQueryRequestImpl(JDBCRequestFactory.java:1116)

at com.sap.jdo.sql.jdbc.request.factory.JDBCRequestCloneCache.getQueryRequest(JDBCRequestCloneCache.java:347)

at com.sap.jdo.sql.jdbc.request.factory.JDBCRequestCache.getQueryRequest(JDBCRequestCache.java:476)

at com.sap.jdo.sql.jdbc.JDBCStoreManager.newQueryResult(JDBCStoreManager.java:676)

at com.sap.jdo.StoreManagerAdapter.newQueryResult(StoreManagerAdapter.java:453)

at com.sap.jdo.common.query.QueryImpl.executeWithArray(QueryImpl.java:616)

at com.sap.jdo.common.query.QueryImpl.execute(QueryImpl.java:529)

at com.vw.tpb.tpb.session.TpbHeaderBean.findTPBsByLabel(TpbHeaderBean.java:169)

at com.vw.tpb.tpb.session.TpbHeaderObjectImpl0.findTPBsByLabel(TpbHeaderObjectImpl0.java:188)

at com.vw.tpb.tpb.session.TpbHeader_Stub.findTPBsByLabel(TpbHeader_Stub.java:151)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)

at $Proxy64.findTPBsByLabel(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)

at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)

at SoapServlet.doPost(SoapServlet.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:383)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:333)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:311)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:811)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:235)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:144)

when performing a query using

pm = pmf.getPersistenceManager();

Extent tpbs = pm.getExtent( TPBImpl.class, true );

String filter = "labels.contains( label ) && label.language == langParam && label.text.startsWith( textParam )";

Query query = pm.newQuery( tpbs, filter );

query.declareImports( "import com.vw.tpb.refdata.model.impl.LabelImpl");

query.declareVariables( "LabelImpl label" );

query.declareParameters( "String langParam, String textParam" );

Collection found = (Collection)query.execute( language, text );

Iterator it = found.iterator();

while( it.hasNext() ) {

result.add( String.valueOf( it.next() ));

}

query.close( it );

The line points to the query.execute() method.

Saving the complete Object tree and loading it w/o any query clauses does not raise any problems.

Does someone have any idea on that ?

regards, Udo

[This is also posted to WebAS General]

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jul 06, 2004 at 08:52 AM

    Hi Udo,

    the issue is a known bug in the JDO Query Language Processor: a variable can be used only in one condition. It will be fixed with the next support package available.

    I am only aware of one workaround - have JDO execute the query in memory:

    1) materialize the Extent:

    Extent tpbs = pm.getExtent( TPBImpl.class, true );

    Collection col = new HashSet();

    Iterator iter = tpbs.iterator();

    while (iter.hasNext()) {

    col.add(iter.next());

    }

    tpbs.closeAll();

    2) use the collection as the candidates:

    String filter = "labels.contains( label ) && label.language == langParam && label.text.startsWith( textParam )";

    Query query = pm.newQuery( col, filter );

    ...

    I hope this works until the fix is avaliable.

    Best regards,

    Adrian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 06, 2004 at 08:57 AM

    Hi Udo,

    I answered you question in the "Java Programming" Forum.

    Best regards,

    Adrian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 09, 2004 at 12:42 PM

    Hi Adrian,

    i tried to materialize the complete extend and perform the query on the collection which results in the following exception

    jdo.error: Cannot access unbound variable 'label'. Unbound variables do not have a corresponding contains clause

    any more ideas ?

    regards, udo

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.