Home > Java > Workaround for WAS NoClassDefFoundError with JAX-WS

Workaround for WAS NoClassDefFoundError with JAX-WS

If you have to use IBM’s JDK with WebSphere Application Server and like to unit test web services outside of the container, you may encounter:


java.lang.NoClassDefFoundError: com.ibm.ffdc.Manager
  at com.ibm.ws.ffdc.FFDCFilter.processException(FFDCFilter.java:82)
  at com.ibm.ws.webservices.engine.components.logger.LogFactory$2.run(LogFactory.java:159)
  at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
  at com.ibm.ws.webservices.engine.components.logger.LogFactory.createLogFactory(LogFactory.java:141)
  at com.ibm.ws.webservices.engine.components.logger.LogFactory.(LogFactory.java:98)
  at java.lang.J9VMInternals.initializeImpl(Native Method)
  at java.lang.J9VMInternals.initialize(J9VMInternals.java:205)
  at com.ibm.ws.webservices.engine.soap.MessageFactoryImpl.(MessageFactoryImpl.java:103)

What is that? A quick search indicates that the server administration client jar is missing from the classpath, but why would I need that? I just want to publish a simple JAX-WS web service.

Fortunately there is a workaround. Set a system property:


  System.setProperty("javax.xml.soap.MetaFactory",
    "com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl");

This forces the use of Sun’s web service stack and the problem is gone. When the code runs in the container the classes are available and in this way we can get the unit tests to work.

Advertisements
Categories: Java
  1. Petar Peric
    2015-04-28 at 11:28

    Hi Erik,

    what is the best way I can reach you?

    Best regards,
    Petar Peric

  2. 2015-04-28 at 20:42

    Depends on what you want, you could send a mail to info@codemint.com if it is business or you could elaborate in a comment.

  3. Scott
    2015-06-05 at 22:05

    Yes!

    You have no idea how relieving it is to see this post. I have no idea where or how you figured this out, but I am eternally grateful. Thank you Erik!!!

  4. Oz
    2015-08-26 at 23:40

    Excelent bro!!!! Your tip helped me a lot! I was triyng to get this error away for 2 days! Thank U!!!

  5. rafael
    2017-12-28 at 17:27

    Great!!!

  6. Software-Tester
    2018-04-04 at 11:49

    Thank you very much for the solution!

  7. Kinjal Biswas
    2019-04-01 at 09:40

    Hi Erik,

    I am facing the same issue, I tried the above the mentioned workaround as well but still facing the same issue. I have written this piece of code in the Junit setup method. PFB the code snippet

    @Before
    public void setUpMMI(){
    String propFilePath = “C:\\xyz.properties”;
    ApplicationRouterJunit applicationRouterJunit = new ApplicationRouterJunit();
    System.setProperty(“javax.xml.soap.MetaFactory”,”com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl”);
    applicationRouterJunit.locateService(propFilePath);
    }

    while trying to get the connection I am facing this issue. Can you please help me with the same. Thanks in advance.

    • 2019-04-01 at 16:27

      Well, I’m not sure but I think you need to set the property early, as in before the classes are loaded. When you set it in @Before it may be too late. Try moving it to a static block in the unit test, for example. That way it will run when the class is loaded. If that doesn’t help I don’t know what could be wrong.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: