Jboss fuse 6.2 rest cxf org.apache.cxf.service.factory.ServiceConstructionException: "No resource classes found"

Just started using Fuse 6.2 from 6.1. This is deployed to 6.1 and I cannot seem to be able to deploy it to the new Fuse 6.2. This simple Rest service keeps getting the following error when deployed to Fuse environment.

Any ideas will be very grateful.

This issue suggests removing the javax.ws.rs/javax.ws.rs-api/2.0.1 package file from Fuse. Startup starts without error, however REST service is not available for some reason.

This link may be applicable: https://issues.apache.org/jira/browse/CXF-5654

I need to investigate the Swagger function when it starts automatically.

Mistake:

Caused by: org.apache.cxf.service.factory.ServiceConstructionException: No resource classes found
        at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:317)
        at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:159)
        ... 29 more

      

Code:

@Path("/configservice")
public class ConfigurationServiceImpl 
{

    public ConfigurationServiceImpl()
    {
    }


    @GET
    @Path("/event0")
    @Consumes({MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_XML})
    public RestConcreteResult process()
    {
        logger.info("************************************** process has been processed");
        RestConcreteResult result = new RestConcreteResult("test ::: ");
        return result;
    }

}

      

pom.xml

...
    <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            </dependency>
        </dependencies>

      

+3


source to share


1 answer


I got the same error. This was caused by a dependency on the old version of javax.ws.rs:

javax.ws.rs;version="[1.1,2)",
javax.ws.rs.core;version="[1.1,2)",

      

https://issues.apache.org/jira/browse/CXF-5654 states that CXF 3.x needs java rs api 2.0. So I added this explicitly:



javax.ws.rs;version="[2.0,3)",
javax.ws.rs.core;version="[2.0,3)",

      

In Maven pom.xml:

        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <executions>
                <execution>
                    <id>Create OSGi bundle</id>
                    <goals>
                        <goal>bundle</goal>
                    </goals>
                    <configuration>
                        <instructions>
                            <Import-Package>
                                META-INF.cxf,
                                org.apache.cxf.bus.spring,
                                javax.ws.rs;version="[2.0,3)",
                                javax.ws.rs.core;version="[2.0,3)",
                                *
                            </Import-Package>
                        </instructions>
                    </configuration>
                </execution>
            </executions>
        </plugin>

      

+3


source







All Articles