You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rene Svetina <re...@gmail.com> on 2011/09/25 14:12:34 UTC

Problems with JAX-RS

Hello,

i have problems with getting JAX-RS services working.

Spring configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
http://www.springframework.org/schema/context"
    xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
            http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-3.1.xsd
            http://cxf.apache.org/jaxrs
            http://cxf.apache.org/schemas/jaxrs.xsd"
>

    <jaxrs:server address="/">
        <jaxrs:serviceBeans>
            <ref bean="iskanje" />
        </jaxrs:serviceBeans>
    </jaxrs:server>

    <bean id="iskanje" class="org.raziskovalec.service.Iskanje"></bean>

</beans>

Service class:
package org.raziskovalec.service;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Path("iskanje")
@Produces("text/plain")
public class Iskanje
{
    private final Logger logger = LoggerFactory.getLogger(getClass());
    @GET
    public String getTest()
    {
        logger.trace("called");
        return "lala";
    }
}

The problem is if i chnge address to something else than / i always on any
url get service-list html and if it is / than i get 404.
If i change @Path to / than it works.
-- 
Rene Svetina

Re: Problems with JAX-RS

Posted by Rene Svetina <re...@gmail.com>.
I get 404 back and i am using 2.4.2.
Form me now works like this
raziskovalec-service is application name in tomcat
web.xml is mapped to /
address on jaxrs:service is /
@Path("iskanje") is on the method i did not try it on class yet.

On Sun, Sep 25, 2011 at 6:00 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
>
>
> On 25/09/11 14:00, Rene Svetina wrote:
>
>> Nope still nothind but i found out that when i request on URL
>> http://localhost:8080/**raziskovalec-service/services/**iskanje<http://localhost:8080/raziskovalec-service/services/iskanje>it does work.
>> Don't know why.
>>
>
> Was it when you had @Path("/") on the resource class, that would explain
> it, given that you also have a "/" uri mapping.
>
> I've tried adding "services" in the test, where resource endpoint is
> published at localhost:8080 and the resource class starting from
> "/bookstore" and I did get 404 back.
>
> Can you explain again, what happens when you have
>
> @Path("iskanje") ?
>
> GET /raziskovalec-service/iskanje
>
> has to work. Which CXF version do you use ?
>
> Cheers, Sergey
>
>
>
>> On Sun, Sep 25, 2011 at 2:57 PM, Kiren Pillay<ki...@gmail.com>**
>> wrote:
>>
>>  Maybe you missing the "/" in front of the path?
>>>
>>> @Path("/iskanje")
>>>
>>>
>>>
>>> On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina<rene.svetina@gmail.com**>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> i have problems with getting JAX-RS services working.
>>>>
>>>> Spring configuration
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <beans xmlns="http://www.**springframework.org/schema/**beans<http://www.springframework.org/schema/beans>"
>>>> xmlns:xsi="
>>>> http://www.w3.org/2001/**XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>
>>>> "
>>>>    xmlns:jaxrs="http://cxf.**apache.org/jaxrs<http://cxf.apache.org/jaxrs>"
>>>> xmlns:context="
>>>> http://www.springframework.**org/schema/context<http://www.springframework.org/schema/context>
>>>> "
>>>>    xsi:schemaLocation="
>>>>            http://www.springframework.**org/schema/beans<http://www.springframework.org/schema/beans>
>>>>
>>>>  http://www.springframework.**org/schema/beans/spring-beans-**3.1.xsd<http://www.springframework.org/schema/beans/spring-beans-3.1.xsd>
>>>
>>>>            http://www.springframework.**org/schema/context<http://www.springframework.org/schema/context>
>>>>
>>>> http://www.springframework.**org/schema/context/spring-**
>>>> context-3.1.xsd<http://www.springframework.org/schema/context/spring-context-3.1.xsd>
>>>>            http://cxf.apache.org/jaxrs
>>>>            http://cxf.apache.org/schemas/**jaxrs.xsd<http://cxf.apache.org/schemas/jaxrs.xsd>
>>>> "
>>>>
>>>>>
>>>>>
>>>>    <jaxrs:server address="/">
>>>>        <jaxrs:serviceBeans>
>>>>            <ref bean="iskanje" />
>>>>        </jaxrs:serviceBeans>
>>>>    </jaxrs:server>
>>>>
>>>>    <bean id="iskanje" class="org.raziskovalec.**
>>>> service.Iskanje"></bean>
>>>>
>>>> </beans>
>>>>
>>>> Service class:
>>>> package org.raziskovalec.service;
>>>>
>>>> import javax.ws.rs.GET;
>>>> import javax.ws.rs.Path;
>>>> import javax.ws.rs.Produces;
>>>>
>>>> import org.slf4j.Logger;
>>>> import org.slf4j.LoggerFactory;
>>>>
>>>> @Path("iskanje")
>>>> @Produces("text/plain")
>>>> public class Iskanje
>>>> {
>>>>    private final Logger logger = LoggerFactory.getLogger(**getClass());
>>>>    @GET
>>>>    public String getTest()
>>>>    {
>>>>        logger.trace("called");
>>>>        return "lala";
>>>>    }
>>>> }
>>>>
>>>> The problem is if i chnge address to something else than / i always on
>>>>
>>> any
>>>
>>>> url get service-list html and if it is / than i get 404.
>>>> If i change @Path to / than it works.
>>>> --
>>>> Rene Svetina
>>>>
>>>>
>>>
>>
>>
>>
>


-- 
Rene Svetina

Re: Problems with JAX-RS

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi


On 25/09/11 14:00, Rene Svetina wrote:
> Nope still nothind but i found out that when i request on URL
> http://localhost:8080/raziskovalec-service/services/iskanje it does work.
> Don't know why.

Was it when you had @Path("/") on the resource class, that would explain 
it, given that you also have a "/" uri mapping.

I've tried adding "services" in the test, where resource endpoint is 
published at localhost:8080 and the resource class starting from 
"/bookstore" and I did get 404 back.

Can you explain again, what happens when you have

@Path("iskanje") ?

GET /raziskovalec-service/iskanje

has to work. Which CXF version do you use ?

Cheers, Sergey

>
> On Sun, Sep 25, 2011 at 2:57 PM, Kiren Pillay<ki...@gmail.com>wrote:
>
>> Maybe you missing the "/" in front of the path?
>>
>> @Path("/iskanje")
>>
>>
>>
>> On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina<re...@gmail.com>
>> wrote:
>>> Hello,
>>>
>>> i have problems with getting JAX-RS services working.
>>>
>>> Spring configuration
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance"
>>>     xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
>>> http://www.springframework.org/schema/context"
>>>     xsi:schemaLocation="
>>>             http://www.springframework.org/schema/beans
>>>
>> http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
>>>             http://www.springframework.org/schema/context
>>>
>>> http://www.springframework.org/schema/context/spring-context-3.1.xsd
>>>             http://cxf.apache.org/jaxrs
>>>             http://cxf.apache.org/schemas/jaxrs.xsd"
>>>>
>>>
>>>     <jaxrs:server address="/">
>>>         <jaxrs:serviceBeans>
>>>             <ref bean="iskanje" />
>>>         </jaxrs:serviceBeans>
>>>     </jaxrs:server>
>>>
>>>     <bean id="iskanje" class="org.raziskovalec.service.Iskanje"></bean>
>>>
>>> </beans>
>>>
>>> Service class:
>>> package org.raziskovalec.service;
>>>
>>> import javax.ws.rs.GET;
>>> import javax.ws.rs.Path;
>>> import javax.ws.rs.Produces;
>>>
>>> import org.slf4j.Logger;
>>> import org.slf4j.LoggerFactory;
>>>
>>> @Path("iskanje")
>>> @Produces("text/plain")
>>> public class Iskanje
>>> {
>>>     private final Logger logger = LoggerFactory.getLogger(getClass());
>>>     @GET
>>>     public String getTest()
>>>     {
>>>         logger.trace("called");
>>>         return "lala";
>>>     }
>>> }
>>>
>>> The problem is if i chnge address to something else than / i always on
>> any
>>> url get service-list html and if it is / than i get 404.
>>> If i change @Path to / than it works.
>>> --
>>> Rene Svetina
>>>
>>
>
>
>


Re: Problems with JAX-RS

Posted by Rene Svetina <re...@gmail.com>.
Mapping is ok i think
<web-app>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/beans.xml</param-value>
	</context-param>

	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<servlet>
		<servlet-name>CXFServlet</servlet-name>
		<display-name>CXF Servlet</display-name>
		<servlet-class>
			org.apache.cxf.transport.servlet.CXFServlet
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping></web-app>



