You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by rcbandit2 <pe...@gmail.com> on 2012/02/14 23:20:09 UTC

Apache Felix and JNI

Hi,
   I want to create Apache Felix bundle which uses JNI. I found some very
old examples based on Ant and they don't even compile. Is there any resent
example?

Best Wishes
-- 
View this message in context: http://old.nabble.com/Apache-Felix-and-JNI-tp33325571p33325571.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Apache Felix and JNI

Posted by rcbandit2 <pe...@gmail.com>.
I tried to implement Apache Felix bundle: This is the complete source code:   
http://www.2shared.com/file/9TNwk5Cs/NB_27.html
When I try to deploy the bundle on Glassfish application server I get this
error stack:
http://pastebin.com/VVkMhtch
Where I have to place the shared object file(C code)? Insight the bundle or
in Linux directory - /opt directory for example.
Am I missing something in my POM file? Do I need to make special bundle
configuration?


<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.DX_57.osgi.NB_27</groupId>
        <artifactId>NB_27</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>NB_27-impl</artifactId>
    <packaging>bundle</packaging>
    <name>NB_27-impl</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>NB_27-api</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>${pom.groupId}.api,
org.osgi.framework</Import-Package>
                       
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>                        
                       
<Bundle-Activator>${pom.groupId}.impl.NetworkBridgeApp</Bundle-Activator>
			<Bundle-NativeCode>libfoo.so; processor = x86; osname =
Linux</Bundle-NativeCode> 
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <forkMode>once</forkMode>
          <environmentVariables>
            <LD_LIBRARY_PATH>/opt/</LD_LIBRARY_PATH>
          </environmentVariables>
        </configuration>
      </plugin>
                       
        </plugins>        
    </build>
    <groupId>org.DX_57.osgi.NB_27</groupId>
</project>




Richard S. Hall wrote:
> 
> On 2/14/12 17:20 , rcbandit2 wrote:
>> Hi,
>>     I want to create Apache Felix bundle which uses JNI. I found some
>> very
>> old examples based on Ant and they don't even compile. Is there any
>> resent
>> example?
> 
> Not sure to which example you are referring, but the build script in 
> here works for me:
> 
>      http://svn.apache.org/repos/asf/felix/trunk/examples/simple/
> 
> But in reality, that is pretty much irrelevant since the steps to create 
> the native code are documented here:
> 
>      
> http://svn.apache.org/repos/asf/felix/trunk/examples/simple/native/build.txt
> 
> And these are what you need to know...as far as I know they haven't 
> changed after all these years.
> 
> -> richard
> 
>>
>> Best Wishes
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Apache-Felix-and-JNI-tp33325571p33338927.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Apache Felix and JNI

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 2/14/12 17:20 , rcbandit2 wrote:
> Hi,
>     I want to create Apache Felix bundle which uses JNI. I found some very
> old examples based on Ant and they don't even compile. Is there any resent
> example?

Not sure to which example you are referring, but the build script in 
here works for me:

     http://svn.apache.org/repos/asf/felix/trunk/examples/simple/

But in reality, that is pretty much irrelevant since the steps to create 
the native code are documented here:

     
http://svn.apache.org/repos/asf/felix/trunk/examples/simple/native/build.txt

And these are what you need to know...as far as I know they haven't 
changed after all these years.

-> richard

>
> Best Wishes

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org