commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Durant <bdur...@g2ss.com>
Subject Re: [daemon] How to daemonize a Java app that has a private default constructor
Date Sat, 08 Aug 2015 16:46:10 GMT
On Aug 8, 2015, at 9:29 AM, sebb <sebbaz@gmail.com> wrote:
> 
> On 28 July 2015 at 00:56, Bill Durant <bdurant@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


Mime
View raw message