users@glassfish.java.net

Re: NPE - java.lang.reflect.UndeclaredThrowableException

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Thu, 02 Feb 2012 06:14:15 +0530

Hi Peter,

SessionHandleImpl is a plain Java object which are you are instantiating
in the activator and publishing as an OSGi service. So, how can anyone
inject ds field in that object? I suggest you do the following:
you make it a Stateless Local EJB,
add Export-EJB: ALL header in manifest,
and get rid of your activator.
glassfish-osgi-ejb-container will take care of publishing the EJB as a
service and it will take care of injection as well. See the OSGi/EJB
related examples in the doc I had sent earlier.

OR,
you could look up the datasource yourself and set it in
SessionHandleImpl instead of expecting it to be injected. There is a
datasource related example in the doc as well.

HTH,
Sahoo

ps: I am glad you are able to resolve some of your earlier issues and
moving forward. I have a request. Pl stop using pastebin.com to provide
stacktraces and source code. Try to give relevant source code and
stacktrace in email or in forum posting as well. I can understand using
some fileupload service like 2shared.com to attach binaries like you
have done, but not for simple stack traces and source snippets. Or, at
least provide them inline in addition to providing the full content via
some other service. It will save time at our end as well making the
forum thread a candidate for similar issues when people search.


On Thursday 02 February 2012 01:09 AM, forums_at_java.net wrote:
> Hi,
>
> I'm trying to develop OSGI bundle with Datasource. When I try to
> deploy the bundle and the web application I get this error:
> java.lang.reflect.UndeclaredThrowableException
>
> This is the full error stack of Glassfish: http://pastebin.com/y4eGtF8B
>
> This is the source code of the OSGI bundle with the datasource: download
> link - http://www.2shared.com/file/d0HN3HHD/SH_27.html
>
> You can see the souce code here: http://pastebin.com/n86dEDai
>
> This is the source code of the managed beans which calls the OSGI bundle:
> http://pastebin.com/yh15tPT8
>
> Would you guide me how fix the code?
>
> Best Wishes
>
> Peter
>
>
>
>
>
>
> --
>
> [Message sent by forum member 'rcbandit']
>
> View Post: http://forums.java.net/node/883210
>
>