stoping JBOSS via Ant task - java

Im trying those targets. And all of them throws exception as below.
Any idea what is wrong?
Ant targets:
<target name="serverOFF2">
<sequential>
<java dir="${JBOSS_HOME}/server/default/conf" classname="org.jboss.Shutdown" fork="false">
<arg line="localhost 8080"/>
<classpath>
<pathelement path="${JBOSS_HOME}/bin/shutdown.jar"/>
</classpath>
</java>
</sequential>
</target>
<target name="serverOFF3">
<exec executable="${JBOSS_HOME}/bin/shutdown.bat" spawn="false">
<arg line="-S" />
</exec>
</target>
<target name="serverOFF4">
<exec dir="${JBOSS_HOME}/bin" executable="cmd.exe"
os="Windows 2000,Windows XP">
<arg line="/c shutdown.bat -S"/>
<env key="NOPAUSE" value="true"/>
</exec>
</target>
Exception:
javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: PC45577

Are you starting your JBoss server with the "jboss.bind.address=0.0.0.0" in your startup batch file? If not, then the server will only listen locally and will not be reachable.
So you would start the server up by doing:
run.bat -b192.168.3.100 -Djboss.bind.address=0.0.0.0
EDIT: From my later comment
Also check that your firewall is not blocking the JNDI Port TCP 1099. Try to connect to the port using telnet or netcat:
telnet 192.168.3.100 1099
nc -vv 192.168.3.100 1099

Related

ant jdb return immediately from a task

I'm wanting use ant to run a class and then the debugger (jdb) or the other way round
Whichever way round I do it I need one to return immediately as the other needs to attach...
here's the two tasks I'm working on at the moment... (where debug is the target run)
<target
name="run-debug-target"
depends="compile" >
<java
fork="true"
classname="uk.co.bedroomcoders.ple.desktop.DesktopLauncher"
classpath="bin:libs/gdx-backend-lwjgl.jar:libs/gdx-backend-lwjgl-natives.jar:libs/gdx.jar:libs/gdx-natives.jar" >
<jvmarg line="-agentlib:jdwp=transport=dt_socket,address=localhost:6000,server=y,suspend=y" />
</java>
</target>
<target
name="debug"
depends="run-debug-target"
description="debugs the project compiling if needed" >
<exec spawn="true" executable="jdb">
<arg value="-listen" />
<arg value="localhost:6000"/>
</exec>
</target>
https://ant.apache.org/manual/Tasks/java.html
See the spawn property:
if enabled allows to start a process which will outlive ant.
Requires fork=true, and not compatible with timeout, input, output, error, result attributes.
So..
<java
fork="true"
spawn="true"
classname="uk.co.bedroomcoders.ple.desktop.DesktopLauncher"
classpath="bin:libs/gdx-backend-lwjgl.jar:libs/gdx-backend-lwjgl-natives.jar:libs/gdx.jar:libs/gdx-natives.jar" >
<jvmarg line="-agentlib:jdwp=transport=dt_socket,address=localhost:6000,server=y,suspend=y" />
</java>
In this way, <java> task will start a new java process running the java class and return immediately without waiting for the process to return.

wsdl2java ant proxy configuration

I am trying to set up proxy to convert WSDL to Java. The WSDL resides on a server and can be accessible only via proxy server, but gives me connection time out error.
<target name="wSDLToJava" depends ="init">
<echo message="Genarating WSDLToJava"/>
<echo message="Lib Path : ${cxf.home}" />
<echo message="Generate Code Path : ${cxf.generate.src.dir}" />
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<sysproperty key="http.proxyHost" value="${proxy.host}"/>
<sysproperty key="http.proxyPort" value="${proxy.port}"/>
<sysproperty key="http.proxyUser" value="${proxy.user}"/>
<sysproperty key="http.proxyPassword" value="${proxy.pass}"/>
<arg value="-client"/>
<arg value="-d"/>
<arg value="${cxf.generate.src.dir}"/>
<arg value="https://<hostname>/soap/utf/1/wsdl/utf_12.wsdl"/>
<classpath>
<path refid="classpath" />
</classpath>
</java>
</target>
[java] WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : https://<hostname>/soap/utf/1/wsdl/utf_12.wsdl
[java] Caused by : WSDLException: faultCode=PARSER_ERROR: Problem parsing 'https://<hostname>/soap/utf/1/wsdl/utf_12.wsdl'.: java.net.ConnectException: Connection timed out: connect
How about "https" sysproperty settings instead of "http" ?

Using <java> tag in Apach Ant, can I run both Server and the ProxyServer class

I would like to start Server and the ProxyServer class simultaneously, using Ant tag, is it possible to run the wo classes?
Here is the code I tried but Ant only starts the Server class and does not do anything there after, not sure if there is away in ant to achieve this.
Appreciate your help.
<target name="pxyServer" depends="server">
<echo>Executing Target - Run ProxyServer</echo>
<java classname="pxy.ProxyServer">
<classpath path="staging" />
</java>
</target>
<target name="server">
<echo>Executing Target - RunServer</echo>
<java classname="pxy.Server">
<classpath path="staging" />
</java>
</target>
Your targets are executed sequentially, and since the first one keeps running, the second one never gets the chance to start.
For parallel execution, you can use ant's "parallel" task:
http://ant.apache.org/manual/Tasks/parallel.html
Your modified script should probably look something like this:
<target name="startServerAndProxy">
<echo>Running server and proxy...</echo>
<parallel>
<java classname="pxy.Server">
<classpath path="staging" />
</java>
<java classname="pxy.ProxyServer">
<classpath path="staging" />
</java>
</parallel>
</target>
(Of course, if you're trying to start some third application in parallel, a client for example, then you should also include that one in the "parallel".)
UPDATE:
To start the server and the proxy each in its own console, I don't know if it can be done with the "java" Ant task, but I just tested that it can be done with "exec":
<target name="doit">
<parallel>
<exec executable="cmd" dir="staging">
<arg line="/k start java.exe pxy.Server"/>
</exec>
<exec executable="cmd" dir="staging">
<arg line="/k start java.exe pxy.ProxyServer"/>
</exec>
</parallel>
</target>

Glassfish "does not have administration access" error via Ant build

I'm developing an application that deploys the already done applications. At this application I'm using ant scripts to administrate Glassfish Server.
Here is my deploy and undeploy code snippets,
<presetdef name="asadmin">
<java jar="${glassfish.path}/glassfish/modules/admin-cli.jar" fork="true" jvm="${java.home}/bin/java">
<arg line="--port ${glassfish.admin.port}" />
</java>
</presetdef>
<target name="deploywar">
<asadmin failonerror="true" output="${out.txt}">
<arg value="--host=${deployurl}" />
<arg value="--passwordfile=${password.file}" />
<arg value="deploy" />
<arg value="--properties" />
<arg value="compatibility=v2" />
<arg value="--force=true" />
<arg value="--contextroot=${war.contextroot}" />
<arg value="${deployyolu}/${war.filename}" />
</asadmin>
</target>
<target name="undeploywar">
<echo level="info">
${war.filename} sunucudan kaldırılıyor...
</echo>
<asadmin failonerror="false" output="${out.txt}">
<arg value="undeploy" />
<arg value="MobilHis" />
</asadmin>
<echo level="info">
Proje sunucudan kaldırıldı.
</echo>
</target>
When I call this code snippet from java I got this error via server.log .
User [] from host localhost does not have administration access
I'm using Java JDK 1.6.0_27 and Glassfish Server 3.1.2
Also I deployed this application to another Glassfish Server and it worked just fine. Now what should I do?
-I double checked the username and password and they were correct.
-My passwordfile.txt formatted like "AS_ADMIN_PASSWORD=password"
-I also can login to glassfish server via localhost:4848 interface.

Exception when trying to access webservice through axis2 in java

I am trying to generate web service client through axis2, but I am getting this error:
org.apache.axis.ConfigurationException: No service named Port is available
Could you please help me out, when this error comes, why and how to resolve that.
The question title and the actual question is different.
Could you please post how you are trying to generate the client through ant script or wsdl2java command, if so please paste ant content or command.
wdl2java Ex:-
%AXIS2_HOME%\bin\WSDL2Java -uri wsdlURL -p net.fmb.integrator.serviceprovider.unistream -d xmlbeans -s
AntScript:-
<target name="cleanWsdl2JavaOutDir" description="cleanWsdl2JavaOutDir">
<echo message=".......Cleaning the Previous SRC directory........"/>
<delete dir="${outputdir}"/>
<mkdir dir="${outputdir}"/>
</target>
<echo message=".............Processing wsdl2java................."/>
<target name="wsdl2java" depends="cleanWsdl2JavaOutDir">
<delete dir="output" />
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<classpath refid="axis.classpath"/>
<arg value="-d"/>
<arg value="xmlbeans"/>
<arg value="-uri"/>
<arg value="${wsdlFile}"/>
<arg value="-ss"/>
<arg value="-g"/>
<arg value="-sd"/>
<arg value="-o"/>
<arg file="${outputdir}"/>
<arg value="-p"/>
<arg value="${outputpkg}"/>
</java>
</target>

Categories

Resources