简体   繁体   中英

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 deployed on 6.1 and I can't seem to get it to deploy in the new Fuse 6.2. This simple Rest service keeps getting the following error when I deploy to the Fuse environment.

Any ideas would be greatly appreciated.

THis issue suggests removing the javax.ws.rs/javax.ws.rs-api/2.0.1 bundle file from Fuse. The bundle start cleanly without error however the REST service is not accessible for some reason.

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

I need to investigate the feature Swagger as it starts automatically.

Error :

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>

I got the same error. It was caused by a dependency on an 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 CXF 3.x needs java rs api 2.0. So I added that explicitly:

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

In the 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM