Groovy Eclipse XML RPC - error detecting run time property - eclipse

As per this example provided in the groovy site, I have tried to implement an exactly same XML RPC Server on my eclipse.
import groovy.net.xmlrpc.*
import java.net.ServerSocket
def server = new XMLRPCServer()
server.echo = {return it}
def serverSocket = new ServerSocket( 9004 )
server.startServer(serverSocket)
The above code will launch a server on 9004 only when I run from groovy console. When I run the same from Eclipse it fails to run and shows the following exception
Caught: groovy.lang.MissingPropertyException: No such property: echo for class: groovy.net.xmlrpc.XMLRPCServer
at GServer.run(GServer.groovy:7)
Perhaps it is unable to understand the dynamic addition of the new property called echo but I am not sure. How can I fix this?
PS : I am running
Eclipse Galileo 3.5
Groovy eclipse plugin installed
Groovy xml rpc jar is on the classpath

There were some bugs with the launcher in the Groovy-Eclipse that ran on Eclipse 3.5. I'd recommend that you upgrade to Groovy-Eclipse 2.6.0 on Eclipse 3.7. I'd bet that your problem would go away.

Related

Groovy ClassNotFoundException: groovy.swing.factory.groovy$lang$Closure

In Eclipse I have for some reason since last week a weird error while using Groovy. I never seen this error before and a search shows that I seems to be the only one.
Caused by: java.lang.NoClassDefFoundError: groovy/swing/factory/groovy$lang$Closure
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3427)
at java.base/java.lang.Class.getMethods(Class.java:2019)
at org.junit.platform.commons.util.ReflectionUtils.getDefaultMethods(ReflectionUtils.java:1518)
at org.junit.platform.commons.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:1491)
at org.junit.platform.commons.util.ReflectionUtils.findMethod(ReflectionUtils.java:1341)
at org.junit.platform.commons.util.ReflectionUtils.isMethodPresent(ReflectionUtils.java:1242)
I have no clue why I get this. I'm not using Swing or Groovy Swing anywhere. It's not JUnit 5 related because I got this also from Guice.
This should be related with Eclipse because if I compile it in Maven it runs fine. Currently I need to do a mvn clean install so that it runs again in Eclipse.
Eclipse Version: 2022-06 (4.24.0)
Build id: 20220609-1112
Groovy 3.0.14
Run in Eclipse. Groovy is added as dependency. It should run without errors.

Security Exception While Running TestNG test in Eclipse

Getting the below error while trying to run the TestNG test in Eclipse Neon . Seems like there is some sort signed content in jar dependency which is blocking this . have no idea what its though ..Any suggestions on how to fix this . Have never faced this before .
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:284)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:238)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:273)
at java.util.jar.JarVerifier.update(JarVerifier.java:228)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
at java.util.jar.JarFile.getInputStream(JarFile.java:450)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:162)
at java.net.URL.openStream(URL.java:1045)
at org.testng.remote.RemoteTestNG.getTestNGVersion(RemoteTestNG.java:84)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:39)
[ServiceLoaderHelper] More than one working implementation for 'null', we will use the first one
Exception in thread "main" java.lang.NoSuchMethodError: org.testng.internal.Utils.defaultIfStringEmpty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
at org.testng.remote.AbstractRemoteTestNG.setHost(AbstractRemoteTestNG.java:59)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:122)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
oh, I sort of got your problem, looks like you're using an pretty old version of testng (probably the 5.x), since TestNG eclipse plugin 6.9.12.201607091356, TestNG versions below 6.5.1 are not supported: https://github.com/cbeust/testng-eclipse/blob/master/CHANGES.md#6910
So please upgrade your testng version.
Edit: since TestNG Eclipse Plugin 6.9.13.201609291640, the whole TestNG 6.x series are supported (including 6.0 to 6.5.1), while the TestNG 5.x still not be supported.

org/eclipse/e4/ui/model/application/ui/MUIElement Class Not Found , Java Eclipse Juno

