Skip to main content

Can't stop glassfish on linux as user (CLI306 Warning)

5 replies [Last post]
schrotti12
Offline
Joined: 2012-06-21
Points: 0

Good morning!

I have a weird problem with glassfish running on Debian GNU/Linux 6.

I have jdk1.7.0_06 accessible via "/usr/lib/jvm/jdk". It belongs to user and group "root".
Glassfish 3.1.2.2 is located in folder "/opt/glassfish3" and belongs to user and group "glassfish".

I have enabled secure-admin to make remote-deploy possible...
To start and stop the server I have written a custom start-stop script.

Now the problem:
I can start the server by using the asadmin-command with the user "glassfish", but when I want to stop the server using the user "glassfish" it sais:

glassfish@server:/opt$ glassfish3/bin/asadmin stop-domain
CLI306 Warning - The server located at /opt/glassfish3/glassfish/domains/domain1 is not running.
Command stop-domain executed successfully.

I did not find any solution via google and hope that somebody can help me here...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
schrotti12
Offline
Joined: 2012-06-21
Points: 0

One more detail:
Problem occurs only in version 3.1.2 and higher...
My server is now running on 3.1.1 and in this version the problem does not occur.
Server is started and running under special user (glassfish, id=2000) and group (glassfish, id=2000).

tmpsa
Offline
Joined: 2010-02-01
Points: 0

I have suddenly ran into the same problem. Glassfish can be started with

sudo -u www-data /mnt/persist/glassfishv3/bin/asadmin --secure start-domain domain1

but not stopped with

sudo -u www-data /mnt/persist/glassfishv3/bin/asadmin --secure stop-domain domain1

Also, I can no longer deploy webapps.

server.log says:

[#|2012-08-27T13:50:45.803+0200|WARNING|glassfish3.1.2|java.util.prefs|_ThreadID=23;_ThreadName=Thread-2;|Could not lock User prefs. Unix error code 2.|#]

[#|2012-08-27T13:50:45.804+0200|WARNING|glassfish3.1.2|java.util.prefs|_ThreadID=23;_ThreadName=Thread-2;|Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.|#]

What's going on?

vetler
Offline
Joined: 2010-05-25
Points: 0

The BackingStoreException probably appears because the www-data user
doesn't have a home directory, or it isn't writable. Java apparently
need this for storing preferences.
You can override it and use a different directory with a JVM-option:
-Djava.util.prefs.userRoot=/some/writable/directory

On Mon, Aug 27, 2012 at 1:46 PM, wrote:
> I have suddenly ran into the same problem. Glassfish can be started with
> sudo
> -u www-data /mnt/persist/glassfishv3/bin/asadmin --secure start-domain
> domain1 but not stopped with sudo -u www-data
> /mnt/persist/glassfishv3/bin/asadmin --secure stop-domain domain1 Also, I
> can
> no longer deploy webapps. server.log says:
> [#|2012-08-27T13:50:45.803+0200|WARNING|glassfish3.1.2|java.util.prefs|_ThreadID=23;_ThreadName=Thread-2;|Could
> not lock User prefs. Unix error code 2.|#]
> [#|2012-08-27T13:50:45.804+0200|WARNING|glassfish3.1.2|java.util.prefs|_ThreadID=23;_ThreadName=Thread-2;|Couldn't
> flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file
> lock.|#] What's going on?
>
> --
>
> [Message sent by forum member 'tmpsa']
>
> View Post: http://forums.java.net/node/889274
>
>

Open Indiana

This problem has struck me more than once. But it is mostly a problem
created by myself (and you).

If you start Glassfish (by accident) under the wrong user-account (because
maybe you are in a hurry) then glassfish will create all files under that
user-account. If you forget this and you try to stop Glassfish while using
the other user-accountname it will not work.

See who owns {glassfish-dir}/domains/domain1/generated.

Try to stop glassfish the hard-way and re-own all directories under
{glassfish-dir}/domains/domain1 to the right user. Also the temp path for
glassfish needs to have the right ownership.

-----Original Message-----
From: vetler@gmail.com [mailto:vetler@gmail.com] On Behalf Of Vetle
Leinonen-Roeim
Sent: maandag 27 augustus 2012 14:36
To: users@glassfish.java.net
Subject: Re: Can't stop glassfish on linux as user (CLI306 Warning)

The BackingStoreException probably appears because the www-data user doesn't
have a home directory, or it isn't writable. Java apparently need this for
storing preferences.
You can override it and use a different directory with a JVM-option:
-Djava.util.prefs.userRoot=/some/writable/directory

On Mon, Aug 27, 2012 at 1:46 PM, wrote:
> I have suddenly ran into the same problem. Glassfish can be started
> with sudo -u www-data /mnt/persist/glassfishv3/bin/asadmin --secure
> start-domain
> domain1 but not stopped with sudo -u www-data
> /mnt/persist/glassfishv3/bin/asadmin --secure stop-domain domain1
> Also, I can no longer deploy webapps. server.log says:
> [#|2012-08-27T13:50:45.803+0200|WARNING|glassfish3.1.2|java.util.prefs
> |_ThreadID=23;_ThreadName=Thread-2;|Could
> not lock User prefs. Unix error code 2.|#]
> [#|2012-08-27T13:50:45.804+0200|WARNING|glassfish3.1.2|java.util.prefs
> |_ThreadID=23;_ThreadName=Thread-2;|Couldn't
> flush user prefs: java.util.prefs.BackingStoreException: Couldn't get
> file lock.|#] What's going on?
>
> --
>
> [Message sent by forum member 'tmpsa']
>
> View Post: http://forums.java.net/node/889274
>
>

tmpsa
Offline
Joined: 2010-02-01
Points: 0

Yup, that was indeed the problem. Ran into it again today. Thanks for the tip!
chown -R www-data:www-data glassfish3
did the trick.