Exception thrown when restoring full site AIP backup in DSpace - backup

I'm attempting to migrate a full DSpace installation (4.x) to a new 6.1. I'm performing
[dspace]/bin/dspace packager -d -a -t AIP -e repo#institution.edu -i OURHANDLE/0 sitewide-aip.zip
to export the entire site, without any special issues. The output are many .zip files including the sitewide-aip.zip.
The problem is when trying to restore in the new DSpace installation. After performing
[dspace]/bin/dspace packager -r -a -f -t AIP -e repo#institution.edu -i OURHANDLE/0 -o skipIfParentMissing=true /path/to/sitewide-aip.zip
an exception is thrown
Exception: Bad identifier/handle -- Cannot resolve handle "OURHANDLE/0"
java.lang.IllegalArgumentException: Bad identifier/handle -- Cannot resolve handle "OURHANDLE/0"
at org.dspace.app.packager.Packager.main(Packager.java:342)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229)
at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)
Can't figure out why this is happening, since HANDLE/0 is suppossed to refer to base handle of the whole installation according to what I've researched so far.

What is your handle prefix? It can be found in your dspace.cfg file.
https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace/config/dspace.cfg#L249
You should use that value for the command.
You should also be able to find it in your database using the following query
select * from handle where handle like '%/0';

The problem ended up being the handle value in target installation. After executing
dspace/bin/dspace update-handle-prefix 123456789 OURHANDLE
to target installation, restoration process could be completed flawlessly.
Thanks to everyone for your help.

Related

scp fails with "protocol error: filename does not match request"

I have a script that uses SCP to pull a file from a remote Linux host on AWS. After running the same code nightly for about 6 months without issue, it started failing today with protocol error: filename does not match request. I reproduced the issue on some simpler filenames below:
$ scp -i $IDENT $HOST_AND_DIR/"foobar" .
# the file is copied successfully
$ scp -i $IDENT $HOST_AND_DIR/"'foobar'" .
protocol error: filename does not match request
# used to work, i swear...
$ scp -i $IDENT $HOST_AND_DIR/"'foobarbaz'" .
scp: /home/user_redacted/foobarbaz: No such file or directory
# less surprising...
The reason for my single quotes was that I was grabbing a file with spaces in the name originally. To deal with the spaces, I had done $HOST_AND_DIR/"'foo bar'" for many months, but starting today, it would only accept $HOST_AND_DIR/"foo\ bar". So, my issue is fixed, but I'm still curious about what's going on.
I Googled the error message, but I don't see any real mentions of it, which surprises me.
Both hosts involved have OpenSSL 1.0.2g in the output of ssh -v localhost, and bash --version says GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Any ideas?
I ended up having a look through the source code and found the commit where this error is thrown:
GitHub Commit
remote->local directory copies satisfy the wildcard specified by the
user.
This checking provides some protection against a malicious server
sending unexpected filenames, but it comes at a risk of rejecting
wanted files due to differences between client and server wildcard
expansion rules.
For this reason, this also adds a new -T flag to disable the check.
They have added a new flag -T that will ignore this new check they've added so it is backwards compatible. However, I suppose we should look and find out why the filenames we're using are flagged as restricted.
In my case, I had [] characters in the filename that needed to be escaped using one of the options listed here. for example:
scp USERNAME#IP_ADDR:"/tmp/foo\[bar\].txt" /tmp

Running JHipster Gradle task from Intellij IDEA

This error happens when I run with Gradle through from Intellij IDEA.. but from console everything works fine... someone knows why?
Executing external task 'run --stacktrace'... :compileJava UP-TO-DATE
:compileScala UP-TO-DATE :bower FAILED
org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':bower'.
Caused by: java.io.IOException: Cannot run program "bower" (in
directory "/Users/eduardo/Development/projects/jhipster"): error=2, No
such file or directory
I contacted JetBrains support about this. The one thing they suggested was running IntelliJ from the command line, which is working for me:
open -a "/Applications/IntelliJ IDEA 15.app"
At a guess, you are running IntelliJ on OSX, maybe with a brew install of bower?
Recent versions of OSX (at least 10.10.1) don't let you easily set the PATH for graphical applications (launchctl seems to have a bug in regards to PATH). Combined with there being no way to modify the current environment PATH for launching subprocesses in Java, this results in being unable to find the bower executable. A Complete rundown of the root problem can be seen here (Setting the environment for ProcessBuilder), but essentially IntelliJ must have your PATH set correctly in order for non standard PATHs to be searched.
My solution for now is a complete hack taken from https://apple.stackexchange.com/a/51737 - essentially, create a wrapper script:
create /Application/IntelliJ\ IDEA\ 14.app/Contents/MacOS/idea.sh with contents of:
#!/bin/sh
. ~/.bash_profile
logger "`dirname \"$0\"`/idea"
exec "`dirname \"$0\"`/idea" $#
then chmod +x /Application/IntelliJ\ IDEA\ 14.app/Contents/MacOS/idea.sh
then edit /Application/IntelliJ\ IDEA\ 14.app/Contents/Info.plist and set CFBundleExecutable to idea.sh
lastly, run /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/IntelliJ\ IDEA\ 14.app
It's a hack, but it works... and until Apple fixes launchctl, it's the only solution I've come up with.

Starting Zookeeper Cluster. Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain

(I'm running on CentOS 5.8). I've been following the direction for a Clustered (Multiserver) Zookeeper Set-up, but getting an error when I try to start up my server. When I run the command as described in the documentation:
java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar:conf \ org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg
I get the error:
Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
I have my files location as such and am running from the ~/zookeeper-3.4.6 directory:
~/zookeeper-3.4.6/zookeeper-3.4.6.jar
~/zookeeper-3.4.6/conf/zoo.cfg
~/zookeeper-3.4.6/data/myid
~/zookeeper-3.4.6/lib/log4j-1.2.16.jar
~/zookeeper-3.4.6/bin/zkServer.sh
Does anyone know why this error is happening? I don't quite understand the arguments that are being passed, so it is hard for me to debug the path issue. As a side note, I've tried running ./zookeeper-3.4.6/bin/zkServer.sh start, which did successfully work, but the documentation seems to indicate that command is meant for a single-node instance.
Edit:
I was able to make some progress by modifying the command and taking out the :conf \ part, so now I'm running:
java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar: org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg
I get a new error, but this is progress...
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFacto
ry
at org.apache.zookeeper.server.quorum.QuorumPeerMain.<clinit>(QuorumPeer
Main.java:64)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more
which corresponds to lines 63 and 64 from QuorumPeerMain
public class QuorumPeerMain {
private static final Logger LOG = LoggerFactory.getLogger(QuorumPeerMain.class);
I got the Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain, because I had downloaded the apache-zookeeper-X.X.X.tar.gz file and not the apache-zookeeper-X.X.X.bin.tar.gz file. Downloading, untarring and using the bin.tar file fixed it for me.
You can also build the binaries from the apache-zookeeper-X.X.X.tar.gz file; see the answer of #vincent.
This happens when you download and used apache-zookeeper-X.X.X.tar.gz, you should use apache-zookeeper-X.X.X-bin.tar.gz. this will surely solve this issue
The issue can be solved by untaring apache-zookeeper-3.5.6-bin.tar.gz. Initially, I encountered the same error while untared/installed apache-zookeeper-3.5.6.tar.gz and executed /bin/zkServer.sh start
Please make sure you have downloaded apache-zookeeper-3.5.6-bin.tar.gz
I got the same errors. I solved the error by check the README.md file in apache-zookeeper-[version].tar.gz Just type:
mvn clean install -DskipTests
then start the zookeeper. You will solve the error, too.
You should be able to run zkServer.sh to get a clustered setup. It will use the same conf/zoo.cfg that you are providing manually, which will contain the cluster endpoints.
The best way to check what you are missing from your classpath (and see the proper java command) is to run the zkServer.sh you said worked for you.
When it starts up, check the actual command used like this:
ps -ef | grep zookeeper
I also get this error when try to run Apache Zookeper v3.5.5 on Windows:
Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
As said by #Onnonymous, I finish my problem by downloading the .bin.tar.gz (here) instead of .tar.gz version.
I am using apache-zookeeper-3.8.0-bin.tar.gz (Ubuntu 20.04)
This has all the necessary files to successfully start the zookeeper process.
specifying the other nodes in zoo.cfg file and starting the zookeeper automatically adds other nodes and starts the election process.
digital ocean has a good setup guide here setup zookeeper cluster
here's the zoo.cfg for reference
tickTime=2000
dataDir=/data/zookeeper
clientPort=2181
maxClientCnxns=60
initLimit=10
syncLimit=5
server.1=server1hostname/ip:2888:3888
server.2=server1hostname/ip:2888:3888
server.3=server1hostname/ip:2888:3888

Postfix piping email to php, permissions error

I'm attempting to pipe an email to PHP with my Postfix mail server, using the technique mentioned here and have encountered the following error...
Mar 16 22:52:52 s15438530 postfix/pipe[9259]: AD1632E84C63: to=<php#[myserver].com>, relay=plesk_virtual, delay=0.61, delays=0.59/0/0/0.02, dsn=4.3.0, status=deferred (temporary failure. Command output: /bin/sh: /var/www/vhosts/[myserver].com/httpdocs/clients/emailpipe/email2php.php: Permission denied 4.2.1 Message can not be delivered at this time )
I'd really appreciate if anyone could shed some light on this issue for me. I've tried 777'ing the emailpipe directory, to no avail. Where am I going wrong?
Many thanks.
From the postfix docs...
For security reasons, deliveries to command and file destinations are performed with the rights of the alias database owner. A default userid, default_privs, is used for deliveries to commands/files in root-owned aliases.
So you have two options, either set the default_privs in main.cf to match the ownership of the email2php file.
Alternatively, there should be a way to create an alias database that is owned by the user instead of postfix/nobody. I haven't tried this before though so can't advise.
I have fixed this issue by disabling the SELINUX.
Make sure that you have
#!/usr/bin/php
<?php
(or whatever your path to php is - do "which php" on the server)
at the top of each of your php scripts and that each of the php script files is executable
chmod +x /var/.../email2php.php
Also, make sure that you can test the script from the command line:
cat some_rfc822_email.txt | /var/.../email2php.php
and get the result that you want
To fix this issue, you'll want to chown or chmod /var/www/vhosts/[myserver].com/httpdocs/clients/emailpipe/email2php.php to executable by your postfix user. Alternately, you'll want to redefine this user to execute the file successfully.
Simply changing the permissions of your directory (unless you used -R) won't be sufficient.
To illustrate why this works, consider the following toy example:
<me>#harley:~$ touch test
<me>#harley:~$ ls -al test
-rw-r--r-- 1 <me> <me> 0 2012-03-26 23:44 test
<me>#harley:~$ sh test
<me>#harley:~$
<me>#harley:~$ ./test
bash: ./test: Permission denied
<me>#harley:~$ chmod 755 test
<me>#harley:~$ ./test
<me>#harley:~$
In order to execute a file directly through the running shell, it needs to be set as executable. Other invocations (for example, sh email2php.php or php email2php.php) only require read access, because they're chaining execution off a different file entirely.
For what's likely to be causing the issue in the first place, see here.

Couldn't run loadjava on user schema to load dbwsclientws.jar dbwsclientdb102.jar

I am trying to load oracle webservice client jars to my schema. I did set the PATH to inlcude:
/u01/app/oracle/product/10.2.0/db_1/bin
When I try to run loadjava as "loadjava -u myschema/myscehmapwd -r -v -f -genmissing dbwsclientws.jar dbwsclientdb102.jar"
I am getting error:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/aurora/server/tools/loadjava/LoadJavaMain. Does it mean that jvm is not setup on the box? How can I check if the jvm is enabled or not?
I am running it on Oracle 10g in UNIX environment.
Any help with the issue is greatly appreciated.
Look at the classpath in the documentation to ensure that you have all of the files mentioned in the classpath, such as $ORACLE_HOME/javavm/lib/aurora.zip