Import Module problem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Import Module problem

Jerome Blanchard-3

Hy,

 

I have a serious problem to use an import Module.

 

I had an EJB application with one component for xml storage and queries. eXist was packaged in standalone in a Session Bean and everything was working fine.

Problem was when the server was going for shutdown because exist wasn’t closed carefully.

I had also a small Module with one function and this was working fine too (The module code was in the same jar than the Session Beans).

 

To improve management of xml database and avoid problem of losing some data on a server shutdown I decided to put eXist in a Jonas Service. So I use the jboss example provided with the distribution and create a separate jar. I have put the Module and Function code into the same jar than for the Jonas Service and put this jar into JONAS_ROOT/lib/ext

 

My business module now just contains an XMLDB bridge class which use the jonas service.

I also put this jar in my .ear wich contains the rest of my business components and application logic.

 

Now when I am running simple queries, everything works fine but when I use my module with import clause it produce such error :

 

java.lang.NullPointerException

        at org.exist.xquery.XQueryContext.importModule(XQueryContext.java:1172)

        at org.exist.xquery.parser.XQueryTreeParser.prolog(XQueryTreeParser.java:3103)

        at org.exist.xquery.parser.XQueryTreeParser.module(XQueryTreeParser.java:2428)

        at org.exist.xquery.parser.XQueryTreeParser.xpath(XQueryTreeParser.java:2277)

        at org.exist.xquery.XQuery.compile(XQuery.java:108)

        at org.exist.xquery.XQuery.compile(XQuery.java:83)

        at org.exist.xmldb.LocalXPathQueryService.compile(LocalXPathQueryService.java:202)

        at org.exist.xmldb.LocalXPathQueryService.doQuery(LocalXPathQueryService.java:275)

        at org.exist.xmldb.LocalXPathQueryService.query(LocalXPathQueryService.java:112)

        at org.exist.xmldb.LocalXPathQueryService.query(LocalXPathQueryService.java:103)

        at org.kiwi.query.xmldb.XMLDB.query(XMLDB.java:114)

        at org.kiwi.query.ejb.KiwiQueryServiceBean.query(KiwiQueryServiceBean.java:48)

        at org.objectweb.jonas_gen.org.kiwi.query.interfaces.JOnASKiwiQueryService_353779587Remote.query(JOnASKiwiQueryService_353779587Remote.java:57)

        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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)

        at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.runDispatch(JUnicastServerRef.java:160)

        at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:145)

        at sun.rmi.transport.Transport$1.run(Transport.java:148)

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

        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)

        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)

        at java.lang.Thread.run(Thread.java:534)

 

 

I also upgrade from eXist 0.9 to eXist 1.0 (last snapshot)…

 

 

Here is the code of my Function :

 

 

public class KiwiDocumentURIFunction extends BasicFunction {

 

            public final static FunctionSignature signature =

                        new FunctionSignature(

                                   new QName("document-uri", KiwiModule.NAMESPACE_URI, KiwiModule.PREFIX),

                                   "Return the kiwi document uri from which the node is extracted",

                                   new SequenceType[] { new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)},

                                   new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE));

 

            public KiwiDocumentURIFunction(XQueryContext context) {

                        super(context, signature);

            }

 

            public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {

                        try {

            NodeProxy node = (NodeProxy) contextSequence.itemAt(0);

            String fileName = node.doc.getFileName();

            String encodedURI = fileName.substring(fileName.lastIndexOf("/") + 1);

            return new StringValue(new String(new BASE64Decoder().decodeBuffer(encodedURI)));

} catch (Exception e) {

            e.printStackTrace();

            throw new XPathException("Error while decoding the kiwi document URI : " + e.getMessage());

            }

            }

 

}

 

 

What I think is that when xquery processor is parsing my query, it crashes at the import clause. Why I don’t know but maybe it can’t find the function class or module….

 

Where is executed this code (in the application server by the service or in my SessionBean when I call query method ???)

 

Thanks for your help, jérôme.  

Reply | Threaded
Open this post in threaded view
|

Re: Import Module problem

Pierrick Brihaye-2
Hi,

[hidden email] wrote:

> I also upgrade from eXist 0.9 to eXist 1.0 (last snapshot)…

Good :-) Even better with the last CVS because the prolog is now handled
a bit more how it is supposed to be...

Didn't you forget to declare you module in conf.xml ? See
http://cvs.sourceforge.net/viewcvs.py/exist/eXist-1.0/conf.xml?annotate=1.80 
around line 125.

Cheers,

--
Pierrick Brihaye, informaticien
Service régional de l'Inventaire
DRAC Bretagne
mailto:[hidden email]
+33 (0)2 99 29 67 78
http://usenet-fr.news.eu.org/fr-chartes/rfc1855.html. L'avez-vous lu ?


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

RE: DatabaseImpl : ClaaNotFoundException

Antoine Martinelli
Hello All,

I begin with eXist and I have a little problem.

I try a connection at eXist with a simple java's class.

I set my driver "org.exist.xmldb.DatabaseImple"
But when I try to make a class with : Class.forName(driver);

Java throw me this exception : java.lang.ClassNotFoundException:
org.exist.xmldb.DatabaseImpl

I'm sorry if my English is not very good, I come from Switzerland and I do
my best :D

Thanks you all.

Antoine

____________________________________________________
Antoine Martinelli                                    Ingénieur Média HES
e-mail : [hidden email]            tèl : 078 / 809.51.06
 



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

RE: DatabaseImpl : ClaaNotFoundException

vik Dhawan
Antoine:

You have  a typo in your driver name.

Driver should be "org.exist.xmldb.DatabaseImpl"

Thanks!

Vik
-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Antoine
Martinelli
Sent: Thursday, October 20, 2005 10:44 AM
To: [hidden email]
Subject: RE: [Exist-open] DatabaseImpl : ClaaNotFoundException

Hello All,

I begin with eXist and I have a little problem.

I try a connection at eXist with a simple java's class.

I set my driver "org.exist.xmldb.DatabaseImple"
But when I try to make a class with : Class.forName(driver);

Java throw me this exception : java.lang.ClassNotFoundException:
org.exist.xmldb.DatabaseImpl

I'm sorry if my English is not very good, I come from Switzerland and I do
my best :D

Thanks you all.

Antoine

____________________________________________________
Antoine Martinelli                                    Ingénieur Média HES
e-mail : [hidden email]            tèl : 078 / 809.51.06
 



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: DatabaseImpl : ClaaNotFoundException

Pierrick Brihaye-2
In reply to this post by Antoine Martinelli
Hi,

Antoine Martinelli wrote:

> I set my driver "org.exist.xmldb.DatabaseImple"
> But when I try to make a class with : Class.forName(driver);
>
> Java throw me this exception : java.lang.ClassNotFoundException:
> org.exist.xmldb.DatabaseImpl

It is likely that org.exist.xmldb.DatabaseImpl.class is not in your
CLASSPATH.
Usually, this  file is located in... exist.jar ;-)
So... put exist.jar in your CLASSPATH.

Cheers,

--
Pierrick Brihaye, informaticien
Service régional de l'Inventaire
DRAC Bretagne
mailto:[hidden email]
+33 (0)2 99 29 67 78
http://usenet-fr.news.eu.org/fr-chartes/rfc1855.html. L'avez-vous lu ?


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open