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.<clinit>(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.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basedb-devel

Reply via email to