Saturday, 25 July 2009

Eclipse + Seam + TestNG Tricky

TestNG gives "Connection Refused" while running on Eclipse


org.testng.TestNGException:
Cannot establish connection: 127.0.0.1:4359
at org.testng.remote.strprotocol.StringMessageSenderHelper.connect(StringMessageSenderHelper.java:93)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:57)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.testng.remote.strprotocol.StringMessageSenderHelper.connect(StringMessageSenderHelper.java:56)
... 2 more

While running TestNG in Eclipse there
will always be 2 VMs involved: the VM of Eclipse and the VM running
the tests. In order to update the plugin UI the 2 VMs are
communicating over a port using a very simple string based protocol.
The exception you are seeing is telling that the 2 VMs are not able to
talk to each other. This is a weird exception that would translate
into: there was impossible to open a communication port between the 2
VMs involved. Off hand, the cause may be: a bug in Eclipse/plugin or
maybe a firewall/antivirus that blocks this.



TestNG/Seam reports ClassNotFoundException issues


[Parser] Running:
D:\showman\My Documents\workspace_3.5\seam.examples.helloworld-test\temp-testng-customsuite.xml


ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Described: name=BeanDeployer state=PreInstall


ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Described: name=ServiceDeployer state=PreInstall
java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException


Caused by: java.lang.ClassNotFoundException: [Ljava.lang.Class;
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)


ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=UserTransaction state=Create
java.lang.RuntimeException: Unable to locate the transaction manager


FAILED CONFIGURATION: @BeforeSuite startSeam
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

UserTransactionBinding
-> UserTransaction{Configured:**ERROR**}

UserTransactionBinding2
-> UserTransaction{Configured:**ERROR**}


*** CONTEXTS IN ERROR: Name -> Error

SARDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

ServiceDeploymentDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

ServiceClassLoaderDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

BeanDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

ServiceDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

BeanMetaDataDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

UserTransaction -> java.lang.RuntimeException: Unable to locate the transaction manager

KernelDeploymentDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

This is mostly caused by Class Path configuration, also, Java 6 may be the cause, use Java 5!!



Could not find several required files


ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Parse: name=vfsfile:/D:/showman/My%20Documents/workspace_3.5/seam.examples.helloworld-test/bootstrap/deploy/jboss-local-jdbc.rar state=Not Installed mode=Manual requiredState=Parse
org.jboss.deployers.spi.DeploymentException: Error parsing meta data jboss-local-jdbc.rar/META-INF/ra.xml

Caused by: java.io.FileNotFoundException: File does not exist: D:\showman\My%20Documents

It seems that it does not like space in the path T_T, try to set the workspace to somewhere with NO space!! FUCK!



When running test case in Eclipse, TestNG complains bad version in .class file even Java 5 is used


java.lang.UnsupportedClassVersionError: Bad version number in .class file

Make sure everything is Java 5 compliant, such as:



  • Project build path

  • JAVA_HOME, JRE_HOME

  • Java's in PATH (check by java -version)

  • The Application Server (i.e. must be JDK5 compiled JBoss AS 5)

1 comment: