quote

martedì, febbraio 22, 2011

Jboss - Port already in use: 1098

I got this exception after started jboss 5.1 on windows XP.


ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main)
Error installing to Start: name=jboss:service=Naming
state=Create mode=Manual requiredState=Installed
java.rmi.server.ExportException: Port already in use: 1098;
nested exception is:
java.net.BindException: Address already in use: JVM_Bind


I tried to understand which process was using that port by running this command:

$> netstat -a -o -n

But the result didn't show any port associated to 1098.
Finally I edited the file at <jboss_51_home>\server\default\conf\bindingservice.beans\META-INF\bindings-jboss-beans.xml
and changed the value of the port 1098 to 10980 and the error has disappeared.
Windows and Jboss ...such a nightmare.
Here the link where I found the solution.

Nice java client to execute remote ssh

http://www.journaldev.com/246/java-program-to-run-shell-commands-on-ssh-enabled-system
Just add this dependency at your pom.xml

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>

lunedì, febbraio 21, 2011

Stop jboss in the case it's running

If you need to stop jboss inside a shell script this block of code could be useful.

if ps -ef | grep "<jboss_home>/bin/run.jar" | grep -v grep
then
echo [deploy] Stopping Jboss...
<jboss_home>/bin/shutdown.sh -S --server=localhost:1199
sleep 12s
else
echo [deploy] Jboss was already stopped
sleep 2s
fi

venerdì, febbraio 18, 2011

java.net.MalformedURLException: no protocol: and

I was trying to configure maven cargo plugin when I came across this exception:

Caused by: java.net.MalformedURLException: no protocol: and

I spent several hours trying to find the meaning of this error message when finally I found this link:


http://jackrabbit.510166.n4.nabble.com/jcr-rmi-problems-td534137.html


The author says:

The "and"
comes from the folder where your classes are which is probably something
beneath "C:\Documents and Settings"

So found the root of the problem, the maven local repository in windows is located at the path:
C:\Documents and Settings\<user>\.m2

So I have overridden the local maven repository folder adding this entry in the settings.xml maven configuration file:

<localRepository>c:/mavenrepository</localRepository>


After this change the error has disappeared.

giovedì, febbraio 10, 2011

Accesing to windows file system from cygwin


$ cd /cygdrive/c

That's pretty easy, but I always forget it...

martedì, febbraio 08, 2011

Spring - Referring to a String as a bean


<bean id="myString" class="java.lang.String">
<constructor-arg type="java.lang.String" value="Lucio"/>
</bean>

<bean id="myUser" class="com.benfante.User">
<property name="firstName" ref="myString"/>

</bean>

Thanks to Lucio for the example

lunedì, febbraio 07, 2011

svn client issue

After connecting to svn server using different users I got this message:

svn: Server sent unexpected return value (501 Method Not Implemented) in response to MKCOL request for

I have sorted out it deleting this folder on windows:

C:\Documents and Settings\myUser\Application Data\Subversion\auth