cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krystian Panek (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6221) CDI integration extension does not detect annotations on Karaf
Date Wed, 28 Jan 2015 19:28:35 GMT

    [ https://issues.apache.org/jira/browse/CXF-6221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14295674#comment-14295674
] 

Krystian Panek commented on CXF-6221:
-------------------------------------

Maybe it will be hard or even impossible to get that extension working on both OSGi and non-OSGi
environments so I suggest to release just 2 versions of that integration.

I copied source code from your extension, and put in under a project with pom.xml like above
and everything now works properly:

{code}
<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>
    <packaging>bundle</packaging>

    <parent>
        <groupId>com.neva.osgi</groupId>
        <artifactId>parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <artifactId>cdicxfbridge</artifactId>
    <version>3.0.2-SNAPSHOT</version>

    <name>Neva OSGi | CDI CXF Bridge (JAX-RS support)</name>
    <description>CDI portable extension for JaxRS (CXF). Sources copied from:
        https://github.com/apache/cxf/tree/master/integration/cdi
    </description>

    <properties>
        <maven-bundle-plugin.version>2.4.0</maven-bundle-plugin.version>
        <osgi.version>5.0.0</osgi.version>
        <pax.cdi.version>0.8.0</pax.cdi.version>
        <cxf.version>3.0.2</cxf.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${maven-bundle-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Import-Package>
                            org.apache.cxf.interceptor,
                            *
                        </Import-Package>
                        <Export-Package>
                            com.neva.osgi.cdicxfbridge*;version=${project.version},
                            org.apache.cxf.cdi*
                        </Export-Package>
                        <Require-Capability>
                            osgi.extender;filter:="(osgi.extender=pax.cdi)"
                        </Require-Capability>
                        <Provide-Capability>
                            org.ops4j.pax.cdi.extension; extension="jaxrs-cdi"
                        </Provide-Capability>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- OSGi -->
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>${osgi.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- CDI -->
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>1.1-20130918</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.cdi</groupId>
            <artifactId>pax-cdi-api</artifactId>
            <version>${pax.cdi.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.cdi</groupId>
            <artifactId>pax-cdi-web-weld</artifactId>
            <version>${pax.cdi.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- CXF -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-extension-providers</artifactId>
            <version>${cxf.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>${cxf.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-core</artifactId>
            <version>${cxf.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Other -->
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-servlet_3.0_spec</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-api</artifactId>
            <version>1.7.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>13.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.interceptor</groupId>
            <artifactId>javax.interceptor-api</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>

    </dependencies>
</project>
{code}

> CDI integration extension does not detect annotations on Karaf
> --------------------------------------------------------------
>
>                 Key: CXF-6221
>                 URL: https://issues.apache.org/jira/browse/CXF-6221
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration, JAX-RS
>            Reporter: Krystian Panek
>            Assignee: Sergey Beryozkin
>              Labels: cdi, extension, integration
>             Fix For: 3.0.4, 3.1.0
>
>         Attachments: screenshot-1.png
>
>
> I am trying to use portable extension to get working CDI 1.2 and CXF 3.0.2 on Apache
Karaf. I wrapped it into OSGi bundle. I installed to my container also:
> * weld 2.1.1
> * pax-cdi-1.2
> * pax-cdi-1.2-web
> * pax-cdi-web-weld
> My JAXRS resources are not found by extension because some line from class **JAXRSCdiResourceExtension**
returns false even annotated element contains proper annotation but as a proxy (see attachment
image / screenshot from debugger).
> {code}
>         if (event.getAnnotated().isAnnotationPresent(ApplicationPath.class)) {
> {code}
> It would be nice,  to tell me how to get it working. I also tested CDI-1.1. Same situation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message