You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Ivo K. Koga" <iv...@gmail.com> on 2007/03/06 17:24:18 UTC

Embedding Felix in an Java Web Start App

Hi all,

Has anyone tried embedding felix into a Java Web Start application?

I think I did it sucessfully, but I´m havin some problems when starting one
bundle I installed on it.

I now got this error:

[Felix error] java.security.AccessControlException:
PackagePermission.IMPORTdenied for import:
org.jdom.output

I signed this same bundle with the same certificate as the main application.

Hope you clarify me abt this error.


Regards,

Ivo Koga

-- 
Msc. Candidate in Computer Networks at Universidade Salvador/BA/Brazil
Measurement WG - RNP/Brazil

Re: Embedding Felix in an Java Web Start App

Posted by "Ivo K. Koga" <iv...@gmail.com>.
Karl,

No, my checkout is very old. I´ll try to do it today. Thanks.

regards

Ivo Koga

On 3/7/07, Karl Pauls <ka...@gmail.com> wrote:
>
> > IIRC, Java WS will assign the AllPermissons to the jar files that is
> > > declared
> > > in it. However, jar files outside will end up without permissions.
> > > In OSGi you can assign permissions in runtime, but I am not sure if
> Felix
> > > has
> > > full security support yet.
> >
> >
> > Humn, So Felix doesn´t support what I´m trying to do?
>
> Are you using a recent checkout or the 0.8.0 release? I recently
> modified some things in this area specifically to allow for your
> usecase ...
>
> regards,
>
> Karl
>
> > If not, then I suggest that you try to create a new Policy within
> > > the 'standard' bundles, which grants AllPermissions to your 'trusted
> > > sources'.
> > > I have only done stuff like that for testing, but look at [1] and [2]
> to
> > > get
> > > the idea.
> >
> >
> >
> >
> > Cheers
> > > Niclas
> > >
> > > [1]
> > >
> > >
> https://scm.ops4j.org/repos/ops4j/projects/hansa/tests/integration/src/test/java/org/ops4j/hansa/impl/test/HansaSecurityTest.java
> > >
> > > [2]
> > >
> > >
> https://scm.ops4j.org/repos/ops4j/projects/hansa/test-support/src/main/java/org/ops4j/hansa/testsupport/TestPolicy.java
> > >
> >
> >
> >
> > --
> > Msc. Candidate in Computer Networks at Universidade Salvador/BA/Brazil
> > Measurement WG - RNP/Brazil
> >
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>



-- 
Msc. Candidate in Computer Networks at Universidade Salvador/BA/Brazil
Measurement WG - RNP/Brazil

Re: Embedding Felix in an Java Web Start App

Posted by Karl Pauls <ka...@gmail.com>.
> IIRC, Java WS will assign the AllPermissons to the jar files that is
> > declared
> > in it. However, jar files outside will end up without permissions.
> > In OSGi you can assign permissions in runtime, but I am not sure if Felix
> > has
> > full security support yet.
>
>
> Humn, So Felix doesn´t support what I´m trying to do?

Are you using a recent checkout or the 0.8.0 release? I recently
modified some things in this area specifically to allow for your
usecase ...

regards,

Karl

> If not, then I suggest that you try to create a new Policy within
> > the 'standard' bundles, which grants AllPermissions to your 'trusted
> > sources'.
> > I have only done stuff like that for testing, but look at [1] and [2] to
> > get
> > the idea.
>
>
>
>
> Cheers
> > Niclas
> >
> > [1]
> >
> > https://scm.ops4j.org/repos/ops4j/projects/hansa/tests/integration/src/test/java/org/ops4j/hansa/impl/test/HansaSecurityTest.java
> >
> > [2]
> >
> > https://scm.ops4j.org/repos/ops4j/projects/hansa/test-support/src/main/java/org/ops4j/hansa/testsupport/TestPolicy.java
> >
>
>
>
> --
> Msc. Candidate in Computer Networks at Universidade Salvador/BA/Brazil
> Measurement WG - RNP/Brazil
>


-- 
Karl Pauls
karlpauls@gmail.com

Re: Embedding Felix in an Java Web Start App

Posted by "Ivo K. Koga" <iv...@gmail.com>.
Hi Niclas

On 3/6/07, Niclas Hedhman <ni...@hedhman.org> wrote:
>
> On Wednesday 07 March 2007 09:04, Ivo K. Koga wrote:
> > I just start this jnlp. This launches successfully the application, but
> > when I install and try to run the bundle I got the error I sent before.
> >
> > I didn´t understand the "what I do next (in detail)" question. Does this
> > answer the question? If not, please let me know.
>
> "the bundle" is referring to some other bundle not listed in that JNLP??


The bundle is importing some packages that I already export in the
initialization of felix:

In the manifest file I have:

Import-Package: br.unifacs.nuperc.flavor.perfsonar.ls.bundle, javax.swing,
javax.xml.rpc, org.jdom.input, org.jdom.output, org.jdom,
org.apache.axis.client, javax.xml.namespace,  javax.xml.parsers, org.xml.sax,
org.apache.axis.message, org.w3c.dom,
br.unifacs.nuperc.flavor.api.data.impl


And in the configMap I have:
Map configMap = new StringMap(false);
configMap.put(FelixConstants.FRAMEWORK_SYSTEMPACKAGES,
                "org.osgi.framework; version=1.3.0,"
                + "org.osgi.service.packageadmin; version=1.2.0,"
                + "org.osgi.service.startlevel; version=1.0.0,"
                + "org.osgi.service.url; version=1.0.0"
                +", org.jdom"
                +", org.jdom.input"
                +", org.jdom.output"
                +", javax.xml.rpc" ... and others);

felix = new Felix();
            felix.start(
                new MutablePropertyResolverImpl(configMap),
                list);


I think this packages is in this declaration of the jnlp file:
<jar href="lib/jdom-1.0-jdom.jar" download="eager"/>

Maybe I am having this problem because I´m trying to install a bundle jar
that is outside the jnlp file, but it is what I want: to install and
uninstall bundles outside the host application. So i do not have control
over what bundles will be installed on the OSGi framework.

If I understood with the solution suggestion you sent, I have to know what
bundles will be installed in my OSGi framework or am i wrong?

Thanks for fast the answer! :-)

Regards,

Ivo Koga

IIRC, Java WS will assign the AllPermissons to the jar files that is
> declared
> in it. However, jar files outside will end up without permissions.
> In OSGi you can assign permissions in runtime, but I am not sure if Felix
> has
> full security support yet.


Humn, So Felix doesn´t support what I´m trying to do?

If not, then I suggest that you try to create a new Policy within
> the 'standard' bundles, which grants AllPermissions to your 'trusted
> sources'.
> I have only done stuff like that for testing, but look at [1] and [2] to
> get
> the idea.




Cheers
> Niclas
>
> [1]
>
> https://scm.ops4j.org/repos/ops4j/projects/hansa/tests/integration/src/test/java/org/ops4j/hansa/impl/test/HansaSecurityTest.java
>
> [2]
>
> https://scm.ops4j.org/repos/ops4j/projects/hansa/test-support/src/main/java/org/ops4j/hansa/testsupport/TestPolicy.java
>



-- 
Msc. Candidate in Computer Networks at Universidade Salvador/BA/Brazil
Measurement WG - RNP/Brazil

Re: Embedding Felix in an Java Web Start App

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wednesday 07 March 2007 09:04, Ivo K. Koga wrote:
> I just start this jnlp. This launches successfully the application, but
> when I install and try to run the bundle I got the error I sent before.
>
> I didn´t understand the "what I do next (in detail)" question. Does this
> answer the question? If not, please let me know.

"the bundle" is referring to some other bundle not listed in that JNLP??

IIRC, Java WS will assign the AllPermissons to the jar files that is declared 
in it. However, jar files outside will end up without permissions.
In OSGi you can assign permissions in runtime, but I am not sure if Felix has 
full security support yet.

If not, then I suggest that you try to create a new Policy within 
the 'standard' bundles, which grants AllPermissions to your 'trusted 
sources'.
I have only done stuff like that for testing, but look at [1] and [2] to get 
the idea.


Cheers
Niclas

[1] 
https://scm.ops4j.org/repos/ops4j/projects/hansa/tests/integration/src/test/java/org/ops4j/hansa/impl/test/HansaSecurityTest.java

[2] 
https://scm.ops4j.org/repos/ops4j/projects/hansa/test-support/src/main/java/org/ops4j/hansa/testsupport/TestPolicy.java

Re: Embedding Felix in an Java Web Start App

Posted by "Ivo K. Koga" <iv...@gmail.com>.
Hi Niclas,

My jnlp file is:

<jnlp
  spec="1.0+" codebase="http://localhost/ice0.06/"
  href="ice.jnlp">
  <information>
    <title>ICE - Internet Computer network Eye</title>
    <vendor>Grupo de Medicoes - 2 </vendor>
    <homepage href="http://www.nuperc.unifacs.br/gtmed"/>
    <description>ICE - Internet Computer network Eye</description>
    <description kind="short">A network visualization and configuration
tool</description>
    <icon href="ice.jpg"/>
    <offline-allowed/>
  </information>
  <resources>
     <j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se"/>
     <jar href="ice.jar"/>
     <!-- external libs -->
<jar href="lib/axis-1.4-ant.jar" download="eager"/>
<jar href="lib/axis-1.4-commons-discovery-0.2.jar" download="eager"/>
<jar href="lib/axis-1.4-commons-logging-1.0.4.jar" download="eager"/>
<jar href="lib/axis-1.4-jaxrpc.jar" download="eager"/>
<jar href="lib/axis-1.4-log4j-1.2.8.jar" download="eager"/>
<jar href="lib/axis-1.4-saaj.jar" download="eager"/>
<jar href="lib/axis-1.4-wsdl4j-1.5.1.jar" download="eager"/>
<jar href="lib/axis-1.4.jar" download="eager"/>
<jar href="lib/felix-
semlog-20061121-org.apache.felix.framework-0.8.0-SNAPSHOT.jar"
download="eager"/>
<jar href="lib/felix-semlog-20061121-org.osgi.core-0.8.0-SNAPSHOT.jar"
download="eager"/>
<jar href="lib/flavor-2007-02-19.jar" download="eager"/>
<jar href="lib/jaxen-1.1-beta-8.jar" download="eager"/>
<jar href="lib/jdom-1.0-ant.jar" download="eager"/>
<jar href="lib/jdom-1.0-jaxen-core.jar" download="eager"/>
<jar href="lib/jdom-1.0-jaxen-jdom.jar" download="eager"/>
<jar href="lib/jdom-1.0-jdom.jar" download="eager"/>
<jar href="lib/jdom-1.0-saxpath.jar" download="eager"/>
<jar href="lib/jdom-1.0-xalan.jar" download="eager"/>
<jar href="lib/jdom-1.0-xerces.jar" download="eager"/>
<jar href="lib/jdom-1.0-xml-apis.jar" download="eager"/>
<jar href="lib/jfreechart-1.0.4-experimental.jar" download="eager"/>
<jar href="lib/jfreechart-1.0.4-swt.jar" download="eager"/>
<jar href="lib/jfreechart-1.0.4.jar" download="eager"/>
<jar href="lib/jfreechart-itext-1.4.8.jar" download="eager"/>
<jar href="lib/jfreechart-jcommon-1.0.8.jar" download="eager"/>
<jar href="lib/jfreechart-junit.jar" download="eager"/>
<jar href="lib/jfreechart-servlet.jar" download="eager"/>
<jar href="lib/jfreechart-swtgraphics2d.jar" download="eager"/>
<jar href="lib/jung-1.7.2-colt.jar" download="eager"/>
<jar href="lib/jung-1.7.2-commons-collections-3.1.jar" download="eager"/>
<jar href="lib/jung-1.7.2-concurrent.jar" download="eager"/>
<jar href="lib/jung-1.7.2.jar" download="eager"/>
<jar href="lib/ls-DPS-API-withoutLogConf-2007-02-14.jar" download="eager"/>
<jar href="lib/ls-soap.jar" download="eager"/>
<jar href="lib/ls-uddi4j-sem-output-2007-02-12.jar" download="eager"/>
<jar href="lib/mysql-connector-java-3.0.17-ga-bin.jar" download="eager"/>
<jar href="lib/rocksaw-0.4.5.jar" download="eager"/>
<jar href="lib/skinlf-6.7-nativeskin.jar" download="eager"/>
<jar href="lib/skinlf-6.7-skinlf.jar" download="eager"/>
<jar href="lib/vserv-tcpip-0.8.0.jar" download="eager"/>
<jar href="lib/xerces-2_8_0-resolver.jar" download="eager"/>
<jar href="lib/xerces-2_8_0-xercesImpl.jar" download="eager"/>
<jar href="lib/xerces-2_8_0-xercesSamples.jar" download="eager"/>
<jar href="lib/xerces-2_8_0-xml-apis.jar" download="eager"/>
     <extension name="activation" href="activation.jnlp"/>
     <extension name="javamail" href="javamail.jnlp"/>

  </resources>
     <resources os="Windows">
           <nativelib href="lib/windows/rocksaw-0.4.5-corewindowslibs.jar"/>
     </resources>
     <resources os="Linux">
           <nativelib href="lib/linux/rocksaw-0.4.5-corelinuxlibs.jar"/>
     </resources>

