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.
Related
Here is my problem.
I have a #env tag on feature level to identify which env to run on, and #current tag on scenario level to identify its the one to be run.
Feature files are placed under different folders (depending on the env) and I have used #Cucumberoptions to set the tag specific feature file path.
All good till here.
But when I run the feature files, it picks up all the scenarios with the #current tag irrespective of the feature file tag.
For E.G. I had added only #Env1 and #Env2 in the cucumber options, but it picks up #Env3 features as well and runs them. How do I stop cucumber to run feature files not mentioned in the #cucumberOptions?
Here is the ANT target code:
<java classname="cucumber.api.cli.Main" fork="true" failonerror="false" resultproperty="cucumber.exitstatus">
<sysproperty key="log4j.configuration" value="file:///${basedir}/log4j.conf"/>
<classpath refid="classpath"/>
<arg value="--monochrome"/>
<arg value="--format"/>
<arg value="junit:target/cucumber-junit-report/allcukes.xml"/>
<arg value="--format"/>
<arg value="pretty"/>
<arg value="--format"/>
<arg value="html:target/cucumber-html-report"/>
<arg value="--glue"/>
<arg value="src.test.cucumber.userlevel"/>
<arg value="features"/>
<arg value="--tags" />
<arg value="#current"/>
<arg value="--tags" />
<arg value="~#obsolete" />
<arg value="--tags" />
<arg value="~#business" />
</java>
Any responses would be appreciated.
Thanks.
Need to use a AND, OR combination in the tag filter expression to make this work. Not too sure about how to run Cucumber from Ant so including tag filters in cucumberoptions and from cli.
For cucumberoptions -> tags={"#Env1,#Env2","#Current"}
For CLI -> --tags #Env1,#Env2 --tags #Current
For Ant ->
<arg value="--tags" />
<arg value="#Env1,#Env2"/>
<arg value="--tags" />
<arg value="#Current" />
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
Here is the portion of my ant script that doesn't work properly.
<exec executable="/bin/bash">
<arg value="../libraries/android-mapviewballoons/android-mapviewballoons/mapimports.sh" />
<arg value="a"/>
</exec>
<exec executable="/bin/bash">
<arg value="mapimports.sh"/>
<arg value="a"/>
</exec>
The first script never runs, but the second script runs fine. No errors are returned. I've tried running both scripts manually and they work.
Does anyone know how I might debug this or make it work?
I got something similar running with:
<exec executable="bash" dir="./pathToScript/" >
<arg value="script.sh" />
<arg value="param" />
</exec>
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>
All,
I have a NetBeans Platform project (not just a project I wrote in NetBeans, but one using the rich client framework provided by NetBeans). I can run the project via an ant run command. Now, I want to pass in an argument that will work its way through ant to be accessible via the System.getProperty method.
I understand that I need to use a <sysproperty> node to actually inject the key/value pair into the runtime environment, but for the life of me I cannot figure out how to get this to work with the convoluted build tree that NetBeans creates for you (build.xml depends on build-impl.xml, which in turn depends on ${harness.dir}/suite.xml, which in turn depends on ${harness.dir}/run.xml)
The simplest example I've found is
<target name="run" depends="compile">
<java classname="prop"
fork="true">
<sysproperty key="test.property"
value="blue"
/>
</java>
</target>
but the problem is that none of my xml files have an easily accessible <java> node like that. I think I've managed to trace the execution flow to where something is actually invoked (in ${harness.dir}/run.xml)
<target name="run" depends="-prepare-as-app,-prepare-as-platform">
<touch file="${cluster}/.lastModified"/> <!-- #138427 -->
<property name="run.args" value=""/>
<property name="run.args.ide" value=""/>
<property name="run.args.extra" value=""/>
<condition property="run.args.mac" value="-J-Xdock:name=${app.name}" else="">
<os family="mac"/>
</condition>
<exec osfamily="windows" executable="${run.exe}" failonerror="no" resultproperty="result.prop">
<arg value="--jdkhome"/>
<arg file="${run.jdkhome}"/>
<arg line="${run.args.common}"/>
<arg line="${run.args.prepared}"/>
<arg line="${run.args}"/>
<arg line="${run.args.ide}"/>
<arg line="${run.args.extra}"/>
</exec>
<exec osfamily="unix" dir="." executable="sh"
failonerror="no" resultproperty="result.prop">
<arg value="${run.sh}"/>
<arg value="--jdkhome"/>
<arg file="${run.jdkhome}"/>
<arg line="${run.args.common}"/>
<arg line="${run.args.prepared}"/>
<arg line="${run.args}"/>
<arg line="${run.args.ide}"/>
<arg line="${run.args.extra}"/>
<arg line="${run.args.mac}"/>
</exec>
<fail>
The application is already running within the test user directory.
You must shut it down before trying to run it again.
<condition>
<and>
<isset property="result.prop" />
<or>
<!-- unknown option exit code as returned from IDE by org.netbeans.api.sendopts.CommandLine -->
<equals arg1="${result.prop}" arg2="50346" />
<!-- unknown option exit code as returned from platform app by org.netbeans.CLIHandler -->
<equals arg1="${result.prop}" arg2="2" />
</or>
</and>
</condition>
</fail>
</target>
As you can see, there is no <java> node underneath which I can put my custom sysproperty. Furthermore, it seems like a very wrong thing to do to have to muck around with harness xml files to inject a property that only affects one of my projects, not all of them. So what's the correct way to ensure that a command line property I pass to ant run ends up within a NetBeans Platform project?
There is a folder etc in the distribution of your RCP app and in that folder is file yourapp.conf i think there is an answer you seek. For example from one of mine NB RCP app:
# ${HOME} will be replaced by user home directory according to platform
default_userdir="${HOME}/.${APPNAME}/dev"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/dev"
# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--laf Metal --branding xmled -J-Xms24m -J-Xmx64m"
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea
# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
#jdkhome="/path/to/jdk"
# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=