function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Where in the project to put Java classes generated by Apache Axis2?



This may be a stupid question, but I'm having a hard time doing anything with the files generated by Axis2.


I made sure to use the xmlbeans databinding option when I generated them.


I ended up with a folder that had 2 subfolders (resources and src) and a build.xml file. Do I just place all of these in the project root? I've tried this and Eclipse freaks out and throws a bunch of errors, saying all of the class names are invalid, etc (even after cleaning the project).


I've also tried just placing the folders within src into the project src and that fails as well.


There is no mention of the specifics of this in documentation.




One option is to create a jar file out of the generated source from axis2, that way you can create and ant task to generate and create the jar file for the wsdl.


Thanks for the reply.


So I generate a .jar from the entire directory produced by WSDL2JAVA?


I ask because I've tried this, and I end up with a jar full of tons of .xsb files...


And when I create a .jar using only the src folder .java files...failure as well.


Any help??

Abhinav GuptaAbhinav Gupta

I suggest using SFDC-WSC for java, its much better than the Axis stuff


Here are the links


Thanks Abhinav but that tool isn't working very well either. The wsdlc utility command keeps failing, and saying that tools.jar isn't in my classpath. The classpath has the jre folder in it...however tools.jar isn't part of this jre. I have JRE and JDK version 1.6. The only tools.jar on my system is in the JDK folder.


And yes, Axis and Axis2 are both very outdated and hard to use and any alternative is welcome. I wish this new tool worked, but it does not. (I am using win7 64-bit fyi)

Abhinav GuptaAbhinav Gupta

Yeah, going to WSC is harder directly. I have a wrapper project on that i.e. Tolerado. Its mentioned on blogs etc for the stuff its offering. I am sure it will take all of the burden from you. As its having all popular WSDLs, converted to Java  Classes already with cool wrappers to be productive and production stable. 


Check these links


So, why don't you just run it with the JDK in the classpath instead?




When I try the JDK in the path I get a different exception: Could not find the main class




Then you're missing the wsc jar from the classpath.


I added to the classpath and it kept trying to find tools.jar in the wrong directory (JRE instead of JDK) so I said screw it, copied tools.jar into the JRE/lib directory. This seems to have worked but is going to take some testing to confirm for sure...


Still going through the slow pain of trying to make this work.


Everything is almost working but cannot get my login method to work. It broke upon using the new class files:


LoginResponse_element lresp = soap.login(login, new LoginScopeHeader_element());



Not sure where the new login method's no longer in the Soap data type...and I can't find one anywhere else.....sigh....

Abhinav GuptaAbhinav Gupta

I suggested you to move to Tolerado. I created this project, to make developer's life easier and let them focus them on biz logic.


See this comparision chart,


I think it's time I listen to you Abhinav.


It's funny, I just got done using your blog, found via google search, to re-generate my .jar using WSC with correct name-space (I was getting "type com.sforce.bind.XMLizable cannot be resolved" error).

Abhinav GuptaAbhinav Gupta

Great, I am glad blog was useful any way :)


After rebuilding everything using Tolerado for WSC, I'm having mostly the same confusing problems.


I get this error again: "The type cannot be resolved. It is indirectly referenced from required .class files."


My project includes (and the build path references):




sforce_prtner.jar (this is .jar generated from Partner.wsdl using wsc)


Also, I generated classes from wsdl using the -Dpackage-prefix=wsc option to avoid namespace conflicts, as before...but that doesn't fix the issue.


Any ideas???

Abhinav GuptaAbhinav Gupta

wsc-19.jar should be in the classpath. You can download it from here


Check this, for other dependencies of Tolerado. You need to include those to make things rock


Ah, okay! I just added and that fixed it.


Next issue....Do I need to set up logging?  I get this exception from running the first stub example here:


Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at com.tgerm.tolerado.wsc.core.ToleradoSessionCache.<clinit>(
    at com.tgerm.tolerado.wsc.core.ToleradoStub.prepare(
    at com.tgerm.tolerado.wsc.partner.ToleradoPartnerStub.prepare(
    at com.tgerm.tolerado.wsc.core.ToleradoStub.<init>(
    at com.tgerm.tolerado.wsc.partner.ToleradoPartnerStub.<init>(
    at Foothill.main(
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at$ Source)
    at Method)
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 6 more


Any way around this?


Abhinav GuptaAbhinav Gupta

Did you checked this page


Anyway, I created new download for you here : All Dependencies


Include all these jars in the classpath, it should go well then. Let  me know in case of more issues


Doh - that's my oversight! Thanks for the quick help and guidance. This is working now in test scenario. Now I will put this into my full integration and test.


you may get answer already. But I want to share my simple way. After generated, I copied the folder under resource(i.eschemaorg_apache_xmlbeans) to folder 'src'. Then copied another 2 folders(i.e com & org) to folder 'src' too.

then it will work for you.  The folder 'src' mean the root(source) folder of your application.