osgicdikarafpax

Apache CXF + Karaf 4.0.8 SAXParseException: 'ptp:ParameterizedInt'


I am trying to Implement PAX-CDI + CXF + Karaf 4.0.8

My REST Service:

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

//Maps for the `say` in the URL

@Path("say")
public interface HelloRestService {
    @GET
    @Path("hello/{name}") //Maps for the `hello/John` in the URL
    public String handleGet(@PathParam("name") String name);}

Rest Service Impl

import javax.inject.Inject;

import org.ops4j.pax.cdi.api.OsgiService;

import ca.esc.pbm.fe.pbm_frontend_jaxrs.api.HelloRestService;
import ca.esc.pbm.fe.pbm_frontend_jaxrs.api.HelloService;

public class HelloRestServiceImpl implements HelloRestService {

    @OsgiService
    @Inject
    private HelloService helloService;

OSGI service Interface

public interface HelloService {
    public String sayHello(String name);}

OSGI Service Provider

import javax.inject.Singleton;

import org.ops4j.pax.cdi.api.OsgiServiceProvider;
import org.ops4j.pax.cdi.api.Properties;
import org.ops4j.pax.cdi.api.Property;

import ca.esc.pbm.fe.pbm_frontend_jaxrs.api.HelloService;

@OsgiServiceProvider(classes = HelloService.class)
@Singleton
public class HelloServiceImpl implements HelloService {

Blue Print

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
    xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws" xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
    xmlns:cxf="http://cxf.apache.org/blueprint/core"
    xsi:schemaLocation="
  http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
  http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
  http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
  http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
    <!-- 1 -->
    <cxf:bus id="cxfBus1">
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>

    <!-- 2 -->
    <jaxrs:server address="/karafsimple" id="someRestService">
        <jaxrs:serviceBeans>
            <ref component-id="restServiceImpl" />
        </jaxrs:serviceBeans>
    </jaxrs:server>

    <!-- 3 -->
    <!-- Implementation of the rest service -->
    <bean id="restServiceImpl"
        class="fe.pbm_frontend_jaxrs.provider.service.HelloRestServiceImpl">

    </bean>


</blueprint>

POM.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>cdi</groupId>
    <artifactId>test</artifactId>
    <version>1.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <cxf.version>3.1.11</cxf.version>
        <scanPath>test</scanPath>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>1.2</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-features-logging</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-management</artifactId>
            <version>${cxf.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.7</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.cdi</groupId>
            <artifactId>pax-cdi-api</artifactId>
            <version>0.5.0</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <optional>true</optional>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-export-maven-plugin</artifactId>
                    <version>3.3.0</version>
                    <configuration>
                        <resolve>true</resolve>
                        <failOnChanges>false</failOnChanges>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>export</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.raml.plugins
                                        </groupId>
                                        <artifactId>
                                            raml-jaxrs-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.3.8,)
                                        </versionRange>
                                        <goals>
                                            <goal>generate</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute></execute>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.aries.blueprint</groupId>
                <artifactId>blueprint-maven-plugin</artifactId>
                <version>1.5.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>blueprint-generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scanPaths>
                        <scanPath>${scanPath}</scanPath>
                    </scanPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>bnd-process</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>

I am using blueprint-maven-plugin to generate the blueprint dynamically

generated blue print autowire.xml

On install in karaf i am getting the following error

**org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'ptp:ParameterizedInt' to a(n) 'type definition' component**.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)[:]
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)[:]
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDAttributeTraverser.traverseNamedAttr(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDAttributeTraverser.traverseLocal(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDAbstractTraverser.traverseAttrsAndAttrGrps(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown Source)[:]
        at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)[:]
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)[:]
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)[:]
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)[:]
        at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)[:]
        at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.createSchema(NamespaceHandlerRegistryImpl.java:628)[12:org.apache.aries.blueprint.core:1.7.1]
        at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.doGetSchema(NamespaceHandlerRegistryImpl.java:458)[12:org.apache.aries.blueprint.core:1.7.1]
        at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl$NamespaceHandlerSetImpl.getSchema(NamespaceHandlerRegistryImpl.java:443)[12:org.apache.aries.blueprint.core:1.7.1]
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:343)[12:org.apache.aries.blueprint.core:1.7.1]
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)[12:org.apache.aries.blueprint.core:1.7.1]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_25]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_25]
        at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[12:org.apache.aries.blueprint.core:1.7.1]
        at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[12:org.apache.aries.blueprint.core:1.7.1]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_25]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_25]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_25]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_25]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_25]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_25]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_25]

Solution

  • This caused by the fire wall block trying to access the

    http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

    Once firewall is fixed it got resolved