On Sun, Sep 25, 2011 at 3:50 PM, Kiren Pillay <ki...@gmail.com>wrote:

> Okay i see. What does your servlet mapping look like?
> On Sep 25, 2011 3:10 PM, "Rene Svetina" <re...@gmail.com> wrote:
> >
> > i don't see anywhere that i should use services in URL.
> >
> > http://cxf.apache.org/docs/jax-rs.html#JAX-RS-HowRequestURIisMatched
> >
> > On Sun, Sep 25, 2011 at 3:05 PM, Kiren Pillay <kirenpillay1@gmail.com
> >wrote:
> >
> > > Okay, but this is the way its supposed to work. The Path annotations
> > > defines the location of the resource, so its behaving as expected.
> > >
> > > On Sun, Sep 25, 2011 at 3:00 PM, Rene Svetina <re...@gmail.com>
> > > wrote:
> > > > Nope still nothind but i found out that when i request on URL
> > > > http://localhost:8080/raziskovalec-service/services/iskanje it does
> > > work.
> > > > Don't know why.
> > > >
> > > > On Sun, Sep 25, 2011 at 2:57 PM, Kiren Pillay <
> kirenpillay1@gmail.com
> > > >wrote:
> > > >
> > > >> Maybe you missing the "/" in front of the path?
> > > >>
> > > >> @Path("/iskanje")
> > > >>
> > > >>
> > > >>
> > > >> On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina <
> rene.svetina@gmail.com
> >
> > > >> wrote:
> > > >> > Hello,
> > > >> >
> > > >> > i have problems with getting JAX-RS services working.
> > > >> >
> > > >> > Spring configuration
> > > >> > <?xml version="1.0" encoding="UTF-8"?>
> > > >> > <beans xmlns="http://www.springframework.org/schema/beans"
> > > xmlns:xsi="
> > > >> > http://www.w3.org/2001/XMLSchema-instance"
> > > >> >    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
> > > >> > http://www.springframework.org/schema/context"
> > > >> >    xsi:schemaLocation="
> > > >> >            http://www.springframework.org/schema/beans
> > > >> >
> > > >> http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
> > > >> >            http://www.springframework.org/schema/context
> > > >> >
> > > >> >
> http://www.springframework.org/schema/context/spring-context-3.1.xsd
> > > >> >            http://cxf.apache.org/jaxrs
> > > >> >            http://cxf.apache.org/schemas/jaxrs.xsd"
> > > >> >>
> > > >> >
> > > >> >    <jaxrs:server address="/">
> > > >> >        <jaxrs:serviceBeans>
> > > >> >            <ref bean="iskanje" />
> > > >> >        </jaxrs:serviceBeans>
> > > >> >    </jaxrs:server>
> > > >> >
> > > >> >    <bean id="iskanje"
> class="org.raziskovalec.service.Iskanje"></bean>
> > > >> >
> > > >> > </beans>
> > > >> >
> > > >> > Service class:
> > > >> > package org.raziskovalec.service;
> > > >> >
> > > >> > import javax.ws.rs.GET;
> > > >> > import javax.ws.rs.Path;
> > > >> > import javax.ws.rs.Produces;
> > > >> >
> > > >> > import org.slf4j.Logger;
> > > >> > import org.slf4j.LoggerFactory;
> > > >> >
> > > >> > @Path("iskanje")
> > > >> > @Produces("text/plain")
> > > >> > public class Iskanje
> > > >> > {
> > > >> >    private final Logger logger =
> LoggerFactory.getLogger(getClass());
> > > >> >    @GET
> > > >> >    public String getTest()
> > > >> >    {
> > > >> >        logger.trace("called");
> > > >> >        return "lala";
> > > >> >    }
> > > >> > }
> > > >> >
> > > >> > The problem is if i chnge address to something else than / i
> always
> on
> > > >> any
> > > >> > url get service-list html and if it is / than i get 404.
> > > >> > If i change @Path to / than it works.
> > > >> > --
> > > >> > Rene Svetina
> > > >> >
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > Rene Svetina
> > > >
> > >
> >
> >
> >
> > --
> > Rene Svetina
>



-- 
Rene Svetina

Re: Problems with JAX-RS

Posted by Kiren Pillay <ki...@gmail.com>.
Okay i see. What does your servlet mapping look like?
On Sep 25, 2011 3:10 PM, "Rene Svetina" <re...@gmail.com> wrote:
>
> i don't see anywhere that i should use services in URL.
>
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-HowRequestURIisMatched
>
> On Sun, Sep 25, 2011 at 3:05 PM, Kiren Pillay <kirenpillay1@gmail.com
>wrote:
>
> > Okay, but this is the way its supposed to work. The Path annotations
> > defines the location of the resource, so its behaving as expected.
> >
> > On Sun, Sep 25, 2011 at 3:00 PM, Rene Svetina <re...@gmail.com>
> > wrote:
> > > Nope still nothind but i found out that when i request on URL
> > > http://localhost:8080/raziskovalec-service/services/iskanje it does
> > work.
> > > Don't know why.
> > >
> > > On Sun, Sep 25, 2011 at 2:57 PM, Kiren Pillay <kirenpillay1@gmail.com
> > >wrote:
> > >
> > >> Maybe you missing the "/" in front of the path?
> > >>
> > >> @Path("/iskanje")
> > >>
> > >>
> > >>
> > >> On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina <rene.svetina@gmail.com
>
> > >> wrote:
> > >> > Hello,
> > >> >
> > >> > i have problems with getting JAX-RS services working.
> > >> >
> > >> > Spring configuration
> > >> > <?xml version="1.0" encoding="UTF-8"?>
> > >> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="
> > >> > http://www.w3.org/2001/XMLSchema-instance"
> > >> >    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
> > >> > http://www.springframework.org/schema/context"
> > >> >    xsi:schemaLocation="
> > >> >            http://www.springframework.org/schema/beans
> > >> >
> > >> http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
> > >> >            http://www.springframework.org/schema/context
> > >> >
> > >> >
http://www.springframework.org/schema/context/spring-context-3.1.xsd
> > >> >            http://cxf.apache.org/jaxrs
> > >> >            http://cxf.apache.org/schemas/jaxrs.xsd"
> > >> >>
> > >> >
> > >> >    <jaxrs:server address="/">
> > >> >        <jaxrs:serviceBeans>
> > >> >            <ref bean="iskanje" />
> > >> >        </jaxrs:serviceBeans>
> > >> >    </jaxrs:server>
> > >> >
> > >> >    <bean id="iskanje"
class="org.raziskovalec.service.Iskanje"></bean>
> > >> >
> > >> > </beans>
> > >> >
> > >> > Service class:
> > >> > package org.raziskovalec.service;
> > >> >
> > >> > import javax.ws.rs.GET;
> > >> > import javax.ws.rs.Path;
> > >> > import javax.ws.rs.Produces;
> > >> >
> > >> > import org.slf4j.Logger;
> > >> > import org.slf4j.LoggerFactory;
> > >> >
> > >> > @Path("iskanje")
> > >> > @Produces("text/plain")
> > >> > public class Iskanje
> > >> > {
> > >> >    private final Logger logger =
LoggerFactory.getLogger(getClass());
> > >> >    @GET
> > >> >    public String getTest()
> > >> >    {
> > >> >        logger.trace("called");
> > >> >        return "lala";
> > >> >    }
> > >> > }
> > >> >
> > >> > The problem is if i chnge address to something else than / i always
on
> > >> any
> > >> > url get service-list html and if it is / than i get 404.
> > >> > If i change @Path to / than it works.
> > >> > --
> > >> > Rene Svetina
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > Rene Svetina
> > >
> >
>
>
>
> --
> Rene Svetina

Re: Problems with JAX-RS

Posted by Rene Svetina <re...@gmail.com>.
i don't see anywhere that i should use services in URL.

http://cxf.apache.org/docs/jax-rs.html#JAX-RS-HowRequestURIisMatched

On Sun, Sep 25, 2011 at 3:05 PM, Kiren Pillay <ki...@gmail.com>wrote:

> Okay, but this is the way its supposed to work. The Path annotations
> defines the location of the resource, so its behaving as expected.
>
> On Sun, Sep 25, 2011 at 3:00 PM, Rene Svetina <re...@gmail.com>
> wrote:
> > Nope still nothind but i found out that when i request on URL
> > http://localhost:8080/raziskovalec-service/services/iskanje it does
> work.
> > Don't know why.
> >
> > On Sun, Sep 25, 2011 at 2:57 PM, Kiren Pillay <kirenpillay1@gmail.com
> >wrote:
> >
> >> Maybe you missing the "/" in front of the path?
> >>
> >> @Path("/iskanje")
> >>
> >>
> >>
> >> On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina <re...@gmail.com>
> >> wrote:
> >> > Hello,
> >> >
> >> > i have problems with getting JAX-RS services working.
> >> >
> >> > Spring configuration
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="
> >> > http://www.w3.org/2001/XMLSchema-instance"
> >> >    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
> >> > http://www.springframework.org/schema/context"
> >> >    xsi:schemaLocation="
> >> >            http://www.springframework.org/schema/beans
> >> >
> >> http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
> >> >            http://www.springframework.org/schema/context
> >> >
> >> > http://www.springframework.org/schema/context/spring-context-3.1.xsd
> >> >            http://cxf.apache.org/jaxrs
> >> >            http://cxf.apache.org/schemas/jaxrs.xsd"
> >> >>
> >> >
> >> >    <jaxrs:server address="/">
> >> >        <jaxrs:serviceBeans>
> >> >            <ref bean="iskanje" />
> >> >        </jaxrs:serviceBeans>
> >> >    </jaxrs:server>
> >> >
> >> >    <bean id="iskanje" class="org.raziskovalec.service.Iskanje"></bean>
> >> >
> >> > </beans>
> >> >
> >> > Service class:
> >> > package org.raziskovalec.service;
> >> >
> >> > import javax.ws.rs.GET;
> >> > import javax.ws.rs.Path;
> >> > import javax.ws.rs.Produces;
> >> >
> >> > import org.slf4j.Logger;
> >> > import org.slf4j.LoggerFactory;
> >> >
> >> > @Path("iskanje")
> >> > @Produces("text/plain")
> >> > public class Iskanje
> >> > {
> >> >    private final Logger logger = LoggerFactory.getLogger(getClass());
> >> >    @GET
> >> >    public String getTest()
> >> >    {
> >> >        logger.trace("called");
> >> >        return "lala";
> >> >    }
> >> > }
> >> >
> >> > The problem is if i chnge address to something else than / i always on
> >> any
> >> > url get service-list html and if it is / than i get 404.
> >> > If i change @Path to / than it works.
> >> > --
> >> > Rene Svetina
> >> >
> >>
> >
> >
> >
> > --
> > Rene Svetina
> >
>



-- 
Rene Svetina

Re: Problems with JAX-RS

Posted by Kiren Pillay <ki...@gmail.com>.
Okay, but this is the way its supposed to work. The Path annotations
defines the location of the resource, so its behaving as expected.

On Sun, Sep 25, 2011 at 3:00 PM, Rene Svetina <re...@gmail.com> wrote:
> Nope still nothind but i found out that when i request on URL
> http://localhost:8080/raziskovalec-service/services/iskanje it does work.
> Don't know why.
>
> On Sun, Sep 25, 2011 at 2:57 PM, Kiren Pillay <ki...@gmail.com>wrote:
>
>> Maybe you missing the "/" in front of the path?
>>
>> @Path("/iskanje")
>>
>>
>>
>> On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina <re...@gmail.com>
>> wrote:
>> > Hello,
>> >
>> > i have problems with getting JAX-RS services working.
>> >
>> > Spring configuration
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
>> > http://www.w3.org/2001/XMLSchema-instance"
>> >    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
>> > http://www.springframework.org/schema/context"
>> >    xsi:schemaLocation="
>> >            http://www.springframework.org/schema/beans
>> >
>> http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
>> >            http://www.springframework.org/schema/context
>> >
>> > http://www.springframework.org/schema/context/spring-context-3.1.xsd
>> >            http://cxf.apache.org/jaxrs
>> >            http://cxf.apache.org/schemas/jaxrs.xsd"
>> >>
>> >
>> >    <jaxrs:server address="/">
>> >        <jaxrs:serviceBeans>
>> >            <ref bean="iskanje" />
>> >        </jaxrs:serviceBeans>
>> >    </jaxrs:server>
>> >
>> >    <bean id="iskanje" class="org.raziskovalec.service.Iskanje"></bean>
>> >
>> > </beans>
>> >
>> > Service class:
>> > package org.raziskovalec.service;
>> >
>> > import javax.ws.rs.GET;
>> > import javax.ws.rs.Path;
>> > import javax.ws.rs.Produces;
>> >
>> > import org.slf4j.Logger;
>> > import org.slf4j.LoggerFactory;
>> >
>> > @Path("iskanje")
>> > @Produces("text/plain")
>> > public class Iskanje
>> > {
>> >    private final Logger logger = LoggerFactory.getLogger(getClass());
>> >    @GET
>> >    public String getTest()
>> >    {
>> >        logger.trace("called");
>> >        return "lala";
>> >    }
>> > }
>> >
>> > The problem is if i chnge address to something else than / i always on
>> any
>> > url get service-list html and if it is / than i get 404.
>> > If i change @Path to / than it works.
>> > --
>> > Rene Svetina
>> >
>>
>
>
>
> --
> Rene Svetina
>

