Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread Olivier Lefevre

>> So I am reasonably happy with 4)

With 3) I meant. Typo.

> I have heard the name JSON but didn't know that it had to
> do with web services. 

Indeed it isn't closely "affiliated" with web services: it is
just another string encoding for tree-like semi-structured data. 
My understanding is that it is close to ASN.1 and that in terms 
of complexity ASN.1 >> XML ~ YAML > JSON > SEXP (S-Expressions)
JSON seems very popular with the Javascript crowd.

> Just because it is Java objects on the server side doesn't 
> mean that it has to be the same objects on the client side 

Yes but interop is one of those here-be-dragons things and 
Axis gives you the Java for free whereas you have to roll out
anything else by yourself, which not everyone has the skills
or the inclination to do (right now I'd be challenged to it
myself, although I fear I'm going to have to learn).

-- O.L.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread Nicklas Nordborg
Olivier Lefevre wrote:
> Re. the earlier problem, here is what I found:
> 1) custom classes in their own package and in their own jar 
>under WEB-INF/lib: ClassNotFoundException 
> 2) custom classes in their own package and in their own jar or
>aar under WEB-INF/services: ClassNotFoundException; note that
>in this case you must include a services.xml files (I used
>an empty one, i.e., just ) in the jar or aar 
>file, otherwise Axis will complain about that as well
> 3) custom classes in their own package and in core.aar: works!
> 4) custom classes in net/sf/basedb/ws/server and therefore in
>core.aar: works but it is a last-resort option
> So I am reasonably happy with 4): the worst scenario is that
> you have to unpack and then repack third-party jars.
> 

I made some quick investigations as well and it seems like each .aar
file has it's own class loader (created by Axis). The parent class 
loader is the regular Tomcat class loader which means that classes in an 
.aar file can only use classes that are in the same .aar file or classes 
in the WEB-INF/lib/ directory. Classes in the WEB-INF/lib/ directory 
can't use classes from any .aar file because those files are not known 
by the Tomcat class loader.

This is described as a feature since it means that an .aar file can be 
replaced with a new version and deployed without having to restart the 
web application. So, since the ServicesUtil class is found in the 
core.aar file it means that it can only be used by other classes in 
core.aar.

>> I don't see how it would be possible to return any
>> structured information as simple strings. 
> 
> One could use JSON or even XML.

I have heard the name JSON but didn't know that it had to do with web 
services. Regarding XML, everything is already sent as XML which is 
unwrapped and converted to Java objects by Axis. I have seen code 
examples (from the Axis tutorial) were the response is accessed as XML 
instead so I think that option is already available. Just because it is 
Java objects on the server side doesn't mean that it has to be the same 
objects on the client side (but it is convenient).

/Nicklas

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread Olivier Lefevre

Re. the earlier problem, here is what I found:
1) custom classes in their own package and in their own jar 
   under WEB-INF/lib: ClassNotFoundException 
2) custom classes in their own package and in their own jar or
   aar under WEB-INF/services: ClassNotFoundException; note that
   in this case you must include a services.xml files (I used
   an empty one, i.e., just ) in the jar or aar 
   file, otherwise Axis will complain about that as well
3) custom classes in their own package and in core.aar: works!
4) custom classes in net/sf/basedb/ws/server and therefore in
   core.aar: works but it is a last-resort option
So I am reasonably happy with 4): the worst scenario is that
you have to unpack and then repack third-party jars.

> I don't see how it would be possible to return any
> structured information as simple strings. 

One could use JSON or even XML.

> As far as I know it was no problem with perl.

OK.

-- O.L.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread Nicklas Nordborg
Olivier Lefevre wrote:
> So it's a class loader issue. Thanks for the explanation.
> I'll find some arrangement that works; worst case is I just 
> shove everything into net.sf.basedb.ws.server: it's my own 
> code, so I can repackage it.
> 
> While we are talking about design, I have another quick
> question: from the interop point of view, i.e., with non-Java
> clients in mind, isn't it asking for trouble to use complex
> data types from net.sf.basedb.info: shouldn't one stick to 
> strings and other basic universal types instead?

I don't see how it would be possible to return any structured
information as simple strings. As far as I know it was no problem
with perl.

/Nicklas

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread Olivier Lefevre

So it's a class loader issue. Thanks for the explanation.
I'll find some arrangement that works; worst case is I just 
shove everything into net.sf.basedb.ws.server: it's my own 
code, so I can repackage it.

While we are talking about design, I have another quick
question: from the interop point of view, i.e., with non-Java
clients in mind, isn't it asking for trouble to use complex
data types from net.sf.basedb.info: shouldn't one stick to 
strings and other basic universal types instead?

-- O.L.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread Nicklas Nordborg
The ServicesUtil and other classes in the net.sf.basedb.ws.server package
are not found in the WEB-INF/lib/ directory and thus can't be referenced from
classes that are there.

Axis has it's own class loader implementation and expects to find classes
in the WEB-INF/services/ directory in the form of *.aar files. There should
currently be only one file: core.aar. Classes in the .aar files can
reference/use any class that is found in WEB-INF/lib/ but not the other way
around.

I don't know if .aar files are visible to each other, but you can try to
put your custom file in WEB-INF/services/ directory and rename it to
end with .aar.

/Nicklas



lefev...@yahoo.com wrote:
> Sorry, why did I write "client"? It was late, I should have slept
> before posting. This happens in the service class. I have my own
> utility class, which refers to ServicesUtil, and the service class
> loads that utility class. The utility class can be loaded but not
> ServicesUtil, which is odd since it *is* loaded in AbstractRPCService.
> I have attached a minimal yet full example that can be deployed to
> reproduce the problem (I have not attached the modified services.xml 
> because the mods there are obvious); the service and client classes
> are in the appropriate jars (I just rebuild using ant), TestUtil in 
> its own jar under WEB-INF/lib. The bottom of the stack trace is
> 
> Caused by: java.lang.NoClassDefFoundError: 
> net/sf/basedb/ws/server/ServicesUtil
> at com.acme.TestUtil.(TestUtil.java:8)
> at net.sf.basedb.ws.server.TestService.getResult(TestService.java:14)
> ... 25 more
> Caused by: java.lang.ClassNotFoundException: 
> net.sf.basedb.ws.server.ServicesUtil
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
> at 
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> ... 27 more
> 
> There is nothing special about ServicesUtil, btw: attempting to
> instantiate, say, TempFileDataSource, causes the same error. The 
> chain of references is net.sf.basedb.ws.server -> com.acme -> 
> net.sf.basedb.ws.server. Does the detour through another package 
> trigger some classloader complication?
> 
>> A good starting point is the web services example that you can 
>> download from [...]
> 
> Of course I studied the built-in examples first; I don't think I
> could have so much as started otherwise. Still, I want to be able
> to use custom classes on the server side. Why does (apparently)
> everything have to be in the net.sf.basedb.ws.server package?
> 
> Thanks,
> 
> -- O.L.
> 
> =
> package com.acme;
> 
> import net.sf.basedb.ws.server.ServicesUtil;
> 
> public class TestUtil {
> 
> // just to test whether ServicesUtil can be loaded
> private static ServicesUtil util = new ServicesUtil();
> 
> public static String process(String x) {
> return x.toUpperCase();
> }
> }
> 
> package net.sf.basedb.ws.server;
> 
> import net.sf.basedb.core.SessionControl;
> import net.sf.basedb.ws.server.ServicesUtil;
> 
> import com.acme.TestUtil;
> 
> public class TestService extends AbstractRPCService {
> 
> public TestService() { }
> 
> public String getResult(String sid, String q) {
> SessionControl sc = getSessionControl(sid);
> return TestUtil.process(q);
> }
> }
> 
> package net.sf.basedb.ws.client;
> 
> import org.apache.axis2.AxisFault;
> 
> import com.acme.TestUtil;
> 
> public class TestClient extends AbstractRPCClient {
> 
> private final SessionClient session;
> 
> public TestClient(SessionClient session) {
> super(session.getUrl(), "Test", session.getServiceFactory());
> this.session = session;
> }
> 
> public String getResult(String q) throws AxisFault {
> String sid = session.getId();
> return invokeBlocking("getResult", String.class, sid, q);
> }
> }
> 
> 
> 
> 
> 
> 
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing 
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> ___
> basedb-devel mailing list
> basedb-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/basedb-devel


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourcefor

Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread Olivier Lefevre

PS: There are a couple of superfluous imports in my example files
because of cut-and-paste but that does not affect the argument.


--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] ServicesUtil not found

2009-06-17 Thread lefevrol

