You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Marcin Skladaniec <ma...@ish.com.au> on 2010/12/16 04:17:17 UTC

problem with DefaultConfiguration in ROP

Hello

I'm struggling with a strange problem. After restructuring our project 
we have changed some classpaths.
For a normal, non-ROP application adding extra classpath to default 
configuration have solved the issue.

DefaultConfiguration conf = new DefaultConfiguration();
conf.addClassPath("cayenne");

Configuration.initializeSharedConfiguration(conf);

works without any problems.


but when (for the same application) the ROP stack is initialised via 
servlet cayenne searches for configuration again:

16 Dec 2010 12:46:59,375 DEBUG 
org.apache.cayenne.conf.DefaultConfiguration :64 - using domain file 
name: cayenne.xml
16 Dec 2010 12:46:59,375 DEBUG 
org.apache.cayenne.conf.DefaultConfiguration :132 - initialize starting.
16 Dec 2010 12:46:59,375 DEBUG org.apache.cayenne.util.ResourceLocator 
:213 - URL not found with classloader: cayenne.xml
2010-12-16 12:46:59.376:WARN:/:unavailable
org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Sep 06 2010 
15:09:38] Error starting Cayenne
     at 
org.apache.cayenne.remote.service.BaseRemoteService.initCayenneStack(BaseRemoteService.java:211)
     at 
org.apache.cayenne.remote.service.BaseRemoteService.initService(BaseRemoteService.java:76)
     at 
org.apache.cayenne.remote.hessian.service.HessianService.init(HessianService.java:65)
     at 
com.caucho.hessian.server.HessianServlet.init(HessianServlet.java:324)
     at 
com.caucho.hessian.server.HessianServlet.init(HessianServlet.java:221)...


At first I thought that the cayenne configuration once initialized will 
work regardless of the context.
Now I understand that I need to update classpath for the ROP stack, but 
after couple of hours searching I've got no idea where/how... any clues?
I'm using cayenne 3.0.1, jetty as servlet holder.

Thanks
Marcin

Re: problem with DefaultConfiguration in ROP

Posted by Marcin Skladaniec <ma...@ish.com.au>.
On 16/12/10 11:05 PM, Andrus Adamchik wrote:
> Hi Marcin,
>
> Yes, you will need to add this classpath to the server-side ROP stack. To do this, subclass org.apache.cayenne.remote.hessian.service.HessianService, overriding 'initCayenneStack' method (inherited from superclass). Finally configure your subclass in web.xml as 'service-class' init parameter of HessianServlet.
>
> Andrus
>
>
>
> On Dec 16, 2010, at 5:17 AM, Marcin Skladaniec wrote:
>
>> Hello
>>
>> I'm struggling with a strange problem. After restructuring our project we have changed some classpaths.
>> For a normal, non-ROP application adding extra classpath to default configuration have solved the issue.
>>
>> DefaultConfiguration conf = new DefaultConfiguration();
>> conf.addClassPath("cayenne");
>>
>> Configuration.initializeSharedConfiguration(conf);
>>
>> works without any problems.
>>
>>
>> but when (for the same application) the ROP stack is initialised via servlet cayenne searches for configuration again:
>>
>> 16 Dec 2010 12:46:59,375 DEBUG org.apache.cayenne.conf.DefaultConfiguration :64 - using domain file name: cayenne.xml
>> 16 Dec 2010 12:46:59,375 DEBUG org.apache.cayenne.conf.DefaultConfiguration :132 - initialize starting.
>> 16 Dec 2010 12:46:59,375 DEBUG org.apache.cayenne.util.ResourceLocator :213 - URL not found with classloader: cayenne.xml
>> 2010-12-16 12:46:59.376:WARN:/:unavailable
>> org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Sep 06 2010 15:09:38] Error starting Cayenne
>>     at org.apache.cayenne.remote.service.BaseRemoteService.initCayenneStack(BaseRemoteService.java:211)
>>     at org.apache.cayenne.remote.service.BaseRemoteService.initService(BaseRemoteService.java:76)
>>     at org.apache.cayenne.remote.hessian.service.HessianService.init(HessianService.java:65)
>>     at com.caucho.hessian.server.HessianServlet.init(HessianServlet.java:324)
>>     at com.caucho.hessian.server.HessianServlet.init(HessianServlet.java:221)...
>>
>>
>> At first I thought that the cayenne configuration once initialized will work regardless of the context.
>> Now I understand that I need to update classpath for the ROP stack, but after couple of hours searching I've got no idea where/how... any clues?
>> I'm using cayenne 3.0.1, jetty as servlet holder.
>>
>> Thanks
>> Marcin
>>
Thanks Andrus, worked like a charm!
We already subclass HessianService, just the method initCayenneStack(Map 
params) was confusing, I thought that the params is already the Map of 
params read from configuration xml.

Cheers again!
Marcin


Re: problem with DefaultConfiguration in ROP

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Marcin,

Yes, you will need to add this classpath to the server-side ROP stack. To do this, subclass org.apache.cayenne.remote.hessian.service.HessianService, overriding 'initCayenneStack' method (inherited from superclass). Finally configure your subclass in web.xml as 'service-class' init parameter of HessianServlet.

Andrus



On Dec 16, 2010, at 5:17 AM, Marcin Skladaniec wrote:

> Hello
> 
> I'm struggling with a strange problem. After restructuring our project we have changed some classpaths.
> For a normal, non-ROP application adding extra classpath to default configuration have solved the issue.
> 
> DefaultConfiguration conf = new DefaultConfiguration();
> conf.addClassPath("cayenne");
> 
> Configuration.initializeSharedConfiguration(conf);
> 
> works without any problems.
> 
> 
> but when (for the same application) the ROP stack is initialised via servlet cayenne searches for configuration again:
> 
> 16 Dec 2010 12:46:59,375 DEBUG org.apache.cayenne.conf.DefaultConfiguration :64 - using domain file name: cayenne.xml
> 16 Dec 2010 12:46:59,375 DEBUG org.apache.cayenne.conf.DefaultConfiguration :132 - initialize starting.
> 16 Dec 2010 12:46:59,375 DEBUG org.apache.cayenne.util.ResourceLocator :213 - URL not found with classloader: cayenne.xml
> 2010-12-16 12:46:59.376:WARN:/:unavailable
> org.apache.cayenne.CayenneRuntimeException: [v.3.0.1 Sep 06 2010 15:09:38] Error starting Cayenne
>    at org.apache.cayenne.remote.service.BaseRemoteService.initCayenneStack(BaseRemoteService.java:211)
>    at org.apache.cayenne.remote.service.BaseRemoteService.initService(BaseRemoteService.java:76)
>    at org.apache.cayenne.remote.hessian.service.HessianService.init(HessianService.java:65)
>    at com.caucho.hessian.server.HessianServlet.init(HessianServlet.java:324)
>    at com.caucho.hessian.server.HessianServlet.init(HessianServlet.java:221)...
> 
> 
> At first I thought that the cayenne configuration once initialized will work regardless of the context.
> Now I understand that I need to update classpath for the ROP stack, but after couple of hours searching I've got no idea where/how... any clues?
> I'm using cayenne 3.0.1, jetty as servlet holder.
> 
> Thanks
> Marcin
>