2

I'm working on a mavenized java project, using Websphere 7. When the unit tests are run from the command line, using "mvn test", they all run properly. However, when they are run from eclipse, by right clicking run as junit test, a subset of them fail on web service calls because of "javax.xml.ws.WebServiceException: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted."

Caused by: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.

at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
at com.ibm.ws.webservices.engine.xmlsoap.SOAPPart.appendChild(SOAPPart.java:282)
at com.sun.xml.internal.bind.marshaller.SAX2DOMEx.startElement(SAX2DOMEx.java:165)
at com.sun.xml.internal.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:147)
at com.sun.xml.internal.ws.message.AbstractMessageImpl.readAsSOAPMessage(AbstractMessageImpl.java:182)
at com.sun.xml.internal.ws.handler.SOAPMessageContextImpl.getMessage(SOAPMessageContextImpl.java:68)

I've looked at the run configurations in eclipse, and I'm sure that they are using the same (sun 1.6) JDK to run.

I printed out my classpaths in both cases, and I see that the only difference is that when I run from eclipse I have 46 ibm jars that do not exist when I run from command line. Here is a sample: 'C:\Program Files (x86)\IBM\WebSphere\AppServer\plugins\com.ibm.ws.ejbportable.jar', 'C:\Program Files (x86)\IBM\WebSphere\AppServer\plugins\com.ibm.ws.jpa.jar', 'C:\Program Files (x86)\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\dhbcore.jar', 'C:\Program Files (x86)\IBM\WebSphere\AppServer\plugins\com.ibm.ws.admin.core.jar', 'C:\Program Files (x86)\IBM\WebSphere\AppServer\installedConnectors\wmq.jmsra.rar\com.ibm.mq.headers.jar', etc. (I can print the full list if anyone finds it helpful).

Its only my suspicion that these jars are to blame for sabotaging the unit tests, and I'm open to other suggestions and can post more info as requested. I need to be able to run them from eclipse to make debugging them manageable.

newmanne
  • 2,019
  • 5
  • 22
  • 31
  • 2
    Are you using the m2e eclipse plugin for Maven? It will make sure the classpaths are the same. If you're writing unit tests for code that will run on Websphere, then you need those jars on the classpath, and I guess you need to fix the underlying problem that's causing the exception. – artbristol Nov 27 '12 at 21:33
  • yes. When I right click run as maven test, the results are the same as the command line. It's not the command line I meant to emphasize as causing the difference, but rather running them through maven as opposed to through right click run as junit test in eclipse – newmanne Nov 27 '12 at 21:53
  • 1
    The m2e plugin does more than give you the Run As -> Maven test menu option. It sorts out the jars on the classpath during JUnit execution too. Have you tried the Maven -> Update Project... option? – artbristol Nov 27 '12 at 22:05
  • Do you mean maven -> Update project configuration? That didn't help – newmanne Nov 28 '12 at 17:38
  • 1
    If it says 'Update project configuration', you're using an old m2eclipse plugin. I suggest you update to the latest m2e. – artbristol Nov 28 '12 at 18:44

0 Answers0