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" ?
Related
I'm trying to use ant to generate webservices from existing code to war file. Eclipse generate a complete ant buildfile (axis_bujava.xml) which works (but undeploy.wsdd is not generated all times, I don't know why) but only if I run it from eclipse.
I want to have a standalone script to generate my webservice (and after packaging it to warfile but this is not a problem ^^)
I added some jars from eclipse plugins folder to classpath and created the task "wsgen" but not I get a "null pointer exception".
My axis_bujava.xml :
<?xml version="1.0"?>
<project default="main" basedir=".">
<echo message="pulling in property files"/>
<property file="axis_bujava.properties"/>
<path id="wsgenlib">
<fileset dir="${ant.library.dir}/org.eclipse.wst.command.env/" includes="ant-lib/anttasks.jar"/>
</path>
<taskdef name="wsgen"
classname="ws.ant.task.WebServiceGenerationAntTask"
classpath="${ant.library.dir}/org.eclipse.wst.command.env"
/>
<echo message="calling the web services generation ant task: axis_bujava"/>
<target name="main" >
<wsgen />
</target>
</project>
The error :
D:\Dev\S_Demo\ant\axis_bujava.xml:22: java.lang.NullPointerException
at org.eclipse.wst.command.internal.env.context.PersistentContext.(PersistentContext.java:31)
at org.eclipse.wst.command.internal.env.context.PersistentResourceContext.(PersistentResourceContext.java:36)
at org.eclipse.wst.command.internal.env.context.PersistentResourceContext.getInstance(PersistentResourceContext.java:27)
at org.eclipse.wst.command.internal.env.ant.AntController.(AntController.java:56)
at ws.ant.task.WebServiceGenerationAntTask.execute(WebServiceGenerationAntTask.java:31)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 0 seconds
As I said in comments, I solved this by using Axis class directly (as eclipse does) :
Important Note : Ant version used :
Apache Ant(TM) version 1.9.2 compiled on July 8 2013
1st, dependencies (minimal list, add them to ant classpath at execution) :
axis.jar
axis-ant.jar
2nd, Ant build.xml :
Get task from axis-ant.jar
<taskdef
resource="axis-tasks.properties"
/>
In the target :
generate wsdl file
Note : If not working, use org.apache.axis.wsdl.Java2WSDL, similar to next point and both have a "-h" option for help
<axis-java2wsdl
output="WebContent/WEB-INF/NameOf.wsdl"
namespace="http://org.acme.com"
style="WRAPPED"
location="http://localhost/MyService/service/MyServiceImpl"
classname="com.acme.org.MyServiceImpl"
classpath="build/classes"
/>
generate deploy/undeploy.wsdd files
Use of "java" directly because, in my case, ant task from axis-ant does not work. And exec task, I have some problems with java task (cause of ant version)
<exec executable="java">
<arg value="-cp" />
<arg value="${path.dependencies}/*;build/classes" />
<arg value="org.apache.axis.wsdl.WSDL2Java" />
<arg value="-d"/>
<arg value="Application"/>
<arg value="-o"/>
<arg value="WebContent/WEB-INF/MyServiceImplService/"/>
<arg value="-p"/>
<arg value="com.acme.org"/>
<arg value="-c"/>
<arg value="com.acme.org.MyServiceImpl"/>
<arg value="-s"/>
<arg value="WebContent/WEB-INF/NameOf.wsdl"/>
</exec>
Generate server-config.wsdd
<exec executable="java">
<arg value="-cp" />
<arg value="${path.dependencies}/*" />
<arg value="org.apache.axis.utils.Admin" />
<arg value="server"/>
<arg value="WebContent/WEB-INF/MyServiceImplService/com.acme.org/deploy.wsdd"/>
</exec>
<move file="server-config.wsdd" tofile="WebContent/WEB-INF/server-config.wsdd"/>
Cleanup generated jar files
<delete>
<fileset dir="WebContent/WEB-INF/MyServiceImplService/com.acme.org/" includes="*.java" />
</delete>
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
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.
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>
I've got the following markup:
<?xml version="1.0" ?>
<project name="SampleBuild" default="compile" basedir=".">
<property name="SvnAntDir" value="C:/Program Files/Apache/svnant-1.2.1/doc" />
<property name="src" value="_src_" />
<property name="build" value="_build_"/>
<property name="dist" value="${build}/_jars_" />
<path id= "svnant.classpath" >
<fileset dir= "${SvnAntDir}" >
<include name= "*.jar" />
</fileset>
</path>
<target name="pre-cleanup">
<delete dir="${src}" />
<delete file="${dist}/Project.jar" />
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${build}/_classes_/sevgok/" />
</delete>
<mkdir dir="${src}" />
<tstamp />
</target>
<target name="checkout" depends="pre-cleanup">
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />
<svn>
<checkout url="svn://p-subversion/Project/trunk" revision="HEAD" destPath="${src}" />
</svn>
</target>
<target name="compile" depends="checkout">
<javac srcdir="${src}" destdir="${build}/_classes_" debug="on" debuglevel="lines,vars,source">
<classpath>
<pathelement path="${classpath}" />
<fileset dir="./_libs_">
<include name="*.jar" />
<include name="*.zip" />
</fileset>
</classpath>
</javac>
</target>
</project>
Problem occurs when trying to make a build. The error message is next:
checkout: [svn] <Checkout> started ...
[svn] svn: svn://p-subversion/Project/trunk` doesn't exist
[svn] svn: svn://p-subversion/Project/trunk` doesn't exist
[svn] <Checkout> failed!
Build FAILED
C:\build.minimal.xml: (line of code which points to <svn> openning tag): Can't checkout.`
Simultaneously it is possible to make a checkout with Tortoise SVN client using the url.
Help!
EDIT
I tried using -v key when building and got the following:
Caused by: org.tigris.subversion.svnclientadapter.SVNClientException: org.tigris
.subversion.javahl.ClientException: svn: URL 'svn://p-subversion/Project/trunk
' doesn't exist
EDIT
Is there any alternative to SvnAnt? It would be great if it was also well documentated.
Thanks
EDIT
So code that works for me is:
<target name="checkout" depends="pre-cleanup">
<exec dir="${basedir}" executable="svn" failonerror="true">
<arg line="checkout -r ${revision} ${SvnUrl} ${src}" />
</exec>
</target>
where ${SvnUrl} is the same URL I used before.
If svnant does not work at all you could just execute svn from the command line:
<exec executable="svn" dir="DIRECTORY_WHERE_COMMAND_EXECUTES">
<arg line="checkout svn://p-subversion/Project/trunk $src"/>
</exec>
You would have to install a svn command line client. Make sure, that you add the bin-Directory of the client to the PATH.
But take care to install the same client version as your tortoise client. If they mismatch they will make the working copy unaccessible for the other.
What is p-subversion supposed to be? SVN URLs, just like HTTP URLs, begin with a hostname. If p-subversion isn't a hostname that will point to your computer, then the checkout will fail. Perhaps it should look more like this?
svn://localhost/p-subversion/Project/trunk
[edit]If it's a Windows share...
file://p-subversion/Project/trunk
the svn:// URL assumes a hostname, but in the case of a share some other part of the OS is already negotiating the TCP connection. Refer to it like you would any other folder.