Sorry, why did I write "client"? It was late, I should have slept
before posting. This happens in the service class. I have my own
utility class, which refers to ServicesUtil, and the service class
loads that utility class. The utility class can be loaded but not
ServicesUtil, which is odd since it *is* loaded in AbstractRPCService.
I have attached a minimal yet full example that can be deployed to
reproduce the problem (I have not attached the modified services.xml 
because the mods there are obvious); the service and client classes
are in the appropriate jars (I just rebuild using ant), TestUtil in 
its own jar under WEB-INF/lib. The bottom of the stack trace is

Caused by: java.lang.NoClassDefFoundError: net/sf/basedb/ws/server/ServicesUtil
    at com.acme.TestUtil.(TestUtil.java:8)
    at net.sf.basedb.ws.server.TestService.getResult(TestService.java:14)
    ... 25 more
Caused by: java.lang.ClassNotFoundException: 
net.sf.basedb.ws.server.ServicesUtil
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 27 more

There is nothing special about ServicesUtil, btw: attempting to
instantiate, say, TempFileDataSource, causes the same error. The 
chain of references is net.sf.basedb.ws.server -> com.acme -> 
net.sf.basedb.ws.server. Does the detour through another package 
trigger some classloader complication?

> A good starting point is the web services example that you can 
> download from [...]

Of course I studied the built-in examples first; I don't think I
could have so much as started otherwise. Still, I want to be able
to use custom classes on the server side. Why does (apparently)
everything have to be in the net.sf.basedb.ws.server package?

Thanks,

-- O.L.

=
package com.acme;

import net.sf.basedb.ws.server.ServicesUtil;

public class TestUtil {

    // just to test whether ServicesUtil can be loaded
    private static ServicesUtil util = new ServicesUtil();

    public static String process(String x) {
        return x.toUpperCase();
    }
}

package net.sf.basedb.ws.server;

import net.sf.basedb.core.SessionControl;
import net.sf.basedb.ws.server.ServicesUtil;

import com.acme.TestUtil;

public class TestService extends AbstractRPCService {

    public TestService() { }

    public String getResult(String sid, String q) {
        SessionControl sc = getSessionControl(sid);
        return TestUtil.process(q);
    }
}

package net.sf.basedb.ws.client;

import org.apache.axis2.AxisFault;

import com.acme.TestUtil;

public class TestClient extends AbstractRPCClient {

    private final SessionClient session;

    public TestClient(SessionClient session) {
        super(session.getUrl(), "Test", session.getServiceFactory());
        this.session = session;
    }

    public String getResult(String q) throws AxisFault {
        String sid = session.getId();
        return invokeBlocking("getResult", String.class, sid, q);
    }
}






--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


Re: [basedb-devel] ServicesUtil not found

2009-06-16 Thread Nicklas Nordborg
Olivier Lefevre wrote:
> My web service client (i.e., a child of AbstractRPCClient)
> references a custom class in a completely different package,
> which is is in its own jar under webapps/base2/WEB-INF/lib
> That class in turn references net.sf.basedb.ws.server.ServicesUtil
> Upon trying to run the service I got: 
> 
>java.lang.NoClassDefFoundError: net/sf/basedb/ws/server/ServicesUtil
> 
> and I don't have enough experience with Axis or Tomcat to
> understand what is going on. Any suggestion?

That is a server-side class and I don't know what you need to do with
it on the client side. This class can't be used on the client-side since
it would require a full BASE installation locally.

The base2/WEB-INF/lib directory is only available on the server-side as well.
So it is not a good idea to put custom client-side JAR files in there. It
seems like you need to redesign your client side code if it depends on server
side classes.

A good starting point is the web services example that you can download from
http://baseplugins.thep.lu.se/wiki/net.sf.basedb.examples.webservices
It should contain everything you need for developing client side web services.

/Nicklas

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel


[basedb-devel] ServicesUtil not found

2009-06-16 Thread Olivier Lefevre

My web service client (i.e., a child of AbstractRPCClient)
references a custom class in a completely different package,
which is is in its own jar under webapps/base2/WEB-INF/lib
That class in turn references net.sf.basedb.ws.server.ServicesUtil
Upon trying to run the service I got: 

   java.lang.NoClassDefFoundError: net/sf/basedb/ws/server/ServicesUtil

and I don't have enough experience with Axis or Tomcat to
understand what is going on. Any suggestion?




--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
basedb-devel mailing list
basedb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel