Hey Achim,

I finally got it working for me :)

The problem was fixed when I changed

configAdmin.getConfiguration("org.ops4j.pax.web");
 to
configAdmin.getConfiguration("org.ops4j.pax.web", null);

I also moved to PAX-WEB 0.8.0 (could not find the latest on the website) as
you had suggested. I had to dig a little deeper in the pax web code to see
what the config admin was doing. From what i can understand not having the
null was binding the service to the calling bundle and using the null
parameter returned me the service which was registered already with pax.

Anyway
Thanks for all your help

Regards,
Abhishek
-- 
Software Engineer, Architexa - www.architexa.com
Understand & Document Code In Seconds
[email protected] :: (785)214-1324



On Sun, Jan 16, 2011 at 4:38 PM, Achim Nierbeck <[email protected]>wrote:

>  Hi,
>
> first of all I would really suggest use the latest version of pax-web there
> are lots of bug fixes from 0.7 on.
> Second, what are you trying to do?
> - deploy bundles with usage of HttpService
> - deploy war archives
> - deploy web application bundles (war archives with manifest)
>
> Third, Pax-web starts with the default configuration of 8080 for the web
> server port, this port can be overridden either by setting
> the right properties or using configuration admin service. This is
> everytime you do a restart of your OSGi container, pax-web is started with
> port 8080 and afterwards is configured by the configuration admin service to
> use a different one. If you use a property file I'm not sure it already
> starts with the right port.
> I don't know about 0.7.0 but the latest version (0.8.2-SNAPSHOT) surely is
> capable of being reconfigured.
>
> Fourth, the latest version of Karaf already provides every thing you need
> to get pax-web with jetty to run.
> Grab the latest  version either 2.1.3 or even better a latest SNAPSHOT
> version 2.1.99-SNAPSHOT.
> With the 2.1.99-SNAPSHOT version you get 0.8.2-SNAPSHOT of PAX-WEB with
> Jetty 7. You just need to start your
> Karaf and add the following command to retrieve all required bundles
> directly from the maven repositories:
> features:install war
>
> do a features:list on the command line to see more available features :)
>
> fifth: You do need the following Bundles to serve HttpService:
> - pax-web-api
> - pax-web-spi
> - pax-web-runtime
> - pax-web-jetty
> - a jetty bundle, Karaf 2.1.3 uses the all-in-one bundle from servicemix,
> Karaf 2.1.99-SNAPSHOT uses a set of bundles of Jetty 7 ( do a features:info
> jetty on the karaf console to see more details)
>
> sixth: If you wan't to deploy standard WARs and WABs you need the following
> bundles in addition:
> - pax-web-jsp
> - pax-web-extender-war
> - pax-web-whiteboard
> - pax-web-war
>
> If you are using a FileInstall you can also use the pax-web-deployer for
> deploying of wars and wabs (standard with Karaf 2)
>
> Concerning your exception I've never seen that one, probably you just don't
> have the right set of bundles?
>
> Greetings, Achim
>
>
> Hey Achim,
>
>  I am using version 0.7.1 but I did try 0.8.0 with the same result. I
> haven't tried the latest version but my guess is that it will have the same
> problem (correct me if I am wrong). I didn't have to restart pax web, I was
> just trying to see if that would help.
>
>  I also wanted to provide a little more details on me working on this. One
> interesting thing which happened (while using 0.7.1) though was that this
> approach worked in one of my test spaces where I created projects out of the
> pax web jars into my workspace instead of depending on the jars in my
> eclipse droppins folder. But what is even weirder is this approach did not
> work when I tried on my actual workspace. This at least confirms that 0.7.1
> does support it, but again while it did work reproducibly in one setup - I
> have not been able to do it in any other workspace (or computer).
>
>  Also in the cases where it did not work I could see that the changed port
> number did persist but pax-web did not use it when it started. Which leads
> me to think that I am able to reliably talk to the configuration admin but
> that in some situations the configuration admin <-> pax-web connection does
> not work.
>
>  In verifying the above, I have tried to use other configuration admin. I
> downloaded the latest version of Karaf and used the
> "org.apache.felix.configAdmin" as the admin but with same results.
>
>  So how do we get this to work? Are we using a wrong id to talk to pax
> web? Is there some situation where Pax-web overrides the configuration
> admins port numbers? Are their bundles/plugins in the default Eclipse that
> might be conflicting with and forcing Pax-web into port 8080? Should
> we bypass the config admins and directly talk to Pax-Web (how do we do
> that)?
>
>  The important thing for us is that we want to be able to programmatically
> configure some details of the server, so we cannot set the system arguments
> on start (which I have tried and it works).
>
>  Also I get this warning once in while Warning: Configuration for
> service.pid=org.ops4j.pax.web could not be bound to reference:
> file:/Applications/eclipseRCP/dropins/pax-web-jetty-bundle-0.7.1.jar.
> Could this be part of the problem. Why is it happening? How could I fix it?
>
>
>  Really appreciate your help
>
>  Thanks,
> Abhishek
>
> On Fri, Jan 14, 2011 at 3:55 PM, Achim Nierbeck 
> <[email protected]>wrote:
>
>>  Ok,
>>
>> which version of pax-web are you using?
>> The latest snapshot version 0.8.2-SNAPSHOT uses a managed service for
>> configuration.
>> Also if you want to restart the service by user self make sure you are
>> using the
>> pax-web-runtime bundle. This one takes care of all the services and the
>> configuration of the jetty service.
>>
>> regards, Achim
>>
>>
>> Looking forward to your thoughts. I will take a look at karaf in the mean
>> time.
>>
>>  Thanks,
>> Abhishek
>>
>> On Fri, Jan 14, 2011 at 9:24 AM, Achim Nierbeck 
>> <[email protected]>wrote:
>>
>>> As said, I will take a deeper look at it tonight, on the other hand it
>>> runs smoothly within apache karaf.
>>>
>>> regards, Achim
>>>
>>>
>>> 2011/1/14 Abhishek Rakshit <[email protected]>:
>>>  > Hey Achim,
>>> > Thanks a lot for responding. There is a typo in the code I posted.
>>> > I call a start on the bundle after that.
>>> > //****
>>> > Platform.getBundle("org.ops4j.pax.web.pax-web-jetty-bundle").start();
>>> > //****
>>> > I understand that Pax-Web uses managed configuration and tried doing
>>> this
>>> > without stoping and starting the bundle but that too didn't work. My
>>> > question is that am I doing this right?
>>> > Really appreciate your help.
>>> > Regards,
>>> > Abhishek
>>> > On Fri, Jan 14, 2011 at 3:30 AM, Achim Nierbeck <
>>> [email protected]>
>>> > wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> Just I did just take a quick look at your code, but was the stopping
>>> >> of the jetty-bundle twice your intention?
>>> >> And actually pax-web uses managed configuration, so if you change the
>>> >> port while running it will be reconfigured.
>>> >>
>>> >> I can take a look at it tonight in more detail.
>>> >>
>>> >> Achim
>>> >>
>>> >> 2011/1/13 Abhishek Rakshit <[email protected]>:
>>> >> > Hey Guys,
>>> >> > I am using Pax-Web to run a web service inside eclipse as a plugin.
>>> >> > Pax-Web is working fine and the service starts at port 8080
>>> (default)
>>> >> > correctly.
>>> >> > Now I need to configure this port at runtime and was trying to do
>>> this
>>> >> > by
>>> >> > using the Configuration Admin Service by getting the pax web
>>> >> > Configuration
>>> >> > and changing the "org.osgi.service.http.port" property. But this is
>>> >> > having
>>> >> > no effect on the port. I have provided my code snippet below. Could
>>> >> > someone
>>> >> > please point out what I am doing wrong?
>>> >> > //**********************
>>> >> >
>>> >> > Platform.getBundle("org.ops4j.pax.web.pax-web-jetty-bundle").stop();
>>> >> >
>>> >> > Bundle configMgrBundle = Platform.getBundle("org.eclipse.equinox.cm
>>> ");
>>> >> >
>>> >> > configMgrBundle.start();
>>> >> >
>>> >> > ServiceReference configAdminServiceRef =
>>> >> > context.getServiceReference(ConfigurationAdmin.class.getName());
>>> >> >
>>> >> >      if (configAdminServiceRef != null) {
>>> >> >
>>> >> > ConfigurationAdmin configAdmin = (ConfigurationAdmin)
>>> >> > context.getService(configAdminServiceRef);
>>> >> >
>>> >> > Configuration config =
>>> >> > configAdmin.getConfiguration("org.ops4j.pax.web");
>>> >> >
>>> >> > Dictionary properties = config.getProperties();
>>> >> >
>>> >> > if (properties == null) {
>>> >> >
>>> >> >        properties = new Hashtable();
>>> >> >
>>> >> > }
>>> >> >
>>> >> > properties.put("org.osgi.service.http.port", "8888");
>>> >> >
>>> >> > config.update(properties);
>>> >> >
>>> >> > Platform.getBundle("org.ops4j.pax.web.pax-web-jetty-bundle").stop();
>>> >> >
>>> >> > //**********************
>>> >> >
>>> >> > Really appreciate your help
>>> >> >
>>> >> > Abhishek,
>>> >> >
>>> >> > _______________________________________________
>>> >> > general mailing list
>>> >> > [email protected]
>>> >> > http://lists.ops4j.org/mailman/listinfo/general
>>> >> >
>>> >> >
>>> >
>>> >
>>>
>>
>>
>>
>
>
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to