Skip to main content

IDE Hot-deploy for OSGI hybrid Bundles

7 replies [Last post]
omeuefilipe
Offline
Joined: 2011-09-09
Points: 0

hello,

I'm trying to build a productive ambient to work with osgi/java ee and glassfish...
recently sahoo helped me to debug my bundles using NetBeans, but i'm still having difficult to re-deploy my bundles to glassfish..
it's really difficulting my development cycle.. each single change in code, i need to re-deploy my bundles manually by the system console or glassfish web-console...

there is some maven-plugin or some way to configure NetBeans to re-deploy my bundles automatically to glassfish, just like normal web-apps?

thank you guys!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ss141213
Offline
Joined: 2005-03-30
Points: 0

How are you building your hybrid app? Can you configure the build script
to copy the jar to glassfish/autodeploy/bundles/ dir which is watched by
glassfish to take appropriate actions like deploy/undeploy/redeploy
depending on addtion/removal/updation of jars. It monitors every 5 sec,
but you can change that interval to something like 1 sec by editing the
property felix.fileinstall.poll=5000 in
glassfish/osgi/felix/conf/config.properties.

The other option is to add a simple command like the one below at the
end of your build:

asadmin deploy --type osgi --force true

I don't know if GlassFish NetBeans plugin can be used to deploy/redeploy
hybrid apps using that plugin, otherwise that could be another option.

HTH,
Sahoo
On Monday 10 October 2011 02:14 PM, forums@java.net wrote:
> hello,
>
> I'm trying to build a productive ambient to work with osgi/java ee and
> glassfish...
> recently sahoo helped me to debug my bundles using NetBeans, but i'm
> still
> having difficult to re-deploy my bundles to glassfish..
> it's really difficulting my development cycle.. each single change in
> code, i
> need to re-deploy my bundles manually by the system console or glassfish
> web-console...
>
> there is some maven-plugin or some way to configure NetBeans to
> re-deploy my
> bundles automatically to glassfish, just like normal web-apps?
>
> thank you guys!
>
>
> --
>
> [Message sent by forum member 'omeuefilipe']
>
> View Post: http://forums.java.net/node/851666
>
>

bsdmonkey
Offline
Joined: 2007-01-26
Points: 0

Since Glassfish is using Felix file-install bundle I guess it's also
possible to point it to the project dist directory and have it
redeployed with each build or am I wrong Sahoo? (I used this approach
once with Apache Karaf http://twitpic.com/1npwny)

WBR,
--Daoud.

On Mon, Oct 10, 2011 at 6:24 PM, Sahoo wrote:
> How are you building your hybrid app? Can you configure the build script to
> copy the jar to glassfish/autodeploy/bundles/ dir which is watched by
> glassfish to take appropriate actions like deploy/undeploy/redeploy
> depending on addtion/removal/updation of jars. It monitors every 5 sec, but
> you can change that interval to something like 1 sec by editing the property
> felix.fileinstall.poll=5000 in glassfish/osgi/felix/conf/config.properties.
>
> The other option is to add a simple command like the one below at the end of
> your build:
>
> asadmin deploy --type osgi --force true
>
> I don't know if GlassFish NetBeans plugin can be used to deploy/redeploy
> hybrid apps using that plugin, otherwise that could be another option.
>
> HTH,
> Sahoo
> On Monday 10 October 2011 02:14 PM, forums@java.net wrote:
>>
>> hello,
>>
>> I'm trying to build a productive ambient to work with osgi/java ee and
>> glassfish...
>> recently sahoo helped me to debug my bundles using NetBeans, but i'm still
>> having difficult to re-deploy my bundles to glassfish..
>> it's really difficulting my development cycle.. each single change in
>> code, i
>> need to re-deploy my bundles manually by the system console or glassfish
>> web-console...
>>
>> there is some maven-plugin or some way to configure NetBeans to re-deploy
>> my
>> bundles automatically to glassfish, just like normal web-apps?
>>
>> thank you guys!
>>
>>
>> --
>>
>> [Message sent by forum member 'omeuefilipe']
>>
>> View Post: http://forums.java.net/node/851666
>>
>>
>
>

ss141213
Offline
Joined: 2005-03-30
Points: 0

This is an excellent suggestion. You can configure GlassFish to monitor
you maven target directory like this:

Add a file called org.apache.felix.fileinstall-foo.cfg in
domain1/autodeploy/bundles/ with following content:

# Use mvn local repo dir instead of target dir, otherwise fileinstall
will try to deploy the target/classes as a bundle
felix.fileinstall.dir=/home/ss141213/.m2/repository/org/glassfish/fighterfish/sample.uas.api/1.0.0-SNAPSHOT/
# Poll every second
felix.fileinstall.poll=500
felix.fileinstall.log.level=3
felix.fileinstall.bundles.new.start=true
felix.fileinstall.bundles.startTransient=true
felix.fileinstall.disableConfigSave=false

Everytime you run mvn install, the bundle will get redeployed.

You can as many such cfg files as one likes.

Sahoo
On Monday 10 October 2011 10:45 PM, Daoud Abdelmonem Faleh wrote:
> Since Glassfish is using Felix file-install bundle I guess it's also
> possible to point it to the project dist directory and have it
> redeployed with each build or am I wrong Sahoo? (I used this approach
> once with Apache Karaf http://twitpic.com/1npwny)
>
> WBR,
> --Daoud.
>
> On Mon, Oct 10, 2011 at 6:24 PM, Sahoo wrote:
>> How are you building your hybrid app? Can you configure the build script to
>> copy the jar to glassfish/autodeploy/bundles/ dir which is watched by
>> glassfish to take appropriate actions like deploy/undeploy/redeploy
>> depending on addtion/removal/updation of jars. It monitors every 5 sec, but
>> you can change that interval to something like 1 sec by editing the property
>> felix.fileinstall.poll=5000 in glassfish/osgi/felix/conf/config.properties.
>>
>> The other option is to add a simple command like the one below at the end of
>> your build:
>>
>> asadmin deploy --type osgi --force true
>>
>> I don't know if GlassFish NetBeans plugin can be used to deploy/redeploy
>> hybrid apps using that plugin, otherwise that could be another option.
>>
>> HTH,
>> Sahoo
>> On Monday 10 October 2011 02:14 PM, forums@java.net wrote:
>>> hello,
>>>
>>> I'm trying to build a productive ambient to work with osgi/java ee and
>>> glassfish...
>>> recently sahoo helped me to debug my bundles using NetBeans, but i'm still
>>> having difficult to re-deploy my bundles to glassfish..
>>> it's really difficulting my development cycle.. each single change in
>>> code, i
>>> need to re-deploy my bundles manually by the system console or glassfish
>>> web-console...
>>>
>>> there is some maven-plugin or some way to configure NetBeans to re-deploy
>>> my
>>> bundles automatically to glassfish, just like normal web-apps?
>>>
>>> thank you guys!
>>>
>>>
>>> --
>>>
>>> [Message sent by forum member 'omeuefilipe']
>>>
>>> View Post: http://forums.java.net/node/851666
>>>
>>>
>>

ss141213
Offline
Joined: 2005-03-30
Points: 0

I just realized that if you add the following property to the newly
created cfg file, then you can use target dir which means you can get
the desired behavior by invoking "mvn package."

felix.fileinstall.filter = .*\\.jar

Sahoo
On Tuesday 11 October 2011 10:21 AM, Sahoo wrote:
> This is an excellent suggestion. You can configure GlassFish to
> monitor you maven target directory like this:
>
> Add a file called org.apache.felix.fileinstall-foo.cfg in
> domain1/autodeploy/bundles/ with following content:
>
> # Use mvn local repo dir instead of target dir, otherwise fileinstall
> will try to deploy the target/classes as a bundle
> felix.fileinstall.dir=/home/ss141213/.m2/repository/org/glassfish/fighterfish/sample.uas.api/1.0.0-SNAPSHOT/
>
> # Poll every second
> felix.fileinstall.poll=500
> felix.fileinstall.log.level=3
> felix.fileinstall.bundles.new.start=true
> felix.fileinstall.bundles.startTransient=true
> felix.fileinstall.disableConfigSave=false
>
> Everytime you run mvn install, the bundle will get redeployed.
>
> You can as many such cfg files as one likes.
>
> Sahoo
> On Monday 10 October 2011 10:45 PM, Daoud Abdelmonem Faleh wrote:
>> Since Glassfish is using Felix file-install bundle I guess it's also
>> possible to point it to the project dist directory and have it
>> redeployed with each build or am I wrong Sahoo? (I used this approach
>> once with Apache Karaf http://twitpic.com/1npwny)
>>
>> WBR,
>> --Daoud.
>>
>> On Mon, Oct 10, 2011 at 6:24 PM, Sahoo wrote:
>>> How are you building your hybrid app? Can you configure the build
>>> script to
>>> copy the jar to glassfish/autodeploy/bundles/ dir which is watched by
>>> glassfish to take appropriate actions like deploy/undeploy/redeploy
>>> depending on addtion/removal/updation of jars. It monitors every 5
>>> sec, but
>>> you can change that interval to something like 1 sec by editing the
>>> property
>>> felix.fileinstall.poll=5000 in
>>> glassfish/osgi/felix/conf/config.properties.
>>>
>>> The other option is to add a simple command like the one below at
>>> the end of
>>> your build:
>>>
>>> asadmin deploy --type osgi --force true
>>>
>>> I don't know if GlassFish NetBeans plugin can be used to
>>> deploy/redeploy
>>> hybrid apps using that plugin, otherwise that could be another option.
>>>
>>> HTH,
>>> Sahoo
>>> On Monday 10 October 2011 02:14 PM, forums@java.net wrote:
>>>> hello,
>>>>
>>>> I'm trying to build a productive ambient to work with osgi/java ee and
>>>> glassfish...
>>>> recently sahoo helped me to debug my bundles using NetBeans, but
>>>> i'm still
>>>> having difficult to re-deploy my bundles to glassfish..
>>>> it's really difficulting my development cycle.. each single change in
>>>> code, i
>>>> need to re-deploy my bundles manually by the system console or
>>>> glassfish
>>>> web-console...
>>>>
>>>> there is some maven-plugin or some way to configure NetBeans to
>>>> re-deploy
>>>> my
>>>> bundles automatically to glassfish, just like normal web-apps?
>>>>
>>>> thank you guys!
>>>>
>>>>
>>>> --
>>>>
>>>> [Message sent by forum member 'omeuefilipe']
>>>>
>>>> View Post: http://forums.java.net/node/851666
>>>>
>>>>
>>>
>

omeuefilipe
Offline
Joined: 2011-09-09
Points: 0

HI,

thank you for help,

I'm building my apps using the pom.xml off your hand's on lab s313522, I get it here: http://blogs.oracle.com/arungupta/entry/screencast_32_osgi_enabled_java
it's uses the maven-bundle-plugin to create the manifest.mf configurations and install the bundles in my local maven repository

i know that forum is not about maven, but if someone could help with these build config, i'll really apreciate.

Best regards.

ss141213
Offline
Joined: 2005-03-30
Points: 0

Add the following snippet in the pom.xml:

maven-antrun-plugin
1.6

deploy-bundle
package

run

This should work as long as glassfish/bin is in PATH. It may need some
adjustment in Windows, as I have not tried it on that platform.

To avoid duplication, you can configure this in parent pom's
pluginManagement section and then reference the plugin in each pom.xml's
build section as well.

Thanks,
Sahoo

On Monday 10 October 2011 05:56 PM, forums@java.net wrote:
> HI,
>
> thank you for help,
>
> I'm building my apps using the pom.xml off your hand's on lab s313522,
> I get
> it
> here: http://blogs.oracle.com/arungupta/entry/screencast_32_osgi_enabled_java
>
> [1]
> it's uses the maven-bundle-plugin to create the manifest.mf
> configurations
> and install the bundles in my local maven repository
>
> i know that forum is not about maven, but if someone could help with
> these
> build config, i'll really apreciate.
>
> Best regards.
>
>
>
>
> [1]
> http://blogs.oracle.com/arungupta/entry/screencast_32_osgi_enabled_java
>
> --
>
> [Message sent by forum member 'omeuefilipe']
>
> View Post: http://forums.java.net/node/851666
>
>

omeuefilipe
Offline
Joined: 2011-09-09
Points: 0

hi guys,

thank you, for that ideas..
the felix.fileinstall didn't sound me good, cause i'll have a lot of bundles in different packages, versions, even repositories... it will became hard to menage this file.

but I have success with maven and ant, with the maven-jar-plugin and maven-war-plugin already configured for the felix maven-bundle-puglin i just include this tag in configuration: <outputDirectory> ${glassfish.autodeploypath}</outputDirectory>
but for maven-ejb-plugin i don't know why this didn't work, so i use the antplugin that sahoo sugest to copy the jar file to the correct path.