Exception when trying to access webservice through axis2 in java - 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>

Related

How do I tell cucumber to execute feature files taking into consideration both feature tags as well the scenarios tags?

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" />

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.

Shell script isn't run by ant using exec tag if script is in a different directory

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>

Categories

Resources