I have problem with file permissions with RollingFile and log4j2 configuration.
Application is creating log file as follows:
-rwxr-xr-x. 1 centos centos 10379932 Feb 8 13:55 application.log
after rolling files read permissions for others are missing. I'm not using any permissions setting with log4j
-rw-r-----. 1 root root 524 Feb 9 13:42 application.log
-rw-r-----. 1 root root 462705 Feb 9 10:24 application.log.1.gz
umask is: 0022
my log4j2.xml
<RollingFile name="test_app" fileName="${sys:application.home}/logs/application.log" ignoreExceptions="false" filePattern="${sys:application.home}/logs/application.log.%i.gz">
<PatternLayout pattern="%d{dd-MMM-yyyy HH:mm:ss,SSS} - %X{userId} - %X{sessionId} %-5p %c{1}:%L - %m%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="10MB"/>
</Policies>
<DefaultRolloverStrategy max="50"/>
</RollingFile>
I have 2 environments and on the second one permissions are as expected (application and log4j2 configuration is the same)
Where can I search the problem?
Related
I am newly assigned to this shared hosting (ssh access only). Have no sudo or yum facility. I am trying to scrape some data from a dynamically loaded website [So, can't use scrapy or bs]. When I am using Selenium, it gives an error:
/home/sanelywr/voyager-bot/app.py:28: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Firefox(options=options, executable_path=gecko_path)
Traceback (most recent call last):
File "/home/sanelywr/voyager-bot/app.py", line 28, in <module>
driver = webdriver.Firefox(options=options, executable_path=gecko_path)
File "/home/sanelywr/virtualenv/voyager-bot/3.9/lib/python3.9/site-packages/selenium/webdriver/firefox/webdriver.py", line 180, in __init__
RemoteWebDriver.__init__(
File "/home/sanelywr/virtualenv/voyager-bot/3.9/lib/python3.9/site- packages/selenium/webdriver/remote/webdriver.py", line 275, in __init__
self.start_session(capabilities, browser_profile)
File "/home/sanelywr/virtualenv/voyager-bot/3.9/lib/python3.9/site- packages/selenium/webdriver/remote/webdriver.py", line 365, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/sanelywr/virtualenv/voyager-bot/3.9/lib/python3.9/site- packages/selenium/webdriver/remote/webdriver.py", line 430, in execute
self.error_handler.check_response(response)
File "/home/sanelywr/virtualenv/voyager-bot/3.9/lib/python3.9/site- packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1
When checking the geckodriver.log it says,
1653393333249 geckodriver INFO Listening on 127.0.0.1:33457
1653393333256 mozrunner::runner INFO Running command: "/home/sanelywr/voyager-bot/firefox/firefox" "--marionette" "--headless" "--no-sandbox" "-headless" "--disable-dev-shm-usage" "--remote-debugging-port" "37442" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "/tmp/rust_mozprofilei8tj67"
(firefox:28332): Gtk-WARNING **: 07:55:33.285: Locale not supported by C library.
Using the fallback 'C' locale.
**Error: no display specified**
Apparently, I have no screen on this server as I have checked by the following command:
$ echo $DISPLAY
It displays nothing.
I have already set the browser option to headless mode [within the python code].
And, I have also done the following:
$ export MOZ_HEADLESS = 1
And yes, I cannot use the virtual screen like xvfb because even when I am able to pip install the related wrapper, I still cannot install xvfb because I don't have sudo or yum [and cannot find a .tar.bz2 or tar.gz file].
How can I run the selenium browser without having to open the browser on any screen altogether? [Tried PhantomJS() too, even that's not working]
My python script :
import os
from credentials import API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
#from pyvirtualdisplay.xephyr import XephyrDisplay
#from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import tweepy
auth = tweepy.OAuthHandler(API_KEY, API_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
options = Options()
options.add_argument("--headless")
options.add_argument('--no-sandbox')
options.headless= True
#options = webdriver.ChromeOptions()
#options.add_argument('--no-sandbox')
options.add_argument("--disable-dev-shm-usage")
#options.binary_location = '/home/sanelywr/voyager-bot'
#driver = webdriver.Chrome(executable_path='./chromedriver', options=options)
#driver = webdriver.PhantomJS()
gecko_path = '/home/sanelywr/voyager-bot/geckodriver'
options.binary=FirefoxBinary('/home/sanelywr/voyager-bot/firefox/firefox')
#display = XephyrDisplay()
#display = Display(visible=0, size=(800, 600))
#display.start()
driver = webdriver.Firefox(options=options, executable_path=gecko_path)
url=""
driver.get(url)
#<-----------Some code for extracting some elements from the page----------------->
#driver.quit()
#display.stop()
My script folder:
drwxr-xr-x 4 sanelywr sanelywr 4.0K Jan 24 2016 phantomjs-2.1.1-linux-x86_64
-rw-rw-r-- 1 sanelywr sanelywr 23M Jan 24 2016 phantomjs-2.1.1-linux-x86_64.tar.bz2
drwxr-xr-x 7 sanelywr sanelywr 4.0K Apr 7 2016 firefox
-rw-rw-r-- 1 sanelywr sanelywr 50M Apr 11 2016 firefox-45.0.2.tar.bz2
-rwxr-xr-x 1 sanelywr sanelywr 8.3M Apr 6 11:54 geckodriver
drwxr-xr-x 2 sanelywr sanelywr 4.0K May 23 02:09 public
drwxr-xr-x 2 sanelywr sanelywr 4.0K May 23 02:09 tmp
-rw-r--r-- 1 sanelywr sanelywr 145 May 23 02:09 passenger_wsgi.py
-rw-r--r-- 1 sanelywr sanelywr 326 May 23 02:30 credentials.py
-rw-r--r-- 1 sanelywr sanelywr 0 May 23 02:31 temp.txt
-rw-r--r-- 1 sanelywr sanelywr 16 May 23 02:36 requirements.txt
drwxrwxr-x 2 sanelywr sanelywr 4.0K May 23 06:29 __pycache__
-rw-r--r-- 1 sanelywr sanelywr 8.3M May 24 05:26 geckodriver-v0.31.0-linux64.tar
-rw-r--r-- 1 sanelywr sanelywr 1.9K May 24 07:24 app.py
-rw-rw-r-- 1 sanelywr sanelywr 4.8K May 24 07:55 geckodriver.log
I followed a guide to get my python flask app running and I am at the last step where I change http into https with certbot. But when I run my certbot command sudo certbot --nginx -d domainname -d www.domainname I get ModuleNotFoundError: No module named '_cffi_backend'
The whole error is:
Traceback (most recent call last):
File "/usr/bin/certbot", line 11, in <module>
load_entry_point('certbot==0.31.0', 'console_scripts', 'certbot')()
File "/home/mc-obfuscator/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/mc-obfuscator/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2859, in load_entry_point
return ep.load()
File "/home/mc-obfuscator/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2450, in load
return self.resolve()
File "/home/mc-obfuscator/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2456, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/certbot/main.py", line 10, in <module>
import josepy as jose
File "/usr/lib/python3/dist-packages/josepy/__init__.py", line 44, in <module>
from josepy.interfaces import JSONDeSerializable
File "/usr/lib/python3/dist-packages/josepy/interfaces.py", line 8, in <module>
from josepy import errors, util
File "/usr/lib/python3/dist-packages/josepy/util.py", line 4, in <module>
import OpenSSL
File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 12, in <module>
from cryptography import x509
File "/usr/lib/python3/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
from cryptography.x509.base import (
File "/usr/lib/python3/dist-packages/cryptography/x509/base.py", line 16, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/lib/python3/dist-packages/cryptography/x509/extensions.py", line 18, in <module>
from cryptography.hazmat.primitives import constant_time, serialization
File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/constant_time.py", line 9, in <module>
from cryptography.hazmat.bindings._constant_time import lib
ModuleNotFoundError: No module named '_cffi_backend'
I hope someone can help as I have found a lot of people asking questions about this mysterious _cffi_backend thing.
Some more info:
If I do python3 -m pip install cffi it says requirement already satisfied.
I have also gotten this error when installing other things and trying different peoples solutions.
'ModuleNotFoundError: No module named 'apt_pkg'
that seems to be fixed by doing sudo apt-get install python3-apt --reinstall but now I get: ImportError: cannot import name '_gi' from partially initialized module 'gi' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gi/__init__.py)
I also made a symbolic link with /usr/lib/python3/dist-packages/apt_pkg.so -> apt_pkg.cpython-36m-x86_64-linux-gnu.so
something other people said would work. I am running python 3.8 but probably have 3.6 on the server as well. If I do python it opens the 3.8 shell. Also I am running ubuntu 18.04.4.
ls -al /usr/bin | grep python
gives :
-rwxr-xr-x 1 root root 1056 Apr 16 2018 dh_python2
lrwxrwxrwx 1 root root 23 Nov 7 10:07 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx 1 root root 23 Nov 7 10:44 pdb3.6 -> ../lib/python3.6/pdb.py
lrwxrwxrwx 1 root root 23 Nov 7 10:50 pdb3.7 -> ../lib/python3.7/pdb.py
lrwxrwxrwx 1 root root 23 Oct 28 16:14 pdb3.8 -> ../lib/python3.8/pdb.py
lrwxrwxrwx 1 root root 31 Oct 25 2018 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root 24 Jun 19 2019 python -> /etc/alternatives/python
lrwxrwxrwx 1 root root 16 Apr 16 2018 python-config -> python2.7-config
lrwxrwxrwx 1 root root 9 Apr 16 2018 python2 -> python2.7
lrwxrwxrwx 1 root root 16 Apr 16 2018 python2-config -> python2.7-config
-rwxr-xr-x 1 root root 3637096 Nov 7 10:07 python2.7
lrwxrwxrwx 1 root root 33 Nov 7 10:07 python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root 25 Jan 5 10:38 python3 -> /etc/alternatives/python3
-rwxr-xr-x 1 root root 384 Feb 5 2018 python3-futurize
-rwxr-xr-x 1 root root 388 Feb 5 2018 python3-pasteurize
-rwxr-xr-x 1 root root 152 Nov 11 2017 python3-pbr
-rwxr-xr-x 2 root root 4526456 Nov 7 10:44 python3.6
-rwxr-xr-x 2 root root 4526456 Nov 7 10:44 python3.6m
-rwxr-xr-x 2 root root 4873376 Nov 7 10:50 python3.7
-rwxr-xr-x 2 root root 4873376 Nov 7 10:50 python3.7m
-rwxr-xr-x 1 root root 5203488 Oct 28 16:14 python3.8
lrwxrwxrwx 1 root root 10 Oct 25 2018 python3m -> python3.6m
lrwxrwxrwx 1 root root 29 Apr 16 2018 pyversions -> ../share/python/pyversions.py
lrwxrwxrwx 1 root root 10 Sep 27 2018 uwsgi_python36 -> uwsgi-core
lrwxrwxrwx 1 root root 33 Apr 16 2018 x86_64-linux-gnu-python-config -> x86_64-linux-gnu-python2.7-config
-rwxr-xr-x 1 root root 2971 Nov 7 10:07 x86_64-linux-gnu-python2.7-config
The files do exist on my system because:
dpkg -l python3-cffi-backend python3-cryptography
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================================================-===============================-===============================-===============================================================================================================
ii python3-cffi-backend 1.11.5-1 amd64 Foreign Function Interface for Python 3 calling C code - runtime
ii python3-cryptography 2.1.4-1ubuntu1.3 amd64 Python library exposing cryptographic recipes and primitives (Python 3)
This fixes the problem:
pip install -U cffi
The solution ended up being to install sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools but not in any virtual environment and then to install cffl with pip3 also not in any virtual environment.
On an Ubuntu 18.04 system there were multiple version of python3 installed, with the default python3 (3.9) being different to the (apt managed) system version (3.6). Using update-alternatives to set the default to the system version allowed certbot to run as expected. E.g.:
update-alternatives --config python3
There are 3 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.9 3 auto mode
1 /usr/bin/python3.6 1 manual mode
2 /usr/bin/python3.8 2 manual mode
3 /usr/bin/python3.9 3 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
Then switch it back when done.
You can try following solution, if the solution above doesn't work for you..
pip3 -vvv install --upgrade --force-reinstall cffi
I tried following: https://www.aerospike.com/docs/operations/install/vagrant/mac/
and did following:
mkdir aerospike-vm
cd aerospike-vm
vagrant init aerospike/aerospike-ce
This creates Vagrantfile in the same directory.
Next I try:
vagrant up
Getting error:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'aerospike/aerospike-ce' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'aerospike/aerospike-ce' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/aerospike/aerospike-ce"]
Error: The requested URL returned error: 404 Not Found
What is the proper procedure to install Aerospike on Mac?
Thanks
I recorded this few months ago along with two other videos in this set. See if this youtube video helps you out: https://www.youtube.com/watch?v=qm42c0juam4&list=PLGo1-Ya-AEQDa32hFggyB0yIIOldxUFwv&index=3
Here is the output from my run:
Administrators-MacBook-Pro-4:aerospike-vm piyush$ ls -al
total 8
drwxr-xr-x 4 piyush staff 128 Apr 9 2018 .
drwxr-xr-x+ 54 piyush staff 1728 Jan 18 10:56 ..
drwxr-xr-x 3 piyush staff 96 Apr 9 2018 .vagrant
-rw-r--r-- 1 piyush staff 3029 Apr 9 2018 Vagrantfile
Administrators-MacBook-Pro-4:aerospike-vm piyush$ mv Vagrantfile Vagrantfile_old
Administrators-MacBook-Pro-4:aerospike-vm piyush$ vagrant init aerospike/aerospike-ce
==> vagrant: A new version of Vagrant is available: 2.2.3!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Administrators-MacBook-Pro-4:aerospike-vm piyush$ ls -al
total 16
drwxr-xr-x 5 piyush staff 160 Jan 31 14:13 .
drwxr-xr-x+ 54 piyush staff 1728 Jan 18 10:56 ..
drwxr-xr-x 3 piyush staff 96 Apr 9 2018 .vagrant
-rw-r--r-- 1 piyush staff 3029 Jan 31 14:13 Vagrantfile
-rw-r--r-- 1 piyush staff 3029 Apr 9 2018 Vagrantfile_old
Administrators-MacBook-Pro-4:aerospike-vm piyush$
Nagiosql generated files make problems during preflight check - but everythings seems to be okay.
/etc/nagios/nagios.cfg
....
## Hosts
cfg_dir=/etc/nagiosql/hosts/
cfg_file=/etc/nagiosql/hosttemplates.cfg
cfg_file=/etc/nagiosql/hostgroups.cfg
cfg_file=/etc/nagiosql/hostextinfo.cfg
cfg_file=/etc/nagiosql/hostescalations.cfg
cfg_file=/etc/nagiosql/hostdependencies.cfg
## Services
cfg_dir=/etc/nagiosql/services/
cfg_file=/etc/nagiosql/servicetemplates.cfg
cfg_file=/etc/nagiosql/servicegroups.cfg
cfg_file=/etc/nagiosql/serviceextinfo.cfg
cfg_file=/etc/nagiosql/serviceescalations.cfg
cfg_file=/etc/nagiosql/servicedependencies.cfg
...
nagios -v /etc/nagios/nagios.cfg
....
Running pre-flight check on configuration data...
Checking services...
Error: There are no services defined!
Checked 0 services.
Checking hosts...
Error: There are no hosts defined!
Checked 0 hosts.
The content seems okay to me
[root#xxx services]# cd /etc/nagiosql/services/
[root#xxx services]# ls -alh
total 20K
drwsr-sr-x 2 apache nagios 4.0K Aug 7 10:46 .
drwsr-sr-x 5 apache nagios 4.0K Aug 7 12:17 ..
-rw-r--r-- 1 apache nagios 2.3K Aug 7 10:46 localhost.cfg
-rw-r--r-- 1 apache nagios 2.2K Aug 7 10:46 www.google.com.cfg
-rw-r--r-- 1 apache nagios 1.1K Aug 7 10:46 www.yahoo.com.cfg
[root#xxx hosts]# ls -alh
total 16K
drwsr-sr-x 2 apache nagios 4.0K Aug 11 07:12 .
drwsr-sr-x 5 apache nagios 4.0K Aug 7 12:17 ..
-rw-r--r-- 1 apache nagios 800 Aug 11 07:12 GIT.cfg
-rw-r--r-- 1 apache nagios 948 Aug 11 07:12 psm01.cfg
Content also seems to be fine (generated by nagiosql):
[root#xxx hosts]# vi GIT.cfg
###############################################################################
#
# Host configuration file
#
# Created by: Nagios QL Version 3.2.0
# Date: 2015-08-11 07:12:54
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################
define host {
host_name GIT
alias GIT Server
address 172.25.10.80
register 0
}
###############################################################################
#
# Host configuration file
#
# END OF FILE
#
###############################################################################
~
Can somebody tell me where the solution for this problem is? Already wasted 2 hours...
Try removing the final slash from the directory names in your cfg_dir definitions and see if that doesn´t get it to recognize the cfg files in that directory.
For example,
Change:
cfg_dir=/etc/nagiosql/hosts/
...
cfg_dir=/etc/nagiosql/services/
To:
cfg_dir=/etc/nagiosql/hosts
...
cfg_dir=/etc/nagiosql/services
EDIT:
Okay I think directory permissions may be causing the cfg_dir evaulations to fail. According to the ls -alh output you listed, your /etc/nagiosql/hosts/, /etc/nagiosql/services/, and /etc/nagiosql/ directories do not grant write permissions to the nagios group. Nagios will need to get a directory listing for those directories and will need group write permissions to do it.
To remedy:
chmod g+w /etc/nagiosql/hosts/
chmod g+w /etc/nagiosql/services/
Restart nagios service.
Also, you don't need to remove the slashes from the directory paths in the nagios cfg_dir configurations. Nagios will strip the trailing slash (/) for you, according to the code:
https://github.com/NagiosEnterprises/nagioscore/blob/eb8e83d5d05e572eb8c0d4d4764885c5427b4b69/xdata/xodtemplate.c#L327
/* process all files in a config directory */ else if(!strcmp(var, "xodtemplate_config_dir") || !strcmp(var, "cfg_dir")) {
if(config_base_dir != NULL && val[0] != '/') {
asprintf(&cfgfile, "%s/%s", config_base_dir, val);
} else
cfgfile = strdup(val);
/* strip trailing / if necessary */ if(cfgfile != NULL && cfgfile[strlen(cfgfile) - 1] == '/')
cfgfile[strlen(cfgfile) - 1] = '\x0';
/* process the config directory... */ result = xodtemplate_process_config_dir(cfgfile, options);
my_free(cfgfile);
/* if there was an error processing the config file, break out of loop */ if(result == ERROR)
break; } }
EDIT #2: In the host definition you posted, your register value is set to 0. Try setting it to 1 instead. register 0 is used for templates that will be inherited from, but will not actually show up in the Nagios UI.
Change:
define host {
host_name GIT
alias GIT Server
address 172.25.10.80
register 0
}
To:
define host {
host_name GIT
alias GIT Server
address 172.25.10.80
register 1
}
Also please set register 1 for your service definitions as well.
Try adding executable permissions to your directories. Some programs and languages require +x permissions in order to actually open the directory.
If that doesn't work, temporarily set everything to 0777 permissions to see if the issue is permissions related at all.
You also have config problems even if you get that part working. Your host and service configs don't have a use directive in them, which points to a template that would have most of the default values. The register directive is implied as 1 unless you specifically set it to 0 for a template. See the object definitions docs if you need a reference: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/objectdefinitions.html
What am I missing in the following configuration that my Datanucleus JPA 2 Level 2 cache is not using Google App Engine Memcache service? I am using the GAE 1.7.2 SDK.
In the persistence.xml:
<persistence-unit name="transactions-optional">
<provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider>
<properties>
<property name="datanucleus.NontransactionalRead" value="true"/>
<property name="datanucleus.NontransactionalWrite" value="true"/>
<property name="datanucleus.ConnectionURL" value="appengine"/>
<property name="datanucleus.appengine.datastoreReadConsistency" value="EVENTUAL" />
<property name="javax.persistence.query.timeout" value="5000" />
<property name="datanucleus.datastoreWriteTimeout" value="10000" />
<property name="datanucleus.singletonEMFForName" value="true"/>
<property name="datanucleus.cache.level2.cacheName" value="someName"/>
<property name="datanucleus.cache.level2.type" value="javax.cache"/>
</properties>
</persistence-unit>
Entity annotations contain:
#Entity
#Cacheable(true)
My WEB-INF/lib looks like this:
-rw-r--r-- 1 501 20 27M Oct 3 16:13 appengine-api-1.0-sdk-1.7.2.jar
-rw-r--r-- 1 501 20 3.3M Oct 3 16:13 appengine-api-labs.jar
-rw-r--r-- 1 501 20 5.0M Oct 3 16:13 appengine-endpoints.jar
-rw-r--r-- 1 501 20 6.8K Oct 3 16:13 appengine-jsr107cache-1.7.2.jar
-rw-r--r-- 1 501 20 45K Oct 3 16:13 asm-4.0.jar
-rw-r--r-- 1 501 20 309K Oct 3 16:13 datanucleus-api-jdo-3.1.0-m3.jar
-rw-r--r-- 1 501 20 246K Oct 3 16:13 datanucleus-api-jpa-3.1.0-m3.jar
-rw-r--r-- 1 501 20 331K Oct 3 16:13 datanucleus-appengine-2.1.0-final.jar
-rw-r--r-- 1 501 20 1.6M Oct 3 16:13 datanucleus-core-3.1.0-m5.jar
-rw-r--r-- 1 501 20 112K Oct 3 16:13 geronimo-jpa_2.0_spec-1.0.jar
-rw-r--r-- 1 501 20 5.2M Oct 3 16:13 gwt-servlet.jar
-rw-r--r-- 1 501 20 196K Oct 3 16:13 jdo-api-3.0.1.jar
-rw-r--r-- 1 501 20 7.9K Oct 3 16:13 jsr107cache-1.1.jar
-rw-r--r-- 1 501 20 15K Oct 3 16:13 jta-1.1.jar
In the WEB-INF/lib directory, running:
for i in *.jar; do echo $i; jar -tf $i | grep Level2; done
yields:
appengine-api-1.0-sdk-1.7.2.jar
appengine-api-labs.jar
appengine-endpoints.jar
appengine-jsr107cache-1.7.2.jar
asm-4.0.jar
datanucleus-api-jdo-3.1.0-m3.jar
datanucleus-api-jpa-3.1.0-m3.jar
datanucleus-appengine-2.1.0-final.jar
datanucleus-core-3.1.0-m5.jar
org/datanucleus/cache/WeakLevel2Cache.class
org/datanucleus/cache/Level2Cache$PinnedClass.class
org/datanucleus/cache/AbstractLevel2Cache.class
org/datanucleus/cache/SoftLevel2Cache.class
org/datanucleus/cache/Level2Cache.class
org/datanucleus/cache/NullLevel2Cache.class
org/datanucleus/cache/JavaxCacheLevel2Cache.class
geronimo-jpa_2.0_spec-1.0.jar
gwt-servlet.jar
jdo-api-3.0.1.jar
jsr107cache-1.1.jar
jta-1.1.jar
which shows that org.datanucleus.cache.JavaxCacheLevel2Cache is present in datanucleus-core-3.1.0-m5.jar. Yet, when I try to access entities that have been persisted before this cache was enabled, I get the following error on the server side.
org.datanucleus.exceptions.NucleusUserException: Level 2 Cache "javax.cache" is registered to use class "org.datanucleus.cache.JavaxCacheLevel2Cache" yet this is not found. Please check your CLASSPATH and plugin specification.
Further down the exception stack trace, I find:
Caused by: java.lang.NoClassDefFoundError: javax/cache/Caching
at org.datanucleus.cache.JavaxCacheLevel2Cache.<init>(JavaxCacheLevel2Cache.java:63)
Now, that is clear but where can I find this javax.cache.Caching? Which JAR should I need to include in the classpath? A cursory Google search does not immediately answer my question.
Thanks.
Google "memcached" uses an old version of what will become the standard "javax.cache". DataNucleus 3.0 supports only this old version (with properties as you have). DataNucleus 3.1 supports both the old version of javax.cache and the most recent. To use the old version (i.e GAE memcached) with DN 3.1 you need to set the property datanucleus.cache.level2.type to jcache. See http://www.datanucleus.org/products/accessplatform_3_1/jpa/cache.html#jcache
Why you're using DataNucleus version 3.1.0-m3/m5 I've no idea when there are many releases since then!