Re: Problems with JAX-RS

Posted by Rene Svetina <re...@gmail.com>.
Nope still nothind but i found out that when i request on URL
http://localhost:8080/raziskovalec-service/services/iskanje it does work.
Don't know why.

On Sun, Sep 25, 2011 at 2:57 PM, Kiren Pillay <ki...@gmail.com>wrote:

> Maybe you missing the "/" in front of the path?
>
> @Path("/iskanje")
>
>
>
> On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina <re...@gmail.com>
> wrote:
> > Hello,
> >
> > i have problems with getting JAX-RS services working.
> >
> > Spring configuration
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
> > http://www.w3.org/2001/XMLSchema-instance"
> >    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
> > http://www.springframework.org/schema/context"
> >    xsi:schemaLocation="
> >            http://www.springframework.org/schema/beans
> >
> http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
> >            http://www.springframework.org/schema/context
> >
> > http://www.springframework.org/schema/context/spring-context-3.1.xsd
> >            http://cxf.apache.org/jaxrs
> >            http://cxf.apache.org/schemas/jaxrs.xsd"
> >>
> >
> >    <jaxrs:server address="/">
> >        <jaxrs:serviceBeans>
> >            <ref bean="iskanje" />
> >        </jaxrs:serviceBeans>
> >    </jaxrs:server>
> >
> >    <bean id="iskanje" class="org.raziskovalec.service.Iskanje"></bean>
> >
> > </beans>
> >
> > Service class:
> > package org.raziskovalec.service;
> >
> > import javax.ws.rs.GET;
> > import javax.ws.rs.Path;
> > import javax.ws.rs.Produces;
> >
> > import org.slf4j.Logger;
> > import org.slf4j.LoggerFactory;
> >
> > @Path("iskanje")
> > @Produces("text/plain")
> > public class Iskanje
> > {
> >    private final Logger logger = LoggerFactory.getLogger(getClass());
> >    @GET
> >    public String getTest()
> >    {
> >        logger.trace("called");
> >        return "lala";
> >    }
> > }
> >
> > The problem is if i chnge address to something else than / i always on
> any
> > url get service-list html and if it is / than i get 404.
> > If i change @Path to / than it works.
> > --
> > Rene Svetina
> >
>



-- 
Rene Svetina

Re: Problems with JAX-RS

Posted by Kiren Pillay <ki...@gmail.com>.
Maybe you missing the "/" in front of the path?

@Path("/iskanje")



On Sun, Sep 25, 2011 at 2:12 PM, Rene Svetina <re...@gmail.com> wrote:
> Hello,
>
> i have problems with getting JAX-RS services working.
>
> Spring configuration
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="
> http://www.springframework.org/schema/context"
>    xsi:schemaLocation="
>            http://www.springframework.org/schema/beans
>            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
>            http://www.springframework.org/schema/context
>
> http://www.springframework.org/schema/context/spring-context-3.1.xsd
>            http://cxf.apache.org/jaxrs
>            http://cxf.apache.org/schemas/jaxrs.xsd"
>>
>
>    <jaxrs:server address="/">
>        <jaxrs:serviceBeans>
>            <ref bean="iskanje" />
>        </jaxrs:serviceBeans>
>    </jaxrs:server>
>
>    <bean id="iskanje" class="org.raziskovalec.service.Iskanje"></bean>
>
> </beans>
>
> Service class:
> package org.raziskovalec.service;
>
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
>
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> @Path("iskanje")
> @Produces("text/plain")
> public class Iskanje
> {
>    private final Logger logger = LoggerFactory.getLogger(getClass());
>    @GET
>    public String getTest()
>    {
>        logger.trace("called");
>        return "lala";
>    }
> }
>
> The problem is if i chnge address to something else than / i always on any
> url get service-list html and if it is / than i get 404.
> If i change @Path to / than it works.
> --
> Rene Svetina
>