<security>
     <all-permissions/>
  </security>

  <application-desc main-class="br.unifacs.nuperc.ice.MainWindow"/>
</jnlp>

------------------------------------
I just start this jnlp. This launches successfully the application, but when
I install and try to run the bundle I got the error I sent before.

I didn´t understand the "what I do next (in detail)" question. Does this
answer the question? If not, please let me know.

Ivo Koga

On 3/6/07, Niclas Hedhman <ni...@hedhman.org> wrote:
>
> On Wednesday 07 March 2007 00:24, Ivo K. Koga wrote:
> > Hi all,
> >
> > Has anyone tried embedding felix into a Java Web Start application?
> >
> > I think I did it sucessfully, but I´m havin some problems when starting
> one
> > bundle I installed on it.
> >
> > I now got this error:
> >
> > [Felix error] java.security.AccessControlException:
> > PackagePermission.IMPORTdenied for import:
> > org.jdom.output
> >
> > I signed this same bundle with the same certificate as the main
> > application.
>
> Sounds like the security policy is lacking permissions for the jar of the
> bundle being loaded.
>
> Perhaps if you give more detail on your jnlp file and what you do next (in
> detail), we can figure this out.
>
>
> Cheers
> Niclas
>



-- 
Msc. Candidate in Computer Networks at Universidade Salvador/BA/Brazil
Measurement WG - RNP/Brazil

Re: Embedding Felix in an Java Web Start App

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wednesday 07 March 2007 00:24, Ivo K. Koga wrote:
> Hi all,
>
> Has anyone tried embedding felix into a Java Web Start application?
>
> I think I did it sucessfully, but I´m havin some problems when starting one
> bundle I installed on it.
>
> I now got this error:
>
> [Felix error] java.security.AccessControlException:
> PackagePermission.IMPORTdenied for import:
> org.jdom.output
>
> I signed this same bundle with the same certificate as the main
> application.

Sounds like the security policy is lacking permissions for the jar of the 
bundle being loaded.

Perhaps if you give more detail on your jnlp file and what you do next (in 
detail), we can figure this out.


Cheers
Niclas