You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Sathwik <sa...@apache.org> on 2016/08/16 14:03:46 UTC

Re: System configuration in Tomee Embedded

Hi Romain,

Incase the dir is not set on the Configuration object, there is no way to get hold of the baseDIr that the container creates. getBaseDir() is not accessible.

Container start() is doing a very heavy lifting as against to the setup(). The setting of catalina base is within the start(). So I can't even get the system property within the setup().

What actually am looking is to provide a way to make changes to catalina.policy, catalina.properties, logging.properties and make the embedded container use it as against to the version of the files what the tomee embedded container uses.

regards,
sathwik

On 2016-07-21 15:58 (+0530), Romain Manni-Bucau <rm...@gmail.com> wrote: 
> Hmm,
> 
> that's true, thought I changed that, seems not
> 
> anyway easiest is to override setup to add post tasks:
> 
> public void setup(final Configuration configuration) {
> 
>   super.setup(configuration);
> 
>   fillMyConfig();
> 
> }
> 
> 
> Does it work for you?
> 
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress 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-07-21 12:06 GMT+02:00 Sathwik <sa...@apache.org>:
> 
> > Hi Romain,
> >
> >
> > https://github.com/apache/tomee/blob/master/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java#L381
> >
> > Am I missing something.
> >
> > regards,
> > sathwik
> >
> > On 2016-07-21 15:31 (+0530), Romain Manni-Bucau <rm...@gmail.com>
> > wrote:
> > > Not if existing
> > >
> > https://github.com/apache/tomee/blob/master/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java#L719
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress 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-07-21 11:52 GMT+02:00 Sathwik <sa...@apache.org>:
> > >
> > > > Hi Romain,
> > > >
> > > >
> > > >
> > https://github.com/apache/tomee/blob/master/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java#L380
> > > >
> > > > The basedir gets created afresh.
> > > >
> > > > regards,
> > > > sathwik
> > > >
> > > > On 2016-07-21 14:55 (+0530), Romain Manni-Bucau <rmannibucau@gmail.com
> > >
> > > > wrote:
> > > > > Hi
> > > > >
> > > > > Configuration.property(k, v) is the way to go.
> > > > >
> > > > > You should also be able to set a "dir" on the configuration which is
> > the
> > > > > basedir and create the configuration inside *before* starting the
> > > > container
> > > > > (each time) so something like;
> > > > >
> > > > > main(args) {
> > > > >   final File base = createMybase();
> > > > >   Main.main(new String[] {"--directory", base.getPath()});
> > > > > }
> > > > >
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress 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-07-21 11:16 GMT+02:00 Sathwik <sa...@apache.org>:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > When using the org.apache.tomee.embedded.Main to start an embedded
> > > > > > container, what is the way to pass in the configuration options.
> > > > > >
> > > > > > For example:
> > > > > > exclusions_list file := could make this work only with the
> > > > > > -Dopenejb.additional.exclude=
> > > > > > JAVA_OPTS="$JAVA_OPTS
> > > > > >
> > > >
> > -Djava.naming.factory.initial=org.apache.openejb.core.LocalInitialContextFactory"
> > > > > > JAVA_OPTS="$JAVA_OPTS -Dopenejb.log.factory=slf4j"
> > > > > >
> > > > > > Since the Tomee working directory is dynamically created, and
> > > > openejb.home
> > > > > > is pointing to this directory. How is it possible to override the
> > > > defaults.
> > > > > >
> > > > > > regards,
> > > > > > sathwik
> > > > > >
> > > > >
> > > >
> > >
> >
> 

Re: System configuration in Tomee Embedded

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-08-16 16:03 GMT+02:00 Sathwik <sa...@apache.org>:

> Hi Romain,
>
> Incase the dir is not set on the Configuration object, there is no way to
> get hold of the baseDIr that the container creates. getBaseDir() is not
> accessible.
>
> Container start() is doing a very heavy lifting as against to the setup().
> The setting of catalina base is within the start(). So I can't even get the
> system property within the setup().
>
>
Well you can get all the manual ones since it is the one you set on
configuration instance


> What actually am looking is to provide a way to make changes to
> catalina.policy, catalina.properties, logging.properties and make the
> embedded container use it as against to the version of the files what the
> tomee embedded container uses.
>
>
- logging.properties: wouldnt change anything since in embedded mode JUL is
already set and tomcat doesnt override it (we do for "simpleLog" option in
tomee but I wouldnt recommand it for you). So this is up to the bootstrap
command there and is not really linked to the embedded server. You can
still use slf4j/log4j2 to control it within the JVM.

- catalina.policy: same as logging.properties: owned by the JVM so too late
for embedded servers.

- catalina.properties: would be interested in which entry in particular
since some of them are skipped and other can be configured in other ways.


Anyway if you override setup() as proposed you execute after directories
creation so it should work.


> regards,
> sathwik
>
> On 2016-07-21 15:58 (+0530), Romain Manni-Bucau <rm...@gmail.com>
> wrote:
> > Hmm,
> >
> > that's true, thought I changed that, seems not
> >
> > anyway easiest is to override setup to add post tasks:
> >
> > public void setup(final Configuration configuration) {
> >
> >   super.setup(configuration);
> >
> >   fillMyConfig();
> >
> > }
> >
> >
> > Does it work for you?
> >
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress 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-07-21 12:06 GMT+02:00 Sathwik <sa...@apache.org>:
> >
> > > Hi Romain,
> > >
> > >
> > > https://github.com/apache/tomee/blob/master/tomee/tomee-
> embedded/src/main/java/org/apache/tomee/embedded/Container.java#L381
> > >
> > > Am I missing something.
> > >
> > > regards,
> > > sathwik
> > >
> > > On 2016-07-21 15:31 (+0530), Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > wrote:
> > > > Not if existing
> > > >
> > > https://github.com/apache/tomee/blob/master/tomee/tomee-
> embedded/src/main/java/org/apache/tomee/embedded/Container.java#L719
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress 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-07-21 11:52 GMT+02:00 Sathwik <sa...@apache.org>:
> > > >
> > > > > Hi Romain,
> > > > >
> > > > >
> > > > >
> > > https://github.com/apache/tomee/blob/master/tomee/tomee-
> embedded/src/main/java/org/apache/tomee/embedded/Container.java#L380
> > > > >
> > > > > The basedir gets created afresh.
> > > > >
> > > > > regards,
> > > > > sathwik
> > > > >
> > > > > On 2016-07-21 14:55 (+0530), Romain Manni-Bucau <
> rmannibucau@gmail.com
> > > >
> > > > > wrote:
> > > > > > Hi
> > > > > >
> > > > > > Configuration.property(k, v) is the way to go.
> > > > > >
> > > > > > You should also be able to set a "dir" on the configuration
> which is
> > > the
> > > > > > basedir and create the configuration inside *before* starting the
> > > > > container
> > > > > > (each time) so something like;
> > > > > >
> > > > > > main(args) {
> > > > > >   final File base = createMybase();
> > > > > >   Main.main(new String[] {"--directory", base.getPath()});
> > > > > > }
> > > > > >
> > > > > >
> > > > > > Romain Manni-Bucau
> > > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress 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-07-21 11:16 GMT+02:00 Sathwik <sa...@apache.org>:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > When using the org.apache.tomee.embedded.Main to start an
> embedded
> > > > > > > container, what is the way to pass in the configuration
> options.
> > > > > > >
> > > > > > > For example:
> > > > > > > exclusions_list file := could make this work only with the
> > > > > > > -Dopenejb.additional.exclude=
> > > > > > > JAVA_OPTS="$JAVA_OPTS
> > > > > > >
> > > > >
> > > -Djava.naming.factory.initial=org.apache.openejb.core.
> LocalInitialContextFactory"
> > > > > > > JAVA_OPTS="$JAVA_OPTS -Dopenejb.log.factory=slf4j"
> > > > > > >
> > > > > > > Since the Tomee working directory is dynamically created, and
> > > > > openejb.home
> > > > > > > is pointing to this directory. How is it possible to override
> the
> > > > > defaults.
> > > > > > >
> > > > > > > regards,
> > > > > > > sathwik
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>