Hi,

The issue was Resource.class was loaded from 2 bundles. I have
javax.annotation in my tomcat orbit bundle and inside tomcat-annotation. I
removed the javax.annotation from tomcat bundel. So now it is working as
expected :)
Thanks a lot for the support.

Best Regards
/Thusitha

2015-05-26 12:14 GMT+05:30 Romain Manni-Bucau <[email protected]>:

> Set the right one around tomee calls
> Le 25 mai 2015 23:23, "Thusitha Thilina Dayaratne" <
> [email protected]> a écrit :
>
> > Hi,
> >
> > Seem I made a mistake. declaredAnnotations() returns a map (Not empty).
> In
> > there I checked .
> >
> > declaredAnnotations().get(annotationClass) <-- this returns null. Here
> > annotationClass is the Resource.class that is passed from the
> > annotationFinder.findMetaAnnotatedFields(Resource.class) in the
> > AnnotationDeployer
> >
> > but in the debug mode I checked
> > declaredAnnotations().get(javax.annotation.Resource.class) that return
> > the object.
> >
> > As I understand the same class is being load from 2 class loaders. So I
> > checked
> >
> > Resource.class.getClassLoader() at the
> > annotationFinder.findMetaAnnotatedFields(Resource.class) there it is
> > null
> >
> > But in the getAnnotation method inside Field class it is not null but
> > org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader
> >
> > Is there way that I can fix this without changing the classloaders?
> >
> > Thanks
> >
> > /Thusitha
> >
> >
> > 2015-05-25 20:03 GMT+05:30 Romain Manni-Bucau <[email protected]>:
> >
> > > the annotation is not in the classloader then
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-05-25 15:38 GMT+02:00 Thusitha Thilina Dayaratne <
> > > [email protected]>:
> > >
> > > > Hi,
> > > >
> > > > I did further debugging on my server as well as in standard TomEE
> > > > distribution.
> > > >
> > > > When running the app on standard TomEE distribution after the
> scanning
> > > > annotation in the org.apache.xbean.
> > > > finder.AnnotationFInder.findMetaAnnotatedFields method  field
> > > > .isAnnotationPresent(annotation) return true. But in my server this
> > > returns
> > > > false. As I understand since field is not getting added and as a
> result
> > > of
> > > > that it will not get created.
> > > >
> > > > if (field.isAnnotationPresent(annotation)) { // Here my server return
> > > > false.
> > > >     fields.add(field);
> > > > }
> > > >
> > > > I checked the that method as well. In the JDK Filed class
> > > > declaredAnnotations() return an empty map. But it is not empty in the
> > > > actual TomEE.
> > > >
> > > > But I can't figure out the reason.
> > > >
> > > >
> > > >
> > > > 2015-05-25 14:08 GMT+05:30 Romain Manni-Bucau <[email protected]
> >:
> > > >
> > > > > when i did karafee i needed to hack the classloader pretty deeply
> to
> > > > ensure
> > > > > "same" was actually the same in practise so can be
> > > > >
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > https://github.com/rmannibucau> |
> > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > > <http://www.tomitribe.com>
> > > > >
> > > > > 2015-05-25 9:44 GMT+02:00 Thusitha Thilina Dayaratne <
> > > > > [email protected]>:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I've done some debugging. It seems that when I'm running on my
> > server
> > > > > > org.apache.openejb.jee.SessionBean.getResourceRef returns a
> single
> > > > entry.
> > > > > > I've debug the app on tomee 1.7.2 standard distribution (where it
> > > works
> > > > > > without any issues). There it return 9 entries.
> > > > > > Is is due to a classloading issue?
> > > > > > Is this implies that my TomEE integration doesn't scan the
> > > annotations
> > > > > > properly?
> > > > > >
> > > > > > Thanks
> > > > > > Best Regards
> > > > > > /Thusitha
> > > > > >
> > > > > > 2015-05-25 10:40 GMT+05:30 Thusitha Thilina Dayaratne <
> > > > > > [email protected]>:
> > > > > >
> > > > > > > >>InjectionProcessor or CdiResourceService surely
> > > > > > > Thanks for quick reply Romain. I will look into them :)
> > > > > > >
> > > > > > > Best Regards
> > > > > > > /Thusitha
> > > > > > >
> > > > > > > 2015-05-25 10:35 GMT+05:30 Romain Manni-Bucau <
> > > [email protected]
> > > > >:
> > > > > > >
> > > > > > >> InjectionProcessor or CdiResourceService surely
> > > > > > >>
> > > > > > >>
> > > > > > >> Romain Manni-Bucau
> > > > > > >> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > > >> <http://rmannibucau.wordpress.com> | Github <
> > > > > > >> https://github.com/rmannibucau> |
> > > > > > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> Tomitriber
> > > > > > >> <http://www.tomitribe.com>
> > > > > > >>
> > > > > > >> 2015-05-25 6:34 GMT+02:00 Thusitha Thilina Dayaratne <
> > > > > > >> [email protected]>:
> > > > > > >>
> > > > > > >> > >>Classloader error/wrong one?
> > > > > > >> > Thanks for the response Romain. Could you point out a
> > particular
> > > > > place
> > > > > > >> that
> > > > > > >> > I can debug for this?
> > > > > > >> > Thanks
> > > > > > >> > /Thusitha
> > > > > > >> >
> > > > > > >> > 2015-05-23 13:16 GMT+05:30 Romain Manni-Bucau <
> > > > > [email protected]
> > > > > > >:
> > > > > > >> >
> > > > > > >> > > Classloader error/wrong one?
> > > > > > >> > > Le 23 mai 2015 09:03, "Thusitha Thilina Dayaratne" <
> > > > > > >> > > [email protected]> a écrit :
> > > > > > >> > >
> > > > > > >> > > > Hi,
> > > > > > >> > > >
> > > > > > >> > > > I'm trying to integrate TomEE 1.7.2-SNAPSHOT to an
> > embedded
> > > > > tomcat
> > > > > > >> > server
> > > > > > >> > > > instance along with  OpenEJB 4.7.2-SNAPSHOT and OWB
> > 1.2.7. I
> > > > > have
> > > > > > >> > created
> > > > > > >> > > > an OSGi bundle which contains them and CXF.
> > > > > > >> > > >
> > > > > > >> > > > I'm trying to test the TomEE integration using the
> > > ejb-example
> > > > > > >> which is
> > > > > > >> > > > provided with TomEE. I tested the JNDI dump by running
> it
> > on
> > > > my
> > > > > > >> server
> > > > > > >> > > and
> > > > > > >> > > > standard TomEE distribution.
> > > > > > >> > > >
> > > > > > >> > > > In my server it is missing all the openejb stuffs
> > > > > > >> > > >
> > > > > > >> > > > env/openejb=
> > > > > > >> > > > > env/openejb/Resource=
> > > > > > >> > > > > env/openejb/Resource/context.xml=
> > > > > > >> > > > >
> env/openejb/Resource/context.xml/resource=[ResourceBean
> > > > > > >> > > ContextResource]
> > > > > > >> > > > > env/openejb/Resource/ejb-examples-1.0.0-SNAPSHOT=
> > > > > > >> > > > >
> > > > env/openejb/Resource/ejb-examples-1.0.0-SNAPSHOT/context.xml=
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
> env/openejb/Resource/ejb-examples-1.0.0-SNAPSHOT/context.xml/resource=[ResourceBean
> > > > > > >> > > > > ContextResource]
> > > > > > >> > > > >
> > env/openejb/Resource/ejb-examples-1.0.0-SNAPSHOT/web.xml=
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
> env/openejb/Resource/ejb-examples-1.0.0-SNAPSHOT/web.xml/resource-env-ref=[ResourceBean
> > > > > > >> > > > > ContextResourceEnvRef]
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
> env/openejb/Resource/ejb-examples-1.0.0-SNAPSHOT/web.xml/resource-ref=[ResourceBean
> > > > > > >> > > > > ContextResourceRef]
> > > > > > >> > > > > env/openejb/Resource/web.xml=
> > > > > > >> > > > >
> > > env/openejb/Resource/web.xml/resource-env-ref=[ResourceBean
> > > > > > >> > > > > ContextResourceEnvRef]
> > > > > > >> > > > >
> env/openejb/Resource/web.xml/resource-ref=[ResourceBean
> > > > > > >> > > > ContextResourceRef]
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > > >
> > > > > > >> > > >
> > > > > > >> > > > And in the annotated example datasource is null.
> > > > > > >> > > >
> > > > > > >> > > > What could be the reasons for these issues?
> > > > > > >> > > > Is it because may be configurations aren't pick up
> > > correctly?
> > > > > > >> > > >
> > > > > > >> > > >
> > > > > > >> > > > Thanks
> > > > > > >> > > > Best Regards
> > > > > > >> > > > /Thusitha
> > > > > > >> > > > --
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >> >
> > > > > > >> >
> > > > > > >> > --
> > > > > > >> >
> > > > > > >>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > >
> > >
> >
> >
> >
> > --
> >
>



--

Reply via email to