• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting java.lang.NoClassDefFoundError

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I'm getting java.lang.NoClassDefFoundError despite adding required jars and importing the class in my script.

I could decompile the class from jar. It extends java.rmi.server.UnicastRemoteObject. I'm able to instantiate and use other classes from the jar except for this one.
The chance of multiple classes with same name is also absent.
Do I need to add any other groovy-specific Jars in the classpath?

Thank you!
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When are you getting this error ? Also, can you paste the full stack trace ?
 
Shraddha Pandya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting this error when I'm calling initialize() method on it. Stack trace :

WARNING: Sanitizing stacktrace:

java.lang.NoClassDefFoundError: Could not initialize class com.hp.mx.vmm.vmtools.remote.RemoteServerBase

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:169)

at createVM.class$(createVM.groovy)

at createVM.$get$$class$com$hp$mx$vmm$vmtools$remote$RemoteServerBase(createVM.groovy)

at createVM.run(createVM.groovy:33)

at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:264)

at groovy.lang.GroovyShell.run(GroovyShell.java:513)

at groovy.lang.GroovyShell.run(GroovyShell.java:170)

at groovy.lang.GroovyShell$run$2.call(Unknown Source)

at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy:878)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)

at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)

at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)

at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)

at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)

at groovy.lang.Closure.call(Closure.java:276)

at groovy.lang.Closure.call(Closure.java:271)

at groovy.lang.Closure.run(Closure.java:354)

at java.lang.Thread.run(Thread.java:619)

java.lang.NoClassDefFoundError: Could not initialize class com.hp.mx.vmm.vmtools.remote.RemoteServerBase

at createVM.class$(createVM.groovy)

at createVM.$get$$class$com$hp$mx$vmm$vmtools$remote$RemoteServerBase(createVM.groovy)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you also show the piece of code where this happens ?
 
Shraddha Pandya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I'm calling RemoteServerBase.initialize(); in my groovy script .
----------------------------------------------------------------------------------------------------
Method signature in RemoteServerBase class
public static synchronized void initialize()
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you set the classpath ?
 
Shraddha Pandya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used "Add Jar to Classpath" option available under Script tab in GroovyConsole.
Other classes available in the same jar are accessible from the same script and I can instantiate those classes and use them.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
com.hp.mx.vmm.vmtools.remote.RemoteServerBase.

Everything there is spelled right? No typos?
 
Shraddha Pandya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

No typos.. My script is just few lines long.


Here it is in entirety:

import com.hp.mx.vmm.api.v6_0.*;
import com.hp.mx.vmm.api.v6_0cli.Cli;
import com.hp.mx.vmm.vmtools.config.Configuration;
import com.hp.mx.vmm.vmtools.grid.GridAuthentication;
import com.hp.mx.vmm.vmtools.grid.VmmRuntimeException;
import com.hp.mx.vmm.vmtools.remote.RemoteServerBase;

println "createConfig";
Cli clmode = new Cli();
def proc = "cmd /c dir".execute();

proc.waitFor()
println "return code: ${ proc.exitValue()}"
println "stderr: ${proc.err.text}"
println "stdout: ${proc.in.text}"

RemoteServerBase.initialize();

The bold faced text for Cli is working fine. All these imported packages are available in vmmapi.jar.
In dire need of HELP!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there an API (javadoc) where we could see this RemoteServerBase class ?
 
Shraddha Pandya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not aware of any javadoc for the RemoteServerBase class. On decompiling RemoteServerBase class into java:

package com.hp.mx.vmm.vmtools.remote;

import com.hp.mx.vmm.Version;
import com.hp.mx.vmm.obfus.NoObfuscate;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;

public class RemoteServerBase extends UnicastRemoteObject
implements NoObfuscate
{
protected static final Logger logger = Logger.getLogger(RemoteServerBase.class);

protected static List remoteObjects = new ArrayList();

protected static int port = 0;

protected static boolean init = false;
protected static RemoteSocketFactory socketFactory;
protected static RemoteMultiHomeSupport multiHomeSupport;

public static synchronized void initialize()
{
initializeInternal(!Boolean.getBoolean("com.hp.mx.vmm.vmtools.remote.nomultihome"));
}
..
.....
..............

Please let me know if it's useful.
 
Shraddha Pandya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
initializeInternal() method uses other classes in com.hp.mx.vmm.vmtools.remote.* package..
and those have also been imported!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I can't tell much more here... What you could try is to make a Java class which uses that class, set the JAR in your classpath, and try to execute it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic