You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Gregory Orciuch <g....@gmail.com> on 2016/05/20 09:34:02 UTC

ApplicationComposer and @Startup (and logging)

Hi,

I think I'm facing an configuration issue here.
So having the @Singleton and @Startup Bean which is added in application
composer as below:
@Module
    public EjbJar beans() {
        EjbJar ejbJar = new EjbJar("ejb-beans");

        ejbJar.addEnterpriseBean(new SingletonBean(CacheInitBean.class));
....


This guy needs to perform a @PostConstruct actions, and I do not see the
logs out and seems like the PostConstruct is not fired at all

So two questions
1. How to ensure the log4j works for ApplicationComposer's created beans ?
2. Why @Startup seems to be skipped ?

BR,
Gregory

Re: ApplicationComposer and @Startup (and logging)

Posted by Gregory Orciuch <g....@gmail.com>.
thanks!

2016-05-23 15:02 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> without more info you'll not get much help I fear. Providing a github
> project showing the issue will make it trivial to solve IMO.
>
>
> 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> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-05-23 15:01 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
>
> > Hi,
> > any further idea how to enable log4j ?
> >
> > 2016-05-20 11:57 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
> >
> > > Yeap directly, actually I only pull the openejb-core for the
> > > ApplicationComposer
> > >
> > > 2016-05-20 11:56 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> > >
> > >> 2016-05-20 11:54 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
> > >>
> > >> > 2. Great. works. .setInitOnStartup(true) does the trick. For group
> > >> > reference. Something like this: ejbJar.addEnterpriseBean(new
> > >> > SingletonBean(CacheInitBean.class)).setInitOnStartup(true);
> > >> >
> > >> > 1. It's kinda blind on log4j stuff. Added the log4j maven test
> > >> dependency,
> > >> > then added the log4j.properties to src/test/resources . Log level is
> > >> > fine... what else ?
> > >> >
> > >> >
> > >> do you use log4j API directly? TomEE uses JUL by default and needs to
> be
> > >> configured to use log4j but not your code.
> > >>
> > >>
> > >> > 2016-05-20 11:47 GMT+02:00 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >:
> > >> >
> > >> > > Hello
> > >> > >
> > >> > > 2016-05-20 11:34 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
> > >> > >
> > >> > > > Hi,
> > >> > > >
> > >> > > > I think I'm facing an configuration issue here.
> > >> > > > So having the @Singleton and @Startup Bean which is added in
> > >> > application
> > >> > > > composer as below:
> > >> > > > @Module
> > >> > > >     public EjbJar beans() {
> > >> > > >         EjbJar ejbJar = new EjbJar("ejb-beans");
> > >> > > >
> > >> > > >         ejbJar.addEnterpriseBean(new
> > >> > SingletonBean(CacheInitBean.class));
> > >> > > > ....
> > >> > > >
> > >> > > >
> > >> > > > This guy needs to perform a @PostConstruct actions, and I do not
> > see
> > >> > the
> > >> > > > logs out and seems like the PostConstruct is not fired at all
> > >> > > >
> > >> > > > So two questions
> > >> > > > 1. How to ensure the log4j works for ApplicationComposer's
> created
> > >> > beans
> > >> > > ?
> > >> > > >
> > >> > >
> > >> > > What's your issue? adding the jars and config should be enough
> > >> > >
> > >> > >
> > >> > > > 2. Why @Startup seems to be skipped ?
> > >> > > >
> > >> > > >
> > >> > > You set up a SingletonBean so you need to set setInitOnStartup
> > >> > >
> > >> > >
> > >> > > > BR,
> > >> > > > Gregory
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: ApplicationComposer and @Startup (and logging)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
without more info you'll not get much help I fear. Providing a github
project showing the issue will make it trivial to solve IMO.


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> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-05-23 15:01 GMT+02:00 Gregory Orciuch <g....@gmail.com>:

> Hi,
> any further idea how to enable log4j ?
>
> 2016-05-20 11:57 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
>
> > Yeap directly, actually I only pull the openejb-core for the
> > ApplicationComposer
> >
> > 2016-05-20 11:56 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> >
> >> 2016-05-20 11:54 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
> >>
> >> > 2. Great. works. .setInitOnStartup(true) does the trick. For group
> >> > reference. Something like this: ejbJar.addEnterpriseBean(new
> >> > SingletonBean(CacheInitBean.class)).setInitOnStartup(true);
> >> >
> >> > 1. It's kinda blind on log4j stuff. Added the log4j maven test
> >> dependency,
> >> > then added the log4j.properties to src/test/resources . Log level is
> >> > fine... what else ?
> >> >
> >> >
> >> do you use log4j API directly? TomEE uses JUL by default and needs to be
> >> configured to use log4j but not your code.
> >>
> >>
> >> > 2016-05-20 11:47 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >> >
> >> > > Hello
> >> > >
> >> > > 2016-05-20 11:34 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
> >> > >
> >> > > > Hi,
> >> > > >
> >> > > > I think I'm facing an configuration issue here.
> >> > > > So having the @Singleton and @Startup Bean which is added in
> >> > application
> >> > > > composer as below:
> >> > > > @Module
> >> > > >     public EjbJar beans() {
> >> > > >         EjbJar ejbJar = new EjbJar("ejb-beans");
> >> > > >
> >> > > >         ejbJar.addEnterpriseBean(new
> >> > SingletonBean(CacheInitBean.class));
> >> > > > ....
> >> > > >
> >> > > >
> >> > > > This guy needs to perform a @PostConstruct actions, and I do not
> see
> >> > the
> >> > > > logs out and seems like the PostConstruct is not fired at all
> >> > > >
> >> > > > So two questions
> >> > > > 1. How to ensure the log4j works for ApplicationComposer's created
> >> > beans
> >> > > ?
> >> > > >
> >> > >
> >> > > What's your issue? adding the jars and config should be enough
> >> > >
> >> > >
> >> > > > 2. Why @Startup seems to be skipped ?
> >> > > >
> >> > > >
> >> > > You set up a SingletonBean so you need to set setInitOnStartup
> >> > >
> >> > >
> >> > > > BR,
> >> > > > Gregory
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>

Re: ApplicationComposer and @Startup (and logging)

Posted by Gregory Orciuch <g....@gmail.com>.
Hi,
any further idea how to enable log4j ?

2016-05-20 11:57 GMT+02:00 Gregory Orciuch <g....@gmail.com>:

> Yeap directly, actually I only pull the openejb-core for the
> ApplicationComposer
>
> 2016-05-20 11:56 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> 2016-05-20 11:54 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
>>
>> > 2. Great. works. .setInitOnStartup(true) does the trick. For group
>> > reference. Something like this: ejbJar.addEnterpriseBean(new
>> > SingletonBean(CacheInitBean.class)).setInitOnStartup(true);
>> >
>> > 1. It's kinda blind on log4j stuff. Added the log4j maven test
>> dependency,
>> > then added the log4j.properties to src/test/resources . Log level is
>> > fine... what else ?
>> >
>> >
>> do you use log4j API directly? TomEE uses JUL by default and needs to be
>> configured to use log4j but not your code.
>>
>>
>> > 2016-05-20 11:47 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>> >
>> > > Hello
>> > >
>> > > 2016-05-20 11:34 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
>> > >
>> > > > Hi,
>> > > >
>> > > > I think I'm facing an configuration issue here.
>> > > > So having the @Singleton and @Startup Bean which is added in
>> > application
>> > > > composer as below:
>> > > > @Module
>> > > >     public EjbJar beans() {
>> > > >         EjbJar ejbJar = new EjbJar("ejb-beans");
>> > > >
>> > > >         ejbJar.addEnterpriseBean(new
>> > SingletonBean(CacheInitBean.class));
>> > > > ....
>> > > >
>> > > >
>> > > > This guy needs to perform a @PostConstruct actions, and I do not see
>> > the
>> > > > logs out and seems like the PostConstruct is not fired at all
>> > > >
>> > > > So two questions
>> > > > 1. How to ensure the log4j works for ApplicationComposer's created
>> > beans
>> > > ?
>> > > >
>> > >
>> > > What's your issue? adding the jars and config should be enough
>> > >
>> > >
>> > > > 2. Why @Startup seems to be skipped ?
>> > > >
>> > > >
>> > > You set up a SingletonBean so you need to set setInitOnStartup
>> > >
>> > >
>> > > > BR,
>> > > > Gregory
>> > > >
>> > >
>> >
>>
>
>

Re: ApplicationComposer and @Startup (and logging)

Posted by Gregory Orciuch <g....@gmail.com>.
Yeap directly, actually I only pull the openejb-core for the
ApplicationComposer

2016-05-20 11:56 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> 2016-05-20 11:54 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
>
> > 2. Great. works. .setInitOnStartup(true) does the trick. For group
> > reference. Something like this: ejbJar.addEnterpriseBean(new
> > SingletonBean(CacheInitBean.class)).setInitOnStartup(true);
> >
> > 1. It's kinda blind on log4j stuff. Added the log4j maven test
> dependency,
> > then added the log4j.properties to src/test/resources . Log level is
> > fine... what else ?
> >
> >
> do you use log4j API directly? TomEE uses JUL by default and needs to be
> configured to use log4j but not your code.
>
>
> > 2016-05-20 11:47 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> >
> > > Hello
> > >
> > > 2016-05-20 11:34 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
> > >
> > > > Hi,
> > > >
> > > > I think I'm facing an configuration issue here.
> > > > So having the @Singleton and @Startup Bean which is added in
> > application
> > > > composer as below:
> > > > @Module
> > > >     public EjbJar beans() {
> > > >         EjbJar ejbJar = new EjbJar("ejb-beans");
> > > >
> > > >         ejbJar.addEnterpriseBean(new
> > SingletonBean(CacheInitBean.class));
> > > > ....
> > > >
> > > >
> > > > This guy needs to perform a @PostConstruct actions, and I do not see
> > the
> > > > logs out and seems like the PostConstruct is not fired at all
> > > >
> > > > So two questions
> > > > 1. How to ensure the log4j works for ApplicationComposer's created
> > beans
> > > ?
> > > >
> > >
> > > What's your issue? adding the jars and config should be enough
> > >
> > >
> > > > 2. Why @Startup seems to be skipped ?
> > > >
> > > >
> > > You set up a SingletonBean so you need to set setInitOnStartup
> > >
> > >
> > > > BR,
> > > > Gregory
> > > >
> > >
> >
>

Re: ApplicationComposer and @Startup (and logging)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-05-20 11:54 GMT+02:00 Gregory Orciuch <g....@gmail.com>:

> 2. Great. works. .setInitOnStartup(true) does the trick. For group
> reference. Something like this: ejbJar.addEnterpriseBean(new
> SingletonBean(CacheInitBean.class)).setInitOnStartup(true);
>
> 1. It's kinda blind on log4j stuff. Added the log4j maven test dependency,
> then added the log4j.properties to src/test/resources . Log level is
> fine... what else ?
>
>
do you use log4j API directly? TomEE uses JUL by default and needs to be
configured to use log4j but not your code.


> 2016-05-20 11:47 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>
> > Hello
> >
> > 2016-05-20 11:34 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
> >
> > > Hi,
> > >
> > > I think I'm facing an configuration issue here.
> > > So having the @Singleton and @Startup Bean which is added in
> application
> > > composer as below:
> > > @Module
> > >     public EjbJar beans() {
> > >         EjbJar ejbJar = new EjbJar("ejb-beans");
> > >
> > >         ejbJar.addEnterpriseBean(new
> SingletonBean(CacheInitBean.class));
> > > ....
> > >
> > >
> > > This guy needs to perform a @PostConstruct actions, and I do not see
> the
> > > logs out and seems like the PostConstruct is not fired at all
> > >
> > > So two questions
> > > 1. How to ensure the log4j works for ApplicationComposer's created
> beans
> > ?
> > >
> >
> > What's your issue? adding the jars and config should be enough
> >
> >
> > > 2. Why @Startup seems to be skipped ?
> > >
> > >
> > You set up a SingletonBean so you need to set setInitOnStartup
> >
> >
> > > BR,
> > > Gregory
> > >
> >
>

Re: ApplicationComposer and @Startup (and logging)

Posted by Gregory Orciuch <g....@gmail.com>.
2. Great. works. .setInitOnStartup(true) does the trick. For group
reference. Something like this: ejbJar.addEnterpriseBean(new
SingletonBean(CacheInitBean.class)).setInitOnStartup(true);

1. It's kinda blind on log4j stuff. Added the log4j maven test dependency,
then added the log4j.properties to src/test/resources . Log level is
fine... what else ?

2016-05-20 11:47 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> Hello
>
> 2016-05-20 11:34 GMT+02:00 Gregory Orciuch <g....@gmail.com>:
>
> > Hi,
> >
> > I think I'm facing an configuration issue here.
> > So having the @Singleton and @Startup Bean which is added in application
> > composer as below:
> > @Module
> >     public EjbJar beans() {
> >         EjbJar ejbJar = new EjbJar("ejb-beans");
> >
> >         ejbJar.addEnterpriseBean(new SingletonBean(CacheInitBean.class));
> > ....
> >
> >
> > This guy needs to perform a @PostConstruct actions, and I do not see the
> > logs out and seems like the PostConstruct is not fired at all
> >
> > So two questions
> > 1. How to ensure the log4j works for ApplicationComposer's created beans
> ?
> >
>
> What's your issue? adding the jars and config should be enough
>
>
> > 2. Why @Startup seems to be skipped ?
> >
> >
> You set up a SingletonBean so you need to set setInitOnStartup
>
>
> > BR,
> > Gregory
> >
>

Re: ApplicationComposer and @Startup (and logging)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

2016-05-20 11:34 GMT+02:00 Gregory Orciuch <g....@gmail.com>:

> Hi,
>
> I think I'm facing an configuration issue here.
> So having the @Singleton and @Startup Bean which is added in application
> composer as below:
> @Module
>     public EjbJar beans() {
>         EjbJar ejbJar = new EjbJar("ejb-beans");
>
>         ejbJar.addEnterpriseBean(new SingletonBean(CacheInitBean.class));
> ....
>
>
> This guy needs to perform a @PostConstruct actions, and I do not see the
> logs out and seems like the PostConstruct is not fired at all
>
> So two questions
> 1. How to ensure the log4j works for ApplicationComposer's created beans ?
>

What's your issue? adding the jars and config should be enough


> 2. Why @Startup seems to be skipped ?
>
>
You set up a SingletonBean so you need to set setInitOnStartup


> BR,
> Gregory
>