Need some help with the public API

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

Need some help with the public API

Pradeep Fernando
Hi devs,

I'm trying to get wink working in another environment, (without using
a the default restServlet based mechanism). There I  need to create
the deployment config
request processor using my own classLoader. I was able to do so.

the problem is I'm getting a illegalArgumentException when i'm
executing the line,

ObjectFactory of =
configuration.getOfFactoryRegistry().getObjectFactory(appClass);

this happens, because ,

createObject () method in the DefaultLifeCycleManager, decides my
application class as a DynamicResource.

this is working fine when i run this using the standard wink war
deployment. (the same service class).

what is DynamicResource notion in wink. Why is it not working when i'm
trying to invoke using the wink public apis?
any pointer greatly appreciated.

thanks in advance,
--Pradeep
Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Bryant Luk
Sorry for the silly question, but do you implement DynamicResource or
extend from a class that does like AbstractDynamicResource?

On Tue, Feb 8, 2011 at 7:34 AM, Pradeep Fernando <[hidden email]> wrote:

> Hi devs,
>
> I'm trying to get wink working in another environment, (without using
> a the default restServlet based mechanism). There I  need to create
> the deployment config
> request processor using my own classLoader. I was able to do so.
>
> the problem is I'm getting a illegalArgumentException when i'm
> executing the line,
>
> ObjectFactory of =
> configuration.getOfFactoryRegistry().getObjectFactory(appClass);
>
> this happens, because ,
>
> createObject () method in the DefaultLifeCycleManager, decides my
> application class as a DynamicResource.
>
> this is working fine when i run this using the standard wink war
> deployment. (the same service class).
>
> what is DynamicResource notion in wink. Why is it not working when i'm
> trying to invoke using the wink public apis?
> any pointer greatly appreciated.
>
> thanks in advance,
> --Pradeep
>



--

@bluk
Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Pradeep Fernando
hi BLuk,

comment inline;

On Wed, Feb 9, 2011 at 12:11 AM, Bryant Luk <[hidden email]> wrote:
> Sorry for the silly question, but do you implement DynamicResource or
> extend from a class that does like AbstractDynamicResource?
>

Not really. I'm using the service classes provided by the wink getting
started guide. [1]

The only thing I'm doing new is to use a custom class loader that
loads the service classes from my own deployment point rather than
witin the WEB-INF/classes.

I can't figure out what causing the problem since at the exception
point it just test weather the loaded class isAssignableFrom().
I'm not doing anything related to DynamicResource.class

[1] https://cwiki.apache.org/WINK/jax-rs-getting-started.html

thanks,
--Pradeep
Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Michael Elman
Administrator
Can you describe the hierarchy of your classloaders? Where wink jars are located? Do you work child/parent first?



-- Sent from my Palm Pre
On Feb 8, 2011 10:22 PM, Pradeep Fernando &lt;[hidden email]&gt; wrote:

hi BLuk,



comment inline;



On Wed, Feb 9, 2011 at 12:11 AM, Bryant Luk &lt;[hidden email]&gt; wrote:

&gt; Sorry for the silly question, but do you implement DynamicResource or

&gt; extend from a class that does like AbstractDynamicResource?

&gt;



Not really. I'm using the service classes provided by the wink getting

started guide. [1]



The only thing I'm doing new is to use a custom class loader that

loads the service classes from my own deployment point rather than

witin the WEB-INF/classes.



I can't figure out what causing the problem since at the exception

point it just test weather the loaded class isAssignableFrom().

I'm not doing anything related to DynamicResource.class



[1] https://cwiki.apache.org/WINK/jax-rs-getting-started.html



thanks,

--Pradeep


Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Pradeep Fernando
hi all,


Got it resolved. My fault. class loading issue. sorry for the unwanted
noise here in the list.
BTW, can somebody tell me what is the approach use by wink to specify
the runtime delegate class (spec defines several options.). right now
I'm using JVM property for my test purposes.

thanks all for your help.
--Pradeep
Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Michael Elman
Administrator
This is a JAX-RS spec that specifies how to search for the RuntimeDegelate.
The javadoc for the RuntimeDelegate javax.ws.rs.ext.
RuntimeDelegate.getInstance() states the following:
*
Obtain a RuntimeDelegate instance. If an instance had not already been
created and set via setInstance, the first invocation will create an
instance which will then be cached for future use.

The algorithm used to locate the RuntimeDelegate subclass to use consists of
the following steps:


If a resource with the name of
META-INF/services/javax.ws.rs.ext.RuntimeDelegate exists, then its first
line, if present, is used as the UTF-8 encoded name of the implementation
class.
If the $java.home/lib/jaxrs.properties file exists and it is readable by the
java.util.Properties.load(InputStream) method and it contains an entry whose
key is javax.ws.rs.ext.RuntimeDelegate, then the value of that entry is used
as the name of the implementation class.
If a system property with the name javax.ws.rs.ext.RuntimeDelegate is
defined, then its value is used as the name of the implementation class.
Finally, a default implementation class name is used. *


On Wed, Feb 9, 2011 at 11:29 AM, Pradeep Fernando <[hidden email]>wrote:

> hi all,
>
>
> Got it resolved. My fault. class loading issue. sorry for the unwanted
> noise here in the list.
> BTW, can somebody tell me what is the approach use by wink to specify
> the runtime delegate class (spec defines several options.). right now
> I'm using JVM property for my test purposes.
>
> thanks all for your help.
> --Pradeep
>
Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Pradeep Fernando
hi Michael,

I went through the spec and I'm aware of the above parts. What I'm
asking is how wink runtime , specifies its runtimeDelegate by default.

as of my understanding,
* is is not by defining a JRE property
* not under META-INF/services.
* obviously it is not using the com.sun.RuntimeDelegate.

so it should be set programatically, i guess.  just need a clarification.

thanks,
--Pradeep.
Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Michael Elman
Administrator
It's under META-INF/services
See wink-common.jar

On Wed, Feb 9, 2011 at 12:49 PM, Pradeep Fernando <[hidden email]>wrote:

> hi Michael,
>
> I went through the spec and I'm aware of the above parts. What I'm
> asking is how wink runtime , specifies its runtimeDelegate by default.
>
> as of my understanding,
> * is is not by defining a JRE property
> * not under META-INF/services.
> * obviously it is not using the com.sun.RuntimeDelegate.
>
> so it should be set programatically, i guess.  just need a clarification.
>
> thanks,
> --Pradeep.
>
Reply | Threaded
Open this post in threaded view
|

Re: Need some help with the public API

Pradeep Fernando
hi,

On Wed, Feb 9, 2011 at 4:50 PM, Michael Elman <[hidden email]> wrote:
> It's under META-INF/services
> See wink-common.jar

thanks Michael.

--Pradeep

>
> On Wed, Feb 9, 2011 at 12:49 PM, Pradeep Fernando <[hidden email]>wrote:
>
>> hi Michael,
>>
>> I went through the spec and I'm aware of the above parts. What I'm
>> asking is how wink runtime , specifies its runtimeDelegate by default.
>>
>> as of my understanding,
>> * is is not by defining a JRE property
>> * not under META-INF/services.
>> * obviously it is not using the com.sun.RuntimeDelegate.
>>
>> so it should be set programatically, i guess.  just need a clarification.
>>
>> thanks,
>> --Pradeep.
>>
>



--
Pradeep Fernando.
http://pradeepfernando.blogspot.com/