I am doing a CIMTool project, for a handle of WorkbenchWindow
Code Snippet
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
//(both these Classes are present in Libraries)
IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Issues
Following Error is slapped
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/e4/ui/model/application/ui/MUIElement
at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:90)
Environment
Eclipse : Eclipse Java EE IDE for Web Developers, Version: Juno Service Release 2
OS : MS Windows 7 Professional, X86
Java Version : java version "1.7.0_25"
Questions
I tried searching for org/eclipse/e4/ui/model/*, I could not find in
Archives. Where I can find ?
Is there any otherway to get IWorkbenchWindow Instance ? (want to
avoid this issue)
This problem I found that, doesnt appear in Java Indigo. But my project has to be developed in Eclipse , so I cant migrate.
thanks
I also was confronted with this error when executing code from within a project that was created as "SWT/JFace Java Project" using Eclipse Kepler (displaying a ListSelectionDialog).
The main problem is that the project set-up misses a JAR file that contains the MUIElement class. You can easily fix the project set-up by editing the build-path, adding the external jar which has a name similar to this one:
org.eclipse.e4.ui.model.workbench_1.0.1.v20131118-1956.jar.
You find that jar in the plugins directory of your Eclipse installation.

AntBuilder works in Groovy Console but not in Eclipse

I am running Windows 7. The following code works in Groovy Console:
def fileEx = new File(/Y:\Documents\Test File.txt/)
def copyToFile = new File(/Y:\Documents\Test File - Copied by Groovy and Ant.txt/)
ant = new AntBuilder()
ant.copy(file:fileEx, tofile:copyToFile)
but when I try to run it as a Groovy Script in Eclipse, I get this error:
Caught: java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
at copyFile.run(copyFile.groovy:4)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException
I have tried adding ant.jar to myclasspath, both the ant.jar in the Groovy lib folder and the one in the Eclipse plugins lib folder, but this does not solve the problem.
Looks like groovy-eclipse plugin ships with a subset of libraries a full install of groovy does. You'll want a full install of groovy, which you may already have, in addition to the eclipse plugin.
You should be able to solve your problem by going to your project, and going to Properties->Java Build Path, then click 'Libraries'. 'Add External Jars' and navigate to your full groovy installation. Under there, the lib directory should have the ant.jar and ant-launcher.jar. Add them both. This should clear this up (and queue up the underlying problem for debugging).

Eclipse doesn't show java source code

I'm running java 1.6 in Eclipse on my Intel Mac. I'm using the 1.6.0 version under System/Library/Frameworks and set the default compiler to this in Eclipse.
How do I attach the source code?
First, I downloaded the 1.6 source from oracle, thinking I could attach that 'cause the installed 1.6 didn't have source.
When I click a java class to get the Source Code Editor, there are problems:
first, the top line says Compiled from File.java (version 1.5 : 49.0, super bit)
most important, when I attach the 1.6 source jar file, it gets an error:
An error has occurred. See error log for more details.
Unable to create resource org.eclipse.ui.internal.misc.ExternalProgramImageDescriptor#50417ba8
This also appears in the error log:
java.lang.ClassNotFoundException: org.eclipse.ui.internal.views.log.LogView
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
The Eclipse version is: Eclipse Java EE IDE for Web Developers.
Version: Helios Service Release 2
Build id: 20110218-0911
When I click for installation details, I get:
An internal error occurred during: "Fetching children of _SELF_".
Registry Directory not available: /Users/rfrail/Downloads/eclipse 2/p2/org.eclipse.equinox.p2.engine/profileRegistry.
I'm running Eclipse from my Download directory (it's worked fine in the past); however, there are 2 folders for Eclipse:
eclipse, and
eclipse 2.
So that looks like a source of confusion right there. Eclipse operates fine otherwise.
Can you help, please?
http://java.decompiler.free.fr/ is your answer
it has an eclipse plugin which decompiles code in place