You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Bill Durant <bd...@g2ss.com> on 2015/07/28 01:56:33 UTC
[daemon] How to daemonize a Java app that has a private default constructor
Greetings:
I have Java application that has a private default constructor in order
to support the singleton pattern.
When I try to daemonize the application with jsvc, I get the following
exception:
java.lang.IllegalAccessException: Class
org.apache.commons.daemon.support.DaemonLoader can not access a member
of class example.App with modifiers "private"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:101)
at java.lang.Class.newInstance(Class.java:432)
at
org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190)
Cannot load daemon
Service exit with a return value of 3
Is it not possible to daemonize a Java application that has a private
default constructor with jsvc?
Thanks!
Bill
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [daemon] How to daemonize a Java app that has a private default constructor
Posted by Bill Durant <bd...@g2ss.com>.
On Aug 8, 2015, at 9:29 AM, sebb <se...@gmail.com> wrote:
>
> On 28 July 2015 at 00:56, Bill Durant <bd...@g2ss.com> wrote:
>> Greetings:
>>
>> I have Java application that has a private default constructor in order to
>> support the singleton pattern.
>>
>> When I try to daemonize the application with jsvc, I get the following
>> exception:
>>
>> java.lang.IllegalAccessException: Class
>> org.apache.commons.daemon.support.DaemonLoader can not access a member of
>> class example.App with modifiers "private"
>> at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:101)
>> at java.lang.Class.newInstance(Class.java:432)
>> at
>> org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190)
>> Cannot load daemon
>> Service exit with a return value of 3
>>
>> Is it not possible to daemonize a Java application that has a private
>> default constructor with jsvc?
>
> I would try writing a wrapper (with a public constructor) that creates
> the singleton.
Yes, that’s what I ended up doing in the end. Thanks! -Bill
>
>> Thanks!
>>
>> Bill
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [daemon] How to daemonize a Java app that has a private default constructor
Posted by sebb <se...@gmail.com>.
On 28 July 2015 at 00:56, Bill Durant <bd...@g2ss.com> wrote:
> Greetings:
>
> I have Java application that has a private default constructor in order to
> support the singleton pattern.
>
> When I try to daemonize the application with jsvc, I get the following
> exception:
>
> java.lang.IllegalAccessException: Class
> org.apache.commons.daemon.support.DaemonLoader can not access a member of
> class example.App with modifiers "private"
> at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:101)
> at java.lang.Class.newInstance(Class.java:432)
> at
> org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190)
> Cannot load daemon
> Service exit with a return value of 3
>
> Is it not possible to daemonize a Java application that has a private
> default constructor with jsvc?
I would try writing a wrapper (with a public constructor) that creates
the singleton.
> Thanks!
>
> Bill
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org