You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Miguel Tinte <mi...@gmail.com> on 2011/09/22 16:09:26 UTC

Re: HTTP ERROR 500

> Hi,
> I am using Wink to access via REST service to a SCA component deployed in
> http://localhost:8080/component. When I load my REST request by adding
> "/hello" to the previous URL it returns:
>
>     INTERNAL_SERVER_ERROR
>
> Caused by:
>
> java.lang.NullPointerException
> 	at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139)
>
> Any idea?
>
> Thanks in advance
>

Re: HTTP ERROR 500

Posted by Mike Whale <mw...@gmail.com>.
Your interface is componentservice but your are implementing
icomponentservice.

Sent from the droid.....
Mike Whale
http://at-it.blogspot.com/

Re: HTTP ERROR 500

Posted by Luciano Resende <lu...@gmail.com>.
On Thu, Sep 22, 2011 at 7:41 AM, Miguel Tinte <mi...@gmail.com> wrote:
> Hi Serafín,
> this is the request code:
>
> INTERFACES:
> @Remotable
> public interface ComponentService {
>     // This method is called if XML is request
>     @GET
>     @Path("/hello")
>     @Consumes(MediaType.APPLICATION_XML)
>     public String sayXMLHello();
> ...
> @Remotable
> public interface JaxrsComponentService {
>     // This method is called if XML is request
>     @GET
>     @Path("/hello")
>     @Consumes(MediaType.APPLICATION_XML)
>     public String sayXMLHello();
>
>
> IMPLEMENTATION:
> @Service(JaxrsComponentService.class)
> public class ComponentCaller implements JaxrsComponentService,
> IComponentService {
>     @Reference
>     private IComponentService componentService;
>     public String sayXMLHello() {
>         return "<?xml version=\"1.0\"?>" + "<hello> Hello World!" +
> "</hello>";
>     }
> ...
>
> Regards
>

Could you try two things :
   - Remove consumes
   - Change consumes to text

The issue is that the browser is not sending XML (and xml related
headers) to the service. But also, you are actually producing xml from
your example, and not consuming xml.

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Re: HTTP ERROR 500

Posted by Raymond Feng <en...@gmail.com>.
Which version/brand of the browser? Can you try a different one?

Browsers usually set the Accept header.

Raymond Feng
Sent from my iPhone

On Sep 22, 2011, at 9:13 AM, Miguel Tinte <mi...@gmail.com> wrote:

> Yes, it's a browser
> 
> 2011/9/22 Raymond Feng <en...@gmail.com>
> What's your rest client? A browser?
> 
> Raymond Feng
> Sent from my iPhone
> 
> On Sep 22, 2011, at 7:41 AM, Miguel Tinte <mi...@gmail.com> wrote:
> 
>> Hi Serafín,
>> this is the request code:
>> 
>> INTERFACES:
>> @Remotable
>> public interface ComponentService { 
>>     // This method is called if XML is request
>>     @GET
>>     @Path("/hello")
>>     @Consumes(MediaType.APPLICATION_XML)
>>     public String sayXMLHello();
>> ...
>> @Remotable
>> public interface JaxrsComponentService {
>>     // This method is called if XML is request
>>     @GET
>>     @Path("/hello")
>>     @Consumes(MediaType.APPLICATION_XML)
>>     public String sayXMLHello();
>> 
>> 
>> IMPLEMENTATION:
>> @Service(JaxrsComponentService.class)
>> public class ComponentCaller implements JaxrsComponentService, IComponentService {
>>     @Reference
>>     private IComponentService componentService;
>>     public String sayXMLHello() {
>>         return "<?xml version=\"1.0\"?>" + "<hello> Hello World!" + "</hello>";
>>     }
>> ...
>> 
>> Regards
>> 
>> 
>> 2011/9/22 Serafin Sedano <se...@abiquo.com>
>> It looks like you are either omitting the "Accept: " header or the Service API has defined an empty @Consumes.
>> 
>> Since it is a 500 I bet the service is wrong.
>> 
>> Please add the actual request you are performing.
>> 
>> Kind regards.
>> 
>> Serafín. 
>> 
>> 2011/9/22 Miguel Tinte <mi...@gmail.com>
>> 
>> Hi,
>> I am using Wink to access via REST service to a SCA component deployed in http://localhost:8080/component. When I load my REST request by adding "/hello" to the previous URL it returns:
>>     INTERNAL_SERVER_ERROR
>> Caused by:
>> 
>> java.lang.NullPointerException
>> 	at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139)
>> 
>> Any idea?
>> 
>> Thanks in advance 
>> 
>> 
>> 
> 

Re: HTTP ERROR 500

Posted by Miguel Tinte <mi...@gmail.com>.
Yes, it's a browser

2011/9/22 Raymond Feng <en...@gmail.com>

> What's your rest client? A browser?
>
> Raymond Feng
> Sent from my iPhone
>
> On Sep 22, 2011, at 7:41 AM, Miguel Tinte <mi...@gmail.com> wrote:
>
> Hi Serafín,
> this is the request code:
>
> *INTERFACES:*
> @Remotable
> public interface ComponentService {
>     // This method is called if XML is request
>     @GET
>     @Path("/hello")
>     @Consumes(MediaType.APPLICATION_XML)
>     public String sayXMLHello();
> ...
> @Remotable
> public interface JaxrsComponentService {
>     // This method is called if XML is request
>     @GET
>     @Path("/hello")
>     @Consumes(MediaType.APPLICATION_XML)
>     public String sayXMLHello();
>
>
> *IMPLEMENTATION:*
> @Service(JaxrsComponentService.class)
> public class ComponentCaller implements JaxrsComponentService,
> IComponentService {
>     @Reference
>     private IComponentService componentService;
>     public String sayXMLHello() {
>         return "<?xml version=\"1.0\"?>" + "<hello> Hello World!" +
> "</hello>";
>     }
> ...
>
> Regards
>
>
> 2011/9/22 Serafin Sedano < <se...@abiquo.com>
> serafin.sedano@abiquo.com>
>
>> It looks like you are either omitting the "Accept: " header or the Service
>> API has defined an empty @Consumes.
>>
>> Since it is a 500 I bet the service is wrong.
>>
>> Please add the actual request you are performing.
>>
>> Kind regards.
>>
>> Serafín.
>>
>> 2011/9/22 Miguel Tinte < <mi...@gmail.com>
>>
>>>
>>> Hi,
>>>> I am using Wink to access via REST service to a SCA component deployed
>>>> in <http://localhost:8080/component>http://localhost:8080/component.
>>>> When I load my REST request by adding "/hello" to the previous URL it
>>>> returns:
>>>>
>>>>     INTERNAL_SERVER_ERROR
>>>>
>>>> Caused by:
>>>>
>>>> java.lang.NullPointerException
>>>> 	at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139)
>>>>
>>>> Any idea?
>>>>
>>>> Thanks in advance
>>>>
>>>
>>>
>>
>

Re: HTTP ERROR 500

Posted by Raymond Feng <en...@gmail.com>.
What's your rest client? A browser?

Raymond Feng
Sent from my iPhone

On Sep 22, 2011, at 7:41 AM, Miguel Tinte <mi...@gmail.com> wrote:

> Hi Serafín,
> this is the request code:
> 
> INTERFACES:
> @Remotable
> public interface ComponentService { 
>     // This method is called if XML is request
>     @GET
>     @Path("/hello")
>     @Consumes(MediaType.APPLICATION_XML)
>     public String sayXMLHello();
> ...
> @Remotable
> public interface JaxrsComponentService {
>     // This method is called if XML is request
>     @GET
>     @Path("/hello")
>     @Consumes(MediaType.APPLICATION_XML)
>     public String sayXMLHello();
> 
> 
> IMPLEMENTATION:
> @Service(JaxrsComponentService.class)
> public class ComponentCaller implements JaxrsComponentService, IComponentService {
>     @Reference
>     private IComponentService componentService;
>     public String sayXMLHello() {
>         return "<?xml version=\"1.0\"?>" + "<hello> Hello World!" + "</hello>";
>     }
> ...
> 
> Regards
> 
> 
> 2011/9/22 Serafin Sedano <se...@abiquo.com>
> It looks like you are either omitting the "Accept: " header or the Service API has defined an empty @Consumes.
> 
> Since it is a 500 I bet the service is wrong.
> 
> Please add the actual request you are performing.
> 
> Kind regards.
> 
> Serafín. 
> 
> 2011/9/22 Miguel Tinte <mi...@gmail.com>
> 
> Hi,
> I am using Wink to access via REST service to a SCA component deployed in http://localhost:8080/component. When I load my REST request by adding "/hello" to the previous URL it returns:
>     INTERNAL_SERVER_ERROR
> Caused by:
> 
> java.lang.NullPointerException
> 	at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139)
> 
> Any idea?
> 
> Thanks in advance 
> 
> 
> 

Re: HTTP ERROR 500

Posted by Miguel Tinte <mi...@gmail.com>.
Hi Serafín,
this is the request code:

*INTERFACES:*
@Remotable
public interface ComponentService {
    // This method is called if XML is request
    @GET
    @Path("/hello")
    @Consumes(MediaType.APPLICATION_XML)
    public String sayXMLHello();
...
@Remotable
public interface JaxrsComponentService {
    // This method is called if XML is request
    @GET
    @Path("/hello")
    @Consumes(MediaType.APPLICATION_XML)
    public String sayXMLHello();


*IMPLEMENTATION:*
@Service(JaxrsComponentService.class)
public class ComponentCaller implements JaxrsComponentService,
IComponentService {
    @Reference
    private IComponentService componentService;
    public String sayXMLHello() {
        return "<?xml version=\"1.0\"?>" + "<hello> Hello World!" +
"</hello>";
    }
...

Regards


2011/9/22 Serafin Sedano <se...@abiquo.com>

> It looks like you are either omitting the "Accept: " header or the Service
> API has defined an empty @Consumes.
>
> Since it is a 500 I bet the service is wrong.
>
> Please add the actual request you are performing.
>
> Kind regards.
>
> Serafín.
>
> 2011/9/22 Miguel Tinte <mi...@gmail.com>
>
>>
>> Hi,
>>> I am using Wink to access via REST service to a SCA component deployed in
>>> http://localhost:8080/component. When I load my REST request by adding
>>> "/hello" to the previous URL it returns:
>>>
>>>     INTERNAL_SERVER_ERROR
>>>
>>> Caused by:
>>>
>>> java.lang.NullPointerException
>>> 	at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139)
>>>
>>> Any idea?
>>>
>>> Thanks in advance
>>>
>>
>>
>

Re: HTTP ERROR 500

Posted by Serafin Sedano <se...@abiquo.com>.
It looks like you are either omitting the "Accept: " header or the Service
API has defined an empty @Consumes.

Since it is a 500 I bet the service is wrong.

Please add the actual request you are performing.

Kind regards.

Serafín.

2011/9/22 Miguel Tinte <mi...@gmail.com>

>
> Hi,
>> I am using Wink to access via REST service to a SCA component deployed in
>> http://localhost:8080/component. When I load my REST request by adding
>> "/hello" to the previous URL it returns:
>>
>>     INTERNAL_SERVER_ERROR
>>
>> Caused by:
>>
>> java.lang.NullPointerException
>> 	at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139)
>>
>> Any idea?
>>
>> Thanks in advance
>>
>
>