trouble creating an axis 2 .aar file: xml/services not found error - linux

I am trying to create an aar file using OSX 10.7.5 (as a part of this tutorial). To generate the .aar, I navigate to the directory holding my webservice in my eclipse workspace and type
jar cvf FirstWebService.aar ./*
This is the command that Apache says to use to generate the aar in their Code Listing 9 from the apache axis 2 documentation.
The command creates an.aar -- but something is wrong with the process that I am using to create the .aar because when I go to load the .aar file into tomcat's /webapps I get an .xml/services not found error.
I am not sure what to do to fix this error. If I search my computer's file system for the services.xml file, I can find it in /path to eclipse workspace/workspace/MyFirstWebService/WebContent/WEB-INF/services/FirstWebService/META-INF
but I am not sure if this file is supposed to be rolled in to the .aar file somehow or if I can just manually plunk this file somewhere into the apache directory structure to get the thing to run.
Note: I do not think I am manually unzipping or unpacking the aar like in this question. Axis2 web service error: services.xml not found I am just running the command listed above from the apache documentation.
Here is the .aar file
note I am using all of the same versions of the software as in the tutorial -- but I am using OSX 10.7.5 where they use windows in the tutorial. Accordingly, I have changed the make-aar command for windows shown in the tutorial (jar cvf FirstWebService.aar com META-INF) into the one shown above. If I just try to run the command from the tutorial jar cvf FirstWebService.aar com META-INF I get the same xml/services not found error. It gives this output in the terminal...
com: no such file or directory
META-INF: no such file or directory
added manifest

I found the issue. When you type the command to create the aar file you have to be in the directory .../EclipseWorkspace/EclipseProjectName/WebContent/WEB-INF/services. This directory contains /META-INF/services.xml. The process that makes the .aar file must be looking in this folder.

Related

How to set RubyMine's default working directory to the executing .rb program's subdirectory?

In RubyMine, I have a project with many subfolders, each of which contains:
One or more standalone single-file executable Ruby programs (.rb files);
An input text file.
In older versions of RubyMine, when running one of the standalone executable programs (via Cmd+Shift+R on my Mac), the default folder in which RubyMine would look for the input file would be the same directory as the .rb file currently being executed -- which worked great.
The code used to read the file is something like:
data = File.readlines('input.txt')
However, after recently updating RubyMine to v2022.3.1, the behavior has changed, such that RubyMines now seems to be looking in the project's root directory for the file, instead of the same subdirectory as the .rb file currently being run. This produces the error:
in `readlines': No such file or directory # rb_sysopen - input.txt (Errno::ENOENT)
To correct this, I've been going into Run (menu) > Edit Configurations; and in the Edit Configurations dialog, in the configuration that RubyMine auto-created for the current executable file, changing the Working Directory value from the default of the project's root directory, to the subfolder of the current .rb file.
However, this above workaround is annoying, since I need to do it once each for every individual one of the many individual .rb executable files in my project.
My question: How can I configure my project and/or RubyMine itself to go back to the older behavior of defaulting a given .rb file to use its own directory as the default Working Directory, instead of the project's root directory?
(This question and/or its solution might also apply to other JetBrains IDEs such as IntelliJ, since they all seem to work similarly.)
The previous behaviour has been changed with https://youtrack.jetbrains.com/issue/RUBY-29236. So now yes, the logic is the following:
in case of no Ruby module, project's root will be used
in case of Rails, its home folder
otherwise the module's root
There is no option to change it in RubyMine but you can configure the configuration template using some variable there as Working directory.

Java war file wrongly (?) detected as an invalid zip file

To do a test, I have to add a jar file into a Java war file I've created with Maven. The war file works itself fine.
To insert my lz4-java-1.6.0.jar into application-metier-et-gestion.war on internal zip folder /WEB-INF/lib, I use this command :
zip -b WEB-INF/lib application-metier-et-gestion.war lz4-java-1.6.0.jar
But I receive that error message :
zip warning: expected 354 entries but found 84
zip error: Zip file structure invalid (application-metier-et-gestion.war)
I can do and redo mvn clean install it will always create a runnable war that seems perfect to me, but that zip declares invalid. Who is wrong ?
I case zip would be going wrong, what is the workaround to do what I want ? Is there a way through another tool ? tar ?
I case Maven would be going wrong and create a bad war file each time, how to detect the part it is creating wrongly ?
right click the war file ,rename the file extension war into zip
example :
test.war -> test.zip
As far as I can see you tried to add an additional library to the archive.
JAR files and WAR files are plain ZIP files. There is only one rule you have to obey, library files must not be compressed.
If you want to add JAR files to a JAR or WAR file, disable compression for the specific file to be added.

Building SQLite DLL with VS2015

I'm trying to build SQLite as a DLL from sources. In the the "How to" section of the website, they give a simple command line to build it :
cl sqlite3.c -link -dll -out:sqlite3.dll
When I try this command, I get the DLL but not the ".lib" file. With the DLL only I cannot use SQLite inside another dev project. Without the .lib file, there are some symbols missing.
here are some notes i made a while ago on creating a sqlite3.lib file using the contents of sqlitedll-X_X_X.zip (and some other files). This approach might differ from your intended approach - but it may get your project started - I hope it helps.
create \tmp folder in your project directory
find the following 3 files (on the web) and then copy them into the \tmp directory: lib.exe, link.exe, mspdb80.dll
from the latest sqlitedll-X_X_X.zip file (i used: http://www.sqlite.org/sqlitedll-3_7_3.zip) copy sqlite3.def and sqlite3.dll to \tmp directory
open command line (terminal) and navigate to \tmp directory
create .LIB file by typing:
LIB /DEF:sqlite3.def /MACHINE:X86
copy the newly created sqlite3.lib file to your project directory
make sure that the following files are in the project directory:
sqlite3.h (from: http://www.sqlite.org/sqlite-amalgamation-X_X_X.zip)
sqlite3.dll (from: http://www.sqlite.org/sqlitedll-X_X_X.zip)
also
add the sqlite3.h file to the project
make sure that the linker can see sqlite3.lib
For those trying to do this with CMake, and assuming that you are building from amalgamation sources, to produce the .lib file when building a shared variant on Windows you need to add a compile definition SQLITE_API=__declspec(dllexport), for example:
project("SQLite3"
VERSION 3.39.1
DESCRIPTION "Small, fast, self-contained, high-reliability, full-featured SQL database engine"
LANGUAGES C
)
# ...
add_library(${PROJECT_NAME})
# ...
if(BUILD_SHARED_LIBS)
if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE
"SQLITE_API=__declspec(dllexport)"
)
else() # haven't tested that
target_compile_definitions(${PROJECT_NAME}
PRIVATE
"SQLITE_API=__attribute__((visibility(\"default\")))"
)
endif()
endif()
# ...

Installing Emacs Emulation keybindings -- Invalid VSIX package

I'm trying to install the extension for Visual Studio 2012 that allows emacs key-bindings.
I'm following through the steps here:
Emacs Keybindings in Visual Studio 2012 or 2013
I'm up to step 5:
Run the vsik file as administrator. This is required so the extension
can write Emacs.vsk into the program files folder. I wasn't sure the
best way to do this so I ran a command prompt as admin and then
executed start emacsemulations.vsik from the prompt.
So, running emacsemulations.vsix from an administrator command prompt,
I get the following error "This VSIX package is invalid because it does not contain the file extension.vsixmanifest at the root."
I'm not changing any of the file names inside the package.
I'm thinking this may have something to do with how windows zips up the file -- I'm able to recreate the problem simply by unzipping and rezipping the EmacsEmulation.vsix file without changing the contents of the vsix package.
If anyone has any suggestions on how to fix, or even better, the actual updated vsix file itself, I'd be very grateful!
The issue you have relies on the way you are zipping your file, what you should do is zip all files inside the folder you created (in this case, "EmacsEmulations") when you unzipped it.
Step into the EmacsEmulations folder.
Select all files.
Add to .zip
Rename the .zip output to EmacsEmulations.vsix
I'm trying to get this extension to work too, so good luck!

Running .jar File on Linux

I have a .jar file that reads two files from within its current folder and produces as output a .txt file and a separate folder with multiple other .txt files. This works perfectly in Windows using this code to create the directory:
static String dir = System.getProperty("user.dir");
I used the instructions here: https://askubuntu.com/questions/192914/how-run-a-jar-file-with-a-double-click to set up my .jar file to run on a simple double-click, but as of right now, it does nothing when double-clicked. My guess is that the above line of code does not translate well to Linux. Anybody know how to resolve this?
First, try running it on the command-line, with
java -jar <file.jar>
The user.dir property is cross-platform (see here) so it should not be the problem. However, are you using correct file separators? Remember it's '/' on UNIX and '\' on Windows.
Try java -jar Jarname.jar and pass other files as arguments after this command
The code line you gave works fine on linux.
My best guess is that you're then trying to use this directory path by adding a windows-specific path separator (like path + "\subdir") which isn't appropriate for linux (you should build a new File object instead).
Either that, or your jar file isn't being executed at all. Have you tried doing something very simple in your jar file to see if anything is being run? Have you tried running your jar with java -jar myapp.jar to see if any exceptions are thrown or error messages displayed?
You will need to manually tweak your build process to get the jar file marked as executable. In your build xml file, there is a target, "-post-jar", that is called after the jar is built. You'll need to make that target and use Ant's chmod task to modify your jar. Once you do that it will occur every time you make a jar file in that project.
It will run fine as long as you have a JRE installed.
Read this article to know more.

Resources