Bhakti,
This problem is occurring with the nightly build from the 20th May.
It's a bit late here now, so I will try again tomorrow and if the problem
persists I will do as you suggest. Thanks for the hint.
Any chance you could add a link to the issue log so I can do some
comparisons?
Thanks,
Paul B.
Bhakti Mehta wrote:
>
> Paul,
> This ClassCastException seems to be a bug in webservices code. I have
> fixed similar issue some time ago. If you are still running into this
> with the latest v3 build please file a bug under v3 webservices and
> atach your war
> Thanks,
> Bhakti
>
> paulbrickell wrote:
>> Sahoo,
>>
>> Just want to check I am doing the right thing here.
>>
>> I am creating an OSGi bundle, not an H2K module. I have no interfaces in
>> this bundle annotated with Contract.
>>
>> I have taken the latest nightly build and put my bundle in the
>> autodeploy-bundles directory. When I start Glassfish I see logging from
>> bundle. So that's good.
>>
>> I am having problems deploying my web application into this server. When
>> I
>> deploy It I get an error...
>>
>> cannot Deploy testservice
>> Deployment Error for module: test-service: Exception while loading the
>> app
>> : java.lang.Exception: java.lang.IllegalStateException:
>> ContainerBase.addChild: start: LifecycleException:
>> java.lang.ClassCastException:
>> com.sun.xml.ws.transport.http.servlet.WSServlet cannot be cast to
>> javax.servlet.Servlet
>>
>> Not sure what this all about. Will continue investigating.
>>
>> Regards,
>> Paul B.
>>
>>
>> Sahoo wrote:
>>
>>> Hold on. You are using Habitat.getAllByType(). I asked you to use
>>> Habitat.getByContract(). If at all you have to iterate over all the
>>> implementations of a contract, you should use
>>> Habitat.getAllByContracts(). Oh yes, I understand the method name
>>> getAllByType() is not so user friendly. In HK2, type means
>>> implementation type!
>>>
>>> Sahoo
>>>
>>> paulbrickell wrote:
>>>
>>>> Sahoo,
>>>>
>>>> You right of course.
>>>>
>>>> Anyhoo, using that repository and building my war gives me no
>>>> compilation
>>>> problems.
>>>>
>>>> My code is now doing this...
>>>>
>>>> MessageContext mc = _wsContext.getMessageContext();
>>>> ServletContext sCtx = (ServletContext)
>>>> mc.get(MessageContext.SERVLET_CONTEXT);
>>>> Habitat habitat = (Habitat)
>>>> sCtx.getAttribute("org.glassfish.servlet.habitat");
>>>> Collection<MyAPI> apis = habitat.getAllByType(MyAPI.class);
>>>>
>>>> This works OK, but I get a zero length collection. I will get the
>>>> latest
>>>> build and try dropping my bundle jar in the autodeploy dir as you
>>>> suggested.
>>>>
>>>> I will let you know how I get on.
>>>>
>>>> Thanks again,
>>>> Paul B.
>>>>
>>>>
>>>>
>>>> Sahoo wrote:
>>>>
>>>>
>>>>> May be my understanding of our maven repositories are wrong, but
>>>>> AFAIK,
>>>>> only artifacts produced by GlassFish build should go to
>>>>>
>>>>> http://download.java.net/maven/glassfish/,
>>>>>
>>>>> but, that appears not to be true. So, go ahead and use that repo.
>>>>> Anyway, this is not the core of the problems being discussed here.
>>>>>
>>>>> Thanks,
>>>>> Sahoo
>>>>> paulbrickell wrote:
>>>>>
>>>>>
>>>>>> but, did find it in...
>>>>>>
>>>>>> http://download.java.net/maven/glassfish/
>>>>>>
>>>>>>
>>>>>>
>>>>>> paulbrickell wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Sahoo,
>>>>>>>
>>>>>>> Really appreciate your help.
>>>>>>>
>>>>>>> I'm afraid I do not find com.sun.enterprise.hk2 in either of the
>>>>>>> repositories you listed.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Paul B.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Sahoo wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> OK, thanks for clarifying about the deployment part.
>>>>>>>>
>>>>>>>> You should be able to do this in your code:
>>>>>>>>
>>>>>>>> org.jvnet.hk2.component.Habitat =
>>>>>>>> org.jvnet.hk2.component.Habitat.class.cast(sCtx.getAttribute("org.glassfish.servlet.habitat"));
>>>>>>>>
>>>>>>>>
>>>>>>>> org.jvnet.hk2.component package is part of HK2 project, so you can
>>>>>>>> set
>>>>>>>> up your maven dependency like this:
>>>>>>>>
>>>>>>>> <dependency>
>>>>>>>> <groupId>com.sun.enterprise</groupId>
>>>>>>>> <artifactId>hk2</artifactId>
>>>>>>>> <version>RELEASE</version>
>>>>>>>> <scope>provided</scope>
>>>>>>>> <dependency>
>>>>>>>>
>>>>>>>> Ensure that you have added http://download.java.net/maven/2 and
>>>>>>>> http://download.java.net/maven/1 as additional maven 2 and maven 1
>>>>>>>> repositories either in your pom.xml or in your maven settings.xml.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Sahoo
>>>>>>>>
>>>>>>>> paulbrickell wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Sahoo,
>>>>>>>>>
>>>>>>>>> Sorry. You are of course right about the web service deployment.
>>>>>>>>> It's
>>>>>>>>> just a
>>>>>>>>> war file deployed in glassfish (atually I am debugging in
>>>>>>>>> Eclipse).
>>>>>>>>>
>>>>>>>>> I did try just dropping the bundle in the autodeploy-bundles dir,
>>>>>>>>> but
>>>>>>>>> it
>>>>>>>>> did
>>>>>>>>> not seem to start (I saw none of the logging from my
>>>>>>>>> BundleActivator.start
>>>>>>>>> method) . I suspect I might be behind on the build. I will pick up
>>>>>>>>> the
>>>>>>>>> latest nightly today.
>>>>>>>>>
>>>>>>>>> As described in my original post I have pulled the Habitat object
>>>>>>>>> from
>>>>>>>>> the
>>>>>>>>> app context. But I cannot cast it to the right type. I still do
>>>>>>>>> not
>>>>>>>>> know
>>>>>>>>> an
>>>>>>>>> appropriate maven dependency I can add to get it.
>>>>>>>>>
>>>>>>>>> Thanks for your help.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Sahoo wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Paul,
>>>>>>>>>>
>>>>>>>>>> 1. You don't have to modify Felix config file. You can drop your
>>>>>>>>>> OSGi
>>>>>>>>>> bundle in domain1/autodeploy-bundles dir and it will be
>>>>>>>>>> automatically
>>>>>>>>>> started when server starts. Please use the latest nightly build
>>>>>>>>>> as
>>>>>>>>>> I
>>>>>>>>>> fixed an important bug around this.
>>>>>>>>>>
>>>>>>>>>> 2. What do you mean by deploying a web service in Grizzly? Can
>>>>>>>>>> you
>>>>>>>>>> tell
>>>>>>>>>> us how you packaged your web service and how you deployed such a
>>>>>>>>>> thing?
>>>>>>>>>> Did you really mean GlassFish or Grizzly?
>>>>>>>>>>
>>>>>>>>>> 3. All the registered OSGi services can be accessed via Habitat
>>>>>>>>>> object.
>>>>>>>>>> The OSGi service interface names are mapped to contract names in
>>>>>>>>>> Habitat.
>>>>>>>>>> e.g., if you have an OSGi service Foo.class which implements I1
>>>>>>>>>> and
>>>>>>>>>> I2,
>>>>>>>>>> then you can access it via Habitat.getByContract(I1 or I2.class)
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Sahoo
>>>>>>>>>>
>>>>>>>>>> paulbrickell wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> I don't know if this is a silly question, but I am having some
>>>>>>>>>>> fundamental
>>>>>>>>>>> issues understanding the Glassfish v3 architecture and could use
>>>>>>>>>>> a
>>>>>>>>>>> pointer.
>>>>>>>>>>>
>>>>>>>>>>> I have created a bundle and added an entry in the
>>>>>>>>>>> glassfish/felix.conf
>>>>>>>>>>> e.g.
>>>>>>>>>>>
>>>>>>>>>>> file:///home/me/myworkspace/my-bundle/target/my-bundle-1.0-SNAPSHOT.jar
>>>>>>>>>>>
>>>>>>>>>>> I see this bundle starting and all is well. It opens a socket to
>>>>>>>>>>> which
>>>>>>>>>>> I
>>>>>>>>>>> can
>>>>>>>>>>> connect and exchange data, which is nice. The reason I created a
>>>>>>>>>>> bundle
>>>>>>>>>>> and
>>>>>>>>>>> not a H2K module is that I want it to be activated at server
>>>>>>>>>>> start-up
>>>>>>>>>>> time.
>>>>>>>>>>> I could not see a way of doing this with H2K. Maybe I missed
>>>>>>>>>>> something.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Now I want to reference this service from a web service that I
>>>>>>>>>>> have
>>>>>>>>>>> deployed
>>>>>>>>>>> in Grizzly. I simply cannot figure out how to do this. The docs
>>>>>>>>>>> do
>>>>>>>>>>> not
>>>>>>>>>>> really cover this, which leads me to believe I am doing
>>>>>>>>>>> something
>>>>>>>>>>> fundamentally wrong.
>>>>>>>>>>>
>>>>>>>>>>> Do Felix and Grizzly share any kind of context or is there a
>>>>>>>>>>> static
>>>>>>>>>>> way
>>>>>>>>>>> to
>>>>>>>>>>> access the Felix services from a web application deployed in
>>>>>>>>>>> Grizzly?
>>>>>>>>>>>
>>>>>>>>>>> I have tried this....
>>>>>>>>>>>
>>>>>>>>>>> wsContext.getMessageContext();
>>>>>>>>>>> ServletContext sCtx = (ServletContext)
>>>>>>>>>>> mc.get(MessageContext.SERVLET_CONTEXT);
>>>>>>>>>>> Object habitat =
>>>>>>>>>>> sCtx.getAttribute("org.glassfish.servlet.habitat");
>>>>>>>>>>>
>>>>>>>>>>> This, I believe, gets me a reference to the H2K habitat, but my
>>>>>>>>>>> bundle
>>>>>>>>>>> is
>>>>>>>>>>> an
>>>>>>>>>>> OSGi bundle deployed in Felix, not an H2K service. Can I
>>>>>>>>>>> navigate
>>>>>>>>>>> to
>>>>>>>>>>> my
>>>>>>>>>>> bundle through this habitat? Is it right to try? If so is there
>>>>>>>>>>> a
>>>>>>>>>>> maven
>>>>>>>>>>> dependency I need to pick up the Habitat class as I cannot seem
>>>>>>>>>>> to
>>>>>>>>>>> find
>>>>>>>>>>> it
>>>>>>>>>>> anywhere.
>>>>>>>>>>>
>>>>>>>>>>> I would appreciate any pointers. TIA.
>>>>>>>>>>> Paul B.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>> users-help_at_glassfish.dev.java.net
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>
--
View this message in context: http://www.nabble.com/Can-a-web-service-deployed-in-Grizzly-access-Felix-tp23634609p23643837.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.