In my project, I have a special JSP which displays the exception stacktrace in case of Exceptions.
Is there a way to use an URL handler or something else which would have Eclipse open a file? Maybe with xdg-open?
I use Eclipse 4.3 on Kubuntu Linux.
I've ended up with this solution:
Edit xdebug.ini (it should be somewhere like /etc/php/7.0/mods-available/xdebug.ini), add:
xdebug.file_link_format="xdebug://%f(%l)"
Restart your server or php-fpm. For Apache on Ubuntu use sudo service apache2 restart.
Create eclipse-launch.sh. It is intended to parse URL and pass a file to Eclipse. You can name it as you want and put it anywhere you want, I've placed it in the eclise directory. Be sure to replace /home/user with your actual home directory and path="..." with actual eclipse path:
#! /bin/bash
arg=$1
path="/home/user/eclipse/eclipse-neon/"
# file name directly followed by a line number in parenthesis
regex="//([^(]*)\(([0-9]+)\)"
if [[ $arg =~ $regex ]]
then
file=${BASH_REMATCH[1]}
line=${BASH_REMATCH[2]}
$path/eclipse --launcher.openFile "$file"+"$line"
else
msg="Unsupported URL: $arg"
zenity --info --text="$msg"
# alternatives:
# notify-send "$msg" # another notification program
# $path/eclipse # just run eclipse
fi
Read more about Eclipse command line options here: http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/product_open_file.htm
Give the file executable permissions: chmod +a eclipse-launch.sh
Create xdebug.desktop at ~/.local/share/applications/. It will be used by xdg-open (Chrome uses xdg-open by default).
[Desktop Entry]
Comment=
Exec=/home/user/eclipse/eclipse-neon/eclipse-launch.sh "%u"
Icon=/home/user/eclipse/eclipse-neon/eclipse/icon.xpm
Name=Eclipse xdebug Launch
NoDisplay=false
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
MimeType=x-scheme-handler/xdebug;
Run xdg-mime default xdebug.desktop x-scheme-handler/xdebug. This should add an entry to ~.local/share/applications/mimeapps.list to [Default Applications] section. The entry itself should look like x-scheme-handler/xdebug=xdebug.desktop
For Firefox follow instructions from here: https://xdebug.org/docs/all_settings#file_link_format
Open about:config
Add a new boolean setting network.protocol-handler.expose.xdebug and set it to false
The first time you click on xdebug:/// link Firefox will prompt you to select an application to run, point to the created eclipse-launch.sh file.
Related
I am trying to use a tool that, in two steps, analyzes code smells for android.
In the first step, the tool parses an apk and generates within a directory .db files that should then be converted to CSV files in the next step; however, whenever I try to run the second step, the console returns the following error:
java.io.IOException: Unable to create directory path [/User/Desktop/db2/logs] for Neo4j store.
I think it is a Neo4J configuration problem.
I am currently running the tool with the following Java configuration:
echo $JAVA_HOME
/home/User/openlogic-openjdk-11.0.15
update-alternatives --config java
* 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
To be safe, I also started Neo4J, which returned the following output
sudo systemctl status neo4j.service
neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-07-06 20:11:04 CEST; 16min ago
Main PID: 1040 (java)
Tasks: 57 (limit: 18901)
Memory: 705.4M
CPU: 16.639s
CGroup: /system.slice/neo4j.service
└─1040 /usr/bin/java -cp "/var/lib/neo4j/plugins:/etc/neo4j:/usr/share/neo4j/lib/*:/var/lib/neo4j/plugins/*" -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch -XX:+UnlockExper>.
How can I solve this?
You posted this error:
java.io.IOException: Unable to create directory path [/User/Desktop/db2/logs] for Neo4j store.
From that error, it looks like:
Neo4j was installed at "/User/Desktop/db2"
The permissions for that directory do not have "write" permission
I tried to reproduce this locally using Neo4j Community 4.4.5, following the steps below.
I do see an IOException related to "logs", but it's slightly different from what you posted. Perhaps we're on different versions of Neo4j.
Open terminal into install directory: cd neo4j
Verify "neo4j" is stopped: ./bin/neo4j stop
Rename existing "logs" directory: mv logs logs.save
Remove write permission for the Neo4j install: chmod u-w .
Start neo4j in console mode: ./bin/neo4j console
Observe errors in console output
2022-07-08 03:28:38.081+0000 INFO Starting...
ERROR StatusLogger Unable to create file [****************************]/neo4j/logs/debug.log
java.io.IOException: Could not create directory [****************************]/neo4j/logs
...
To fix things, try:
Get a terminal into your Neo4j directory:
cd /User/Desktop/db2
Set write permissions for the entire directory tree:
chmod u+w -R .
Start neo4j in console mode:
./bin/neo4j console
If this works and you're able to run neo4j fine, it points to an issue with user permissions when running neo4j as a system service.
The best steps from there depend on the system, your access, how comfortable you are making changes, probably other things. An easy, brute-force hammer would be to manually create each directory you discover (such as "/User/Desktop/db2/logs") and grant premissions to all users (chmod ugo+w .), then try re-running the service, see what errors pop up. Repeat that until you're able to run the service without errors.
I am using a War file to deploy my application in Xampp. The thing is that since I update the code multiple times I need to replace the war file and restart the Apache, tomcat services. I thought of using a batch file for this to save time.
I'm doing the following 3 steps to deploy a war file.
1) Stop Apache & Tomcat services.
2) Delete existing war file and it's corresponding folder.
3) Start Apache & Tomcat services.
Batch Script..
echo "+++Deploy source in $PWD+++"
echo "+++ Shutting down tomcat ..."
call apache_stop.bat
call catalina_stop.bat
timeout 5 > NUL
echo "+++ Installing new war ..."
DEL "C:\xampp\tomcat\webappss\flsv2*"
xcopy /s C:\Users\Hp\git\flsv2-lucy\build/flsv2.war C:\xampp\tomcat\webapps
echo "+++ Starting up tomcat ..."
call apache_start.bat
call catalina_start.bat
timeout 5 > NUL
Unfortunately the above code is not working. Whenever I run the above script from the xampp folder I'm getting an error message in cmd prompt..
Error Message...
C:\xampp>deploy_local.bat
C:\xampp>echo "+++Deploy source in $PWD+++"
"+++Deploy source in $PWD+++"
C:\xampp>echo "+++ Shutting down tomcat ..."
"+++ Shutting down tomcat ..."
C:\xampp>call apache_stop.bat
pv: No matching processes found
Mysql shutdowm ...
pv: No matching processes found
"+++ Starting up tomcat ..."
C:\xampp>
Where am I going wrong??
There are a few things that strike my eye:
$PWD is linuxstyle. Use %cd% in Windows batch files for the same thing.
Maybe you want to add #echo off as first line in your script to prevent the double echo-ing of each line to console.
The error message "pv: No matching processes found" comes from apache_stop.bat. You need to trace/debug that script for further details. (You might want to add a #echo on in the first line to get every output).
Your output shows no sign of the deleting operations ("Installing new war"), I wonder why but suspect the errors popping up from apache_stop.bat. However, the output from the "Starting up tomcat" is there. Is the delete part working as expected? Do files get deleted?
Hint: If you use del with wildcards (*) you can/need to specify the /Q switch to prevent the confirmation prompt. See del /? on the command line for details.
Also on del, you might want to use *.* to get "any filename followed by any extension". Currently with the single asterisk the del command is looking for filenames "beginning with flsv2 with no extension". The asterisk wildcard is handled differently by Unix/Linux and Windows.
Recommendation: The xcopy command should have the paths quoted (mandatory if your paths contain spaces).
I have a problem with HSQLDB V2.3 on Windows. I can't connect with new databases using the HSQLDB Server.
Is there a log or debug option for the server so I can check the properties loaded and file paths, etc?
Is my properties file OK? I wasn't sure how to formulate file paths for windows.
Can I use quotes on file path names?
Is the connection string I'm using for the tmp db correct?
What's the correct syntax to use the --props server argument?
--props path
--props path/filename
I have set-up two environment variables (too keep it simple*). These variables don't have any effect except to save my typing. Initially I was loading the server from the HSQLDB folder directly.
HSQLDB_HOME ... home folder for the current HSQLDB
HSQLDB_DATA ... folder for data repository
I am following the the steps from:
Running and Using HSQLDB
Every time I connect via the server it makes a database called, "test" instead of letting me connect to either of the two databases specified in the server.properties.
%HSQLDB_DATA%/
test.log
test.properties
test.script
test.tmp/ .......... (folder)
test.lck
I made a 'server.properties' file in:
%HSQLDB_HOME%/lib/
where the HSQLDB JAR file is. I want two databases: tmp and dev:
# -- tmp
server.database.0=file:hsqldb/tmp_db/tmp
server.dbname.0=tmp_db
#
####
#
# -- dev
server.database.1=file:r:/.data/hsqldb/dev_db/dev
server.dbname.1=dev_db
I expected that the properties file to be enough to set-up two databases. When I run the hsqldb manager I don't get a connection for tmp say:
"jdbc:hsqldb:hsql://localhost/tmp"
user: SA, password: ""
I get a pop-up error:
database alias does not exist (Manager)
[Thread[HSQLDB Connection #26827674,5,HSQLDB Connections #372f7a8d]]: database alias=tmp does not exist (Server)
I created these two manually using the cmd-line, e.g. named "tmp":
%JAVA_HOME%\bin\java.exe -classpath %HSQLDB_HOME%\lib\hsqldb.jar org.hsqldb.server.Server org.hsqldb.server.Server --database.1 file:r:/.data/hsqldb/tmp_db --dbname.1 tmp_db
And could connect and create tmp:
%HSQLDB_DATA%/tmp_db/
tmp.log
tmp.properties
tmp.script
tmp.tmp/ .......... (folder)
tmp.lck
as forecast in the documentation. When I start-up the HSQLDB Server with the aforesaid 'server.properties' file or specifying properties explicitly:
%JAVA_HOME%\bin\java.exe -classpath %HSQLDB_HOME%\lib\hsqldb.jar org.hsqldb.server.Server --trace true --props %HSQLDB_DATA%
The server will only let me connect with a database called "test" as described at the beginning of the question.
Because the properties file looks good and the in-process file connection string works,
jdbc:hsqldb:hsqldb/tmp_db/tmp
I am left considering that the server.properties file is in the wrong place or not loading for some reason. It would be wonderful if there's a way for the server to dump the properties file at start-time :-) Thanks in advance for your suggestions ...
I have found the problem. Firstly, thanks to this tutorial:
HSQLDB Installation
After reviewing this I realised my error.
The server.properties file must be in the current folder when the server script runs. I had read that on the Running and Using HSQLDB manual page but misinterpreted its meaning and I put the properties file in my %HSQLDB_HOME%/lib folder. Oops.
When you look at the BAT script, it actually changed the current folder to be the %HSQLDB_HOME%/data folder ...
cd ..\data
So the default location for your server.properties file should be your: %HSQLDB_HOME%/data if you want to work with the default runServer.bat script.
For those wanting to separate data from the server software. I made an improvement for the default script using the two environment variables as follows.
HSQLDB_HOME ... home folder for the current HSQLDB
HSQLDB_DATA ... folder for data repository
runServer.bat:
#cd /d %HSQLDB_DATA%
#cd
#echo.
#rem __ #pause
%JAVA_HOME%\bin\java -classpath %HSQLDB_HOME%\lib\hsqldb.jar org.hsqldb.server.Server %1 %2 %3 %4 %5 %6 %7 %8 %9
#echo.
#pause
Which now expects my server.properties file in the %HSQL_DATA% folder. And that works. Also for my server since it is for development /testing, I'm using the --trace=true option. Like a lot of these things, now I get-it, it all makes perfect sense. Hopefully my misunderstanding will assist others who haven't found a simple tutorial before resorting to stackoverflow.
I'm trying to run Jetty on CentOS and am having problems as I am getting unexpected results when I try to set the full path for JETTY_LOGS. The system tries to take that path and append it to the path I specified in the JETTY_HOME variable.
JETTY_HOME=/usr/local/jetty/jetty-9.1.4
JETTY_USER=jetty
JETTY_PORT=8085
JETTY_HOST=0.0.0.0
JETTY_LOGS=/usr/local/jetty/jetty-9.1.4/logs
Any ideas as to what I'm doing wrong?
The error I get is:
Starting Jetty: java.io.IOException: Cannot write start.log to directory
/usr/local/jetty/jetty-9.1.4/usr/local/jetty/jetty-9.1.4/logs [directory doesn't exist or is read-only]
java.io.IOException: Cannot write start.log to directory /usr/local/jetty/jetty-9.1.4/usr/local/jetty/jetty-9.1.4/logs [directory doesn't exist or is read-only]
at org.eclipse.jetty.start.StartLog.initLogFile(StartLog.java:127)
at org.eclipse.jetty.start.StartLog.initialize(StartLog.java:113)
at org.eclipse.jetty.start.Main.processCommandLine(Main.java:520)
at org.eclipse.jetty.start.Main.main(Main.java:102)
It seems that JETTY_LOG directory is relative to JETTY_HOME.
Could you try to set:
JETTY_LOGS=/logs
or alternatively
JETTY_HOME=/usr/local/jetty/jetty-9.1.4/
JETTY_LOGS=logs
You're not doing anything wrong, this is new behavior in jetty 9.1.4:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=432192
Workaround is to set the JETTY_LOGS env var relative to your jetty base dir (like the logs dir that comes in the standard jetty tarball):
JETTY_LOGS=logs
Which will resolve to /usr/local/jetty/jetty-9.1.4/logs in your case (the jetty base dir defaults to the jetty home dir).
If you want the logs written somewhere outside of your jetty base dir, the best way is to use the above JETTY_LOGS=logs env setting, and just symlink the dir elsewhere; like this to create and link to the common /var/log/jetty dir:
# mv /usr/local/jetty/jetty-9.1.4/logs /var/log/jetty
# ln -s /var/log/jetty /usr/local/jetty/jetty-9.1.4/logs
Whatever you do, also make sure that the user as which you run jetty has write access to the logs dir; if you use the jetty user in the jetty group, make it the owner of your logs dir:
# chown -R jetty:jetty /var/log/jetty
I want to install the tool of CodeCollaborator to manager the code in my development,but there has a install error i cannot handle it.
I trusted that the CodeCollaborator client was installed successful.
When i click the button of add in the CodeCollaborate Client,and then Add CSM Configration successful.
When chose the SCM Cofigration to Add Changes,it always show error as below:
Error initializing changed files
Reason:svn:E155036:please see the 'svn upgarade' command
svn:E155036:Working copy 'E:\woekplace\chunya' is too old(formate 10,create by Subversion 1.6)
I think the error is result by the version between Slik-Subversion-1.7.8-x64 and Subersion in my eclipse, but no matter how i to upgrade the version each other, the error has unswerving exist.How to solve this problem?
Typing svn help upgrade at a Windows command prompt (or svn --help upgrade in a Linux terminal) shows this:
upgrade: Upgrade the metadata storage format for a working copy.
usage: upgrade [WCPATH...]
Local modifications are preserved.
Valid options:
-q [--quiet] : print nothing, or only summary information
Global options:
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--no-auth-cache : do not cache authentication tokens
--non-interactive : do no interactive prompting
--trust-server-cert : accept SSL server certificates from unknown
certificate authorities without prompting (but only
with '--non-interactive')
--config-dir ARG : read user configuration files from directory ARG
--config-option ARG : set user configuration option in the format:
FILE:SECTION:OPTION=[VALUE]
For example:
servers:global:http-library=serf
So it's telling you you need to upgrade your local working copy's metadata, not upgrade SVN itself. You do that also from a command prompt or terminal window, using the syntax shown by the usage example above.