This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236595

Summary: registerGlassFish() fails with java.lang.NoSuchMethodException
Product: qa Reporter: Vladimir Riha <vriha>
Component: JellytoolsAssignee: Jiri Skrivanek <jskrivanek>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P1    
Version: 7.4   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Vladimir Riha 2013-10-01 12:03:27 UTC
Method to register GF server in

org.netbeans.jellytools.modules.j2ee.J2eeTestCase.registerGlassFish()

fails with

java.lang.NoSuchMethodException: org.netbeans.modules.glassfish.common.registration.AutomaticRegistration.autoregisterGlassFishInstance(java.lang.String, java.lang.String)
	at java.lang.Class.getDeclaredMethod(Class.java:1994)
	at org.netbeans.jellytools.modules.j2ee.J2eeTestCase.registerGlassFish(J2eeTestCase.java:420)
	at org.netbeans.jellytools.modules.j2ee.J2eeTestCase.addServerTests(J2eeTestCase.java:237)
	at org.netbeans.jellytools.modules.j2ee.J2eeTestCase.addServerTests(J2eeTestCase.java:216)
	at org.netbeans.test.syntax.ExpressionLang30Test.suite(ExpressionLang30Test.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:400)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1063)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:914)



It seems to be caused by change in method signature from

AutomaticRegistration.autoregisterGlassFishInstance(java.lang.String, java.lang.String)

to

AutomaticRegistration.autoregisterGlassFishInstance(java.lang.String, java.lang.String, java.lang.String)



This change was introduced with http://hg.netbeans.org/web-main/rev/043c87804230
Comment 1 Vladimir Riha 2013-10-01 13:25:10 UTC
Please ignore the change set it is pretty old but tests start to fail last week after September 24. I'm not sure what has changed, maybe glassfish used to be already registered  so registerGlassFish() was not called?

http://test4u.cz.oracle.com/job/Web.Syntax-trunk/6/jdk=jdk7,label=ubuntu/console

  => passed OK

http://test4u.cz.oracle.com/job/Web.Syntax-trunk/9/jdk=jdk7,label=ubuntu/console

  => output log shows java.lang.NoSuchMethodException
Comment 2 Vladimir Riha 2013-10-01 14:25:47 UTC
Looks like it is caused by http://hg.netbeans.org/web-main/rev/0f3604f97c97 and there are 2 issues:
 a) reflection in the J2eeTestCase.registerGlassFish() expects 2 parameters which is wrong
 b) new jar need to be passed as parameter when getting list of Jars in J2eeTestCase.registerServer() 

Because of missing jar, registerServer() fails and registerGlassFish() is called and then it throws NSME. Prior September 24, registerServer() succeeded so registerGlassFish() was not called and problem with reflection did not appear.

To fix b), simply adding the jar for GlassFish in getJars() helps. For a) I've tried to use empty String 

...
 result = (Integer) method.invoke(null, findCluster("enterprise"), glassFishHome + "/glassfish", "");
...

which worked (GF was registered) but I don't know what could it affect.

Thank you.
Comment 3 Jiri Skrivanek 2013-10-02 13:33:48 UTC
Fixed in core-main #48c32c6cd4cd. Thank you for evaluation.
Comment 4 Vladimir Riha 2013-10-04 08:45:25 UTC
Thank you, verified