This discussion is archived
5 Replies Latest reply: Oct 1, 2007 6:27 PM by 666705 RSS

No query engine found

666705 Newbie
Currently Being Moderated
I've created a simple war project within a simple ear project using Workshop 9.2, and have deployed the ear to the example server. The war contains a single web service that accepts an xml string and an xquery string. The web service applies the xquery against the xml like so, using xml beans:

<pre>
     @WebMethod
     public String testXml(String xml, String xq) throws XmlException
     {
          XmlObject xmlObj = XmlObject.Factory.parse(xml);
          XmlObject[] results = xmlObj.execQuery(xq);
          
          StringBuffer sb = new StringBuffer();
          sb.append("<wrapper>");
          for (XmlObject result : results)
          {
               sb.append(result.xmlText(new XmlOptions().setSavePrettyPrint()));
          }
          sb.append("</wrapper>");
          
          return sb.toString();
     }
</pre>

Problem is, when I test this web service, I get the following exception. What am I doing wrong here?

<pre>
java.lang.RuntimeException: No query engine found
at org.apache.xmlbeans.impl.store.Query.getCompiledQuery(Query.java:120)
at org.apache.xmlbeans.impl.store.Query.getCompiledQuery(Query.java:53)
at org.apache.xmlbeans.impl.store.Query.objectExecQuery(Query.java:43)
at org.apache.xmlbeans.impl.store.Xobj.exec_query(Xobj.java:2503)
at org.apache.xmlbeans.impl.values.XmlObjectBase.execQuery(XmlObjectBase.java:480)
at org.apache.xmlbeans.impl.values.XmlObjectBase.execQuery(XmlObjectBase.java:462)
at xmlbeans.TestXMLBeans.testXml(TestXMLBeans.java:16)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
    at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
    at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:99)
    at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:64)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:85)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:80)
    at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
    at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
    at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:165)
    at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:84)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3214)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1983)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1890)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1344)
</pre>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  • 1. Re: No query engine found
    666705 Newbie
    Currently Being Moderated
    The only solution I've found is to remove the apache_xbean.jar library from ${bea_home}/weblogic92/common/bin/ and put it instead in ${domain_home}/lib/. Then I can add the saxon libraries to ${domain_home}/lib/ and everything works fine. This seems like a horrible long-term solution, but it works for now.

    Does anyone at all have further ideas, or is this board really that dead?
  • 2. Re: No query engine found
    666705 Newbie
    Currently Being Moderated
    Did you deploy the ear from within workshop or from an external build? When I deploy from within workshop, it fails because it can't find required classes (result of moving apache_xbeans.jar). As a result, I have to move apache_xbeans.jar into and out of ...common/lib to get things to work...a total pain!
  • 3. Re: No query engine found
    666705 Newbie
    Currently Being Moderated
    Tricky solution:
    Add xbean_xpath.jar (copy from XMLBean 2.2.0), saxon8.jar, saxon8-dom.jar (copy from saxon 8.6.1) to classpath inside startWebLogic.cmd or .sh.
  • 4. Re: No query engine found
    666705 Newbie
    Currently Being Moderated
    I believe this is actually the right thing to do because you need to have xbean_xpath.jar in the same classpath that XMLBeans is (if using saxon). One slight mod I would make is to add these to the POST_CLASSPATH variable in setDomainEnv.cmd/sh.

    If you're not using Saxon as the XQuery engine but are using xqrl you need to put the following jars on the classpath instead of xbean_xpath.jar:

    For the 2002 impl:
    xqrl.jar
    wlxbean.jar

    For the 2004 impl:
    xquery.jar
    apachexmlbeansutil.jar

    --
    Edited by hogue at 02/26/2007 8:08 AM
  • 5. Re: No query engine found
    666705 Newbie
    Currently Being Moderated
    hi all
    i have one more soln for this problem
    I got this working by adding a element in weblogic-application.xml this one makes to load our version of xmlbeans/saxon jar from the app-inf lib folder

    Step 1.

    I copied all the jars in the app-inf lib folder


    :\workshop\kai\webserviceEAR\EarContent\APP-INF\lib>dir
    Volume in drive C is SYSTEM
    Volume Serial Number is 7CF4-E4FE

    Directory of C:\workshop\kai\webserviceEAR\EarContent\APP-INF\lib

    0/01/2007 07:14 PM <DIR> .
    0/01/2007 07:14 PM <DIR> ..
    0/01/2007 07:13 PM 23,630 jsr173_1.0_api.jar
    0/01/2007 07:14 PM 60,047 resolver.jar
    0/01/2007 06:59 PM 12,569 saxon8-jdom.jar
    0/01/2007 06:59 PM 2,297,989 saxon8.jar
    0/01/2007 07:14 PM 2,664,574 xbean.jar
    0/01/2007 06:59 PM 5,578 xbean_xpath.jar
    0/01/2007 07:14 PM 429,483 xmlpublic.jar
    7 File(s) 5,493,870 bytes
    2 Dir(s) 2,820,255,744 bytes free
    step-2 added this entry into the weblogic-application.xml
    <wls:prefer-application-packages>
    <wls:package-name>org.apache.xmlbeans.*</wls:package-name>
    </wls:prefer-application-packages>
    here I ran into another problem deployment discriptor did not identify the entry prefer-application-package

    I had to modify the first line of the weblogic-application.xml
    <wls:weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd">

    ie On my end, I modfied weblogic-application.xml file by removing these 2 schema locations from the opening tag:
    http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-application.xsd

    After that I ran the service and see the xquery working fine the basic logic here is we made the jar files from the application to load using the tag prefer-application-packages

    Thanks