Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Friday, October 09, 2009

Debian+Apache+Tomcat+Axis

Hello,
one of the courses I'm following at the university is "Laboratorio di reti
di calcolatori" which uses the technologies (really technologies?????)
listed in the post title. This is a little tutorial for making them works,
with a little script for registering .wsdd files.

- aptitude install apache2 tomcat6
- download the binaries of axis 1.x (latest is 2.x, it's not used in our course) and xerces then unpack them.
- copy *.jar of xerces into the "lib" dir of axis.
- create "/etc/tomcat6/policy.d/99axis.policy" with:
grant codeBase "file:/var/lib/tomcat6/webapps/-" {
permission java.security.AllPermission;
};

- copy the "axis" directory found under webapps of the axis binaries into /var/lib/tomcat6/webapps
- invoke-rc.d apache2 restart
- invoke-rc.d tomcat6 restart

Now go to http://localhost:8080 to make sure that Apache-Axis works.

Finally, this is the script for deploying web services (call it deploy.sh):
export AXIS_HOME="/home/lethal/ingegneria/reti/axis/axis-1_4"
export AXIS_LIB="$AXIS_HOME/lib"
export AXISCLASSPATH="$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery-0.2.jar:$AXIS_LIB/commons-logging-1.0.4.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar:$AXIS_LIB/xercesImpl.jar"
java -cp "$AXISCLASSPATH" org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService "$1"

In the script, you must tweak the AXIS_HOME variable to point to the unpacked axis binaries: avoid using spaces in this variable or you'll encounter several errors in terms of classpath.
Usage of the script:
sh deploy.sh file.wsdd

We're done!

Friday, February 27, 2009

Awesome/other wrong keyboard layout

Hello,
due to the high resource usage by Eclipse (I have to use that unfortunately because of my professor) I've temporarly dropped GNOME and now I'm using Awesome for a while.

Ok let's say the problem: the keyboard. Do you have different languages, layouts and so on among several configurations (GNOME, X, ...) and your keyboard layout is messed up with awesome?
Just do it:

setxkbmap -layout YOURLAYOUT


Where YOURLAYOUT for me is it.

I've found this utility in this mailing thread. Yet you can read that awesome is still too young and lacks some keyboard configuration features.

Have fun!

Tuesday, February 24, 2009

JMF and MPEG

Hello,
I'm recently writing a game with Java AWT/Swing/SwingX/JMF for a university exam.
If you are using the Java Media Framework and most of the formats (all the well known and used formats) can't be handled by the library here's your definitive solution to the problem.
You will usually get "Unable to handle format: MPEG" or something like that.

How do you get rid of that and make things work? There's a great plugin named jffmpeg which handles a huge number of audio and video formats (including ogg/vob).
Just follow the instructions on the project website to install the plugins.

Alternatively you can register only the codec and demux you use from within your application code as follows (e.g. only handle MPEG video format on input):

Format[] inFormats = { new VideoFormat ("MPEG") };

PlugInManager.addPlugIn ("net.sourceforge.jffmpeg.VideoDecoder", inFormats, null, PlugInManager.CODEC);

PlugInManager.commit ();