Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

So I've continued moving my web services over from wsimport way of building them to JWSC and in my quest I keep hitting issues to do with JWSC compilation. This latest problem came in the form of 'Wrong number of class files' error message. This stumbled me for a while, it was an hour before my vacation was about to start, I just wanted to throw the laptop off the balcony at this point, but I managed to find a fix for this error.

The problem as it turned out was to do with classes generated by wsimport. My bad, I should have paid more attention. Lets see the error message first though.

This is a part of the JWSC output, but it shows the error.
 JWSC Error Output
...
[jwsc] JWS: processing module XXXX
[jwsc] Parsing source files
[jwsc] Parsing source files
[AntUtil.deleteDir] Deleting directory /var/folders/y2/__zvkpb547zg92kgv6rx5m540000gn/T/_fe1arz
BUILD FAILED
/XXXX/build.xml:181: The following error occurred while executing this line:
/XXXX/build_targets.xml:200: weblogic.wsee.tools.WsBuildException: Wrong number of class files. Expected 114, got 110


Update: The original fix suggested to delete all of the package-info.java files. Instead, I started excluding them in my build system, I think this is a cleaner approach. So my jwsfileset looks like this now...
 JWSC Target
...
<jwsfileset srcdir="${path.src}" type="JAXWS">
<include name="**/*.java" />
<exclude name="**/package-info.java"/>
</jwsfileset>
...


Below is the original approach I used.

So the fix is to find and delete all of the package-info.java files in your source directory. JWSC seems to expect these, but they don't get processed somehow. No issue, there is nothing useful in these files so they are quite safe to delete.
jwscerrpkginfo.png


After I deleted all of these in my project, the issue went away.



-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.