NoClassDefFoundError when trying to return a custom Object

Hi,
I'm trying to get some system memory info from a Windows machine using Java. I've written the C code and Java code and it all compiles fine. I can also use most of the methods in the two files. I have a problem with one method though. Its a method that is returning an object type that I created that mirrors a windows structure. Below is the code.
// Java Object to store the data
package agent.win32;
public class MemoryInfo{
  int dwLength;
  int dwMemoryLoad;
  int dwTotalPhys;
  int dwAvailPhys;
  int dwTotalPageFile;
  int dwAvailPageFile;
  int dwTotalVirtual;
  int dwAvailVirtual;
  public int get_dwLength() { return dwLength; }
  public int get_dwMemoryLoad() { return dwMemoryLoad; }
  public int get_dwTotalPhys() { return dwTotalPhys; }
  public int get_dwAvailPhys() { return dwAvailPhys; }
  public int get_dwTotalPageFile() { return dwTotalPageFile; }
  public int get_dwAvailPageFile() { return dwAvailPageFile; }
  public int get_dwTotalVirtual() { return dwTotalVirtual; }
  public int get_dwAvailVirtual() { return dwAvailVirtual; }
// Java Class that uses JNI
package agent.win32;
public class NIMSNT {
  //Constructor
  public NIMSNT(){};
  static{
    try{
      System.loadLibrary("NIMSNT");
    catch (java.lang.UnsatisfiedLinkError e) {
      System.out.println (e);
   * check psapi.dll and psapi functions
   * return true if NT process can be enumerate
  public static native boolean Initialize();
   * Description:The EnumProcesses function retrieves the process identifier
   * for each process object in the system
   * return value:the list of process identifiers
   * call psapi function EnumProcesses
  public static native int[] EnumProcesses();
   * Description:The OpenProcess function returns a handle to an existing process object.
   * return value:If the function succeeds, the return value is an open handle to the specified process
   * call kernel32 function OpenProcess
  public static native int OpenProcess(int Pid);
   * Description:The EnumProcessModules function retrieves a handle for each module in the specified process
   * return value:the list of module handles
   * call psapi function EnumProcessModules
  public static native int[] EnumProcessModules(int hProcess);
   * Description:The GetModuleFileNameEx function retrieves the fully qualified path for the specified module
   * return value:the fully qualified path for the specified module
   * call psapi function GetModuleFileNameEx
  public static native String GetModuleFileName(int hProcess,int hModule);
   * Description:The GetModuleBaseName function retrieves the base name of the specified module
   * return value:the base name of the specified module
   * call psapi function GetModuleBaseName
  public static native String GetModuleBaseName(int hProcess,int hModule);
   * Description:function closes an open object handle
   * return value:true if succesfuly
   * call kernel32 function CloseHandle
  public static native boolean CloseHandle(int handle);
   * Description:function gets system memory
   * return value:String
  public static native MemoryInfo GetSystemMemoryInfo();
// C Structure (defined in windows.h)
typedef struct _MEMORYSTATUS {
  DWORD dwLength;
  DWORD dwMemoryLoad;
  SIZE_T dwTotalPhys;
  SIZE_T dwAvailPhys;
  SIZE_T dwTotalPageFile;
  SIZE_T dwAvailPageFile;
  SIZE_T dwTotalVirtual;
  SIZE_T dwAvailVirtual;
} MEMORYSTATUS, *LPMEMORYSTATUS;
// C code
#include <windows.h>
#include <string.h>
#include "agent_win32_NIMSNT.h"
#define MaxProcessNumber 10000
/** Type Definitions                                  **/
typedef BOOL (WINAPI *ENUMPROCESSES)(
     DWORD * lpidProcess, 
       DWORD cb,            
       DWORD * cbNeeded     
typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
     HANDLE hProcess,     
     HMODULE * lphModule, 
     DWORD cb,            
     LPDWORD lpcbNeeded   
typedef DWORD (WINAPI *GETMODULEFILENAMEEXA)(
     HANDLE hProcess,          
     HMODULE hModule,          
     LPTSTR lpstrFileName,     
     DWORD nSize               
typedef DWORD (WINAPI *GETMODULEBASENAME)(
     HANDLE hProcess,          
     HMODULE hModule,          
     LPTSTR lpstrFileName,     
     DWORD nSize               
typedef struct _PROCESS_MEMORY_COUNTERS {
    DWORD cb;
    DWORD PageFaultCount;
    DWORD PeakWorkingSetSize;
    DWORD WorkingSetSize;
    DWORD QuotaPeakPagedPoolUsage;
    DWORD QuotaPagedPoolUsage;
    DWORD QuotaPeakNonPagedPoolUsage;
    DWORD QuotaNonPagedPoolUsage;
    DWORD PagefileUsage;
    DWORD PeakPagefileUsage;
} PROCESS_MEMORY_COUNTERS, *PPROCESS_MEMORY_COUNTERS;
typedef BOOL (WINAPI *GETPROCESSMEMORYINFO)(
     HANDLE hProcess,
     PPROCESS_MEMORY_COUNTERS ppsmenCounters,
     DWORD cb
/** Global Variables                                  **/
ENUMPROCESSES EnumProcesses;
ENUMPROCESSMODULES EnumProcessModules;
GETMODULEFILENAMEEXA GetModuleFileNameExA;
GETMODULEBASENAME GetModuleBaseName;
GETPROCESSMEMORYINFO GetProcessMemoryInfo;
/** DLL Entry                                         **/
BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved){    
     return TRUE;
* Class:     nims4_agent_win32_NIMSNT
* Method:    Initialize
* Signature: ()Z
JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_Initialize(JNIEnv * env,jclass clazz){
     HANDLE hpsapi=LoadLibrary("PSAPI.DLL");
     if (hpsapi==NULL) return FALSE;
     EnumProcesses=(ENUMPROCESSES)GetProcAddress((HINSTANCE)hpsapi,"EnumProcesses");
     GetModuleFileNameExA = (GETMODULEFILENAMEEXA)GetProcAddress((HINSTANCE)hpsapi, "GetModuleFileNameExA");
     GetModuleBaseName = (GETMODULEBASENAME)GetProcAddress((HINSTANCE)hpsapi, "GetModuleBaseNameA");
     EnumProcessModules = (ENUMPROCESSMODULES)GetProcAddress((HINSTANCE)hpsapi, "EnumProcessModules");
     GetProcessMemoryInfo = (GETPROCESSMEMORYINFO)GetProcAddress((HINSTANCE)hpsapi, "GetProcessMemoryInfo");
     if (
          NULL == EnumProcesses          ||
          NULL == GetModuleFileName     ||
          NULL == GetModuleBaseName     ||
          NULL == EnumProcessModules  )
        return FALSE;
     return TRUE;   
* Class:     nims4_agent_win32_NIMSNT
* Method:    EnumProcesses
* Signature: ()[I
JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcesses(JNIEnv * env, jclass clazz){
     DWORD aPids[MaxProcessNumber];
     DWORD cGot;
     jintArray Pids=0;
     if(EnumProcesses(aPids,sizeof(aPids),&cGot)){
          cGot /= sizeof(aPids[0]);
             Pids= (*env)->NewIntArray(env,cGot);
          (*env)->SetIntArrayRegion(env,Pids,0,cGot,(jint*) aPids);
     return Pids;
* Class:     nims4_agent_win32_NIMSNT
* Method:    OpenProcess
* Signature: (IZI)I
JNIEXPORT jint JNICALL Java_agent_win32_NIMSNT_OpenProcess (JNIEnv * env, jclass clazz,jint Pid){
     return (jint) OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE,Pid);
* Class:     nims4_agent_win32_NIMSNT
* Method:    EnumProcessModules
* Signature: (I[I)[I
JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcessModules (JNIEnv * env, jclass clazz, jint hProcess){
     HMODULE hModule[MaxProcessNumber];
     jintArray jModule=0;
     DWORD cGot;    
     if (EnumProcessModules((HANDLE)hProcess,hModule,sizeof(hModule),&cGot)){
          cGot/= sizeof(hModule[0]);
          jModule= (*env)->NewIntArray(env,cGot);
          (*env)->SetIntArrayRegion(env,jModule,0,cGot,(jint*)hModule);
     return jModule;
* Class:     nims4_agent_win32_NIMSNT
* Method:    GetModuleFileName
* Signature: (II)Ljava/lang/String;
JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleFileName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
     jstring jName=0;
     char FileName[MAX_PATH];
     if(GetModuleFileNameExA((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
          jName=(*env)->NewStringUTF(env,FileName);
     return jName;
* Class:     nims4_agent_win32_NIMSNT
* Method:    GetModuleBaseName
* Signature: (II)Ljava/lang/String;
JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleBaseName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
     jstring jName=0;
     char FileName[MAX_PATH];
     if(GetModuleBaseName((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
          jName=(*env)->NewStringUTF(env,FileName);
     return jName;
* Class:     nims4_agent_win32_NIMSNT
* Method:    CloseHandle
* Signature: (I)Z
JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_CloseHandle(JNIEnv * env, jclass clazz, jint handle)
     return CloseHandle((HANDLE) handle);
* Class:     nims_agent_win32_NIMSNT
* Method:    GetSystemMemoryInfo
* Signature: (I)Lagent/win32/MemoryInfo;
JNIEXPORT jobject JNICALL Java_agent_win32_NIMSNT_GetSystemMemoryInfo(JNIEnv * env, jclass clazz){
     jfieldID jfield;
     jobject jobj=0;
     MEMORYSTATUS stat;
     stat.dwLength = sizeof(stat);
     GlobalMemoryStatus(&stat);
     clazz=(*env)->FindClass(env,"agent.win32.NIMSMemoryInfo");
     if (clazz==0) return 0;
     jobj = (*env)->AllocObject (env,clazz);
     //set NIMSMemoryInfo object field
     // dwLength
     jfield=(*env)->GetFieldID(env,clazz,"dwLength","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwLength);
     // dwMemoryLoad
     jfield=(*env)->GetFieldID(env,clazz,"dwMemoryLoad","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwMemoryLoad);
     // dwTotalPhys
     jfield=(*env)->GetFieldID(env,clazz,"dwTotalPhys","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwTotalPhys);
     // dwAvailPhys
     jfield=(*env)->GetFieldID(env,clazz,"dwAvailPhys","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwAvailPhys);
     // dwTotalPageFile
     jfield=(*env)->GetFieldID(env,clazz,"dwTotalPageFile","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwTotalPageFile);
     // dwAvailPageFile
     jfield=(*env)->GetFieldID(env,clazz,"dwAvailPageFile","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwAvailPageFile);
     // dwTotalVirtual
     jfield=(*env)->GetFieldID(env,clazz,"dwTotalVirtual","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwTotalVirtual);
     // dwAvailVirtual
     jfield=(*env)->GetFieldID(env,clazz,"dwAvailVirtual","I");
     (*env)->SetIntField (env,jobj, jfield,stat.dwAvailVirtual);
     return jobj;
};I can use all of the methods in the Java/C code except for the the last native method   public static native MemoryInfo GetSystemMemoryInfo(); . I get a NoClassDefFoundError when I try to use this method. I have a feeling that I'm just doing something stupid.
Thanks in advance,
John

Yes, exactly. I changed the name of that class and forgot to change it in the c code. Thanks for the feedback.
Also, if anyone is using this code as an example, you need to change "agent.win32.MemoryInfo" to "agent/win32/MemoryInfo" in the c code. If it is left as "agent.win32.MemoryInfo" you will get a ClassCircularityError when trying to make multiple calls to the NIMSNT.GetSystemMemoryInfo();.

Similar Messages

  • Java.lang.NoClassDefFoundError when trying to create JNI Java object

    Can anyone give some clue for the following errors:
    //// JSP code:
    <%
    UIAccessCheckNat access = new UIAccessCheckNat();
    int nbrwdSifd = access.checkNbrwsSfid();
    %>
    //// Java code:
    UIAccessCheckNat.java
    package test.JS;
    public class UIAccessCheckNat
    public UIAccessCheckNat()
    //Empty constructor
    // this method check if NBRWS is turned on
    public int checkNbrws()
    int rc = 0;
    return rc;
    // Load native library.
    static
    System.loadLibrary("UIAccessCheckNat");
    ////The JNI c library code:
    #include <string.h>
    #include <stdio.h>
    #include <jni.h>
    #include "UIAccessCheckNat.h"
    /*ARGSUSED*/
    JNIEXPORT jint JNICALL Java_test_JS_UIAccessCheckNat_nativeCheck
    (JNIEnv * env, jobject jthis, jint id)
    jint rc=1;
    return rc;
    Testing result:
    1. Sunny day case, everything is OK if don't load the library (comment the following line and recompile the java class)
    // Load native library.
    // static
    // System.loadLibrary("UIAccessCheckNat");
    2. Rainy day case: wen put the above lines in the java class and recompile the Java class and load the JSP again, it cause error as following:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException
         at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
         at org.apache.jsp.Login_jsp._jspService(Login_jsp.java:434)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause
    java.lang.NoClassDefFoundError
         at org.apache.jsp.Login_jsp._jspService(Login_jsp.java:96)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    note The full stack trace of the root cause is available in the Tomcat logs.
    I am using Apache Tomcat/5.0.18 as servlet container.
    Can anyone plesae help?
    Thanks

    I would normally do:
    <jsp:useBean id="access" scope="session" class="YourPackageName.UIAccessCheckNat()" />
    Then int nbrwdSifd = access.checkNbrwsSfid(); should work
    You MUST put your class into a package:
    Tomcat 5.0\webapps\yourApplication\WEB-INF\classes\YourPackageName

  • Error #1009 When trying to return to frame 1

    I am getting an error #1009 "Cannot access a property or method of a null object reference."  Frame one is not empty. I have buttons in frame 1 that use this code to gotoAndStop on frames 5,10,25...they work just fine.  I only get the error when trying to return to frame 1 from those locations. Can someone help me out with this issue?
    stop();
    btn_rtni.addEventListener(MouseEvent.CLICK, mainBooth_1);
    function mainBooth_i(MouseEvent):void {
                gotoAndStop(1);

    I allowed "debugging" and this is the error that appreared.  But I still don't get what the problem is or how to correct it.  Most of my content is in frame 1, so I don't understand why it's returning null.  Any advice would be appreciated.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at VB_NABR_fla::MainTimeline/frame1()[VB_NABR_fla.MainTimeline::frame1:93]

  • Trying to return a Hashtable object

    Hi,
    I'm trying to return a Hashtable object from a method defined as:
    public static Hashtable getValues(String str){
    In the calling method, I'm using:
    Hashtable<Object,Object> table=new Hashtable<Object,Object>();
    table=(Hashtable<Object,Object>)Test.getValues(str);
    I get the compiler warning as shown below:
    Note: App.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Upon compiling with -Xlint:unchecked option, I get:
    App.java:10: warning: [unchecked] unchecked cast
    found : java.util.Hashtable
    required: java.util.Hashtable<java.lang.Object,java.lang.Object>
    table=(Hashtable<Object,Object>)Test.getValues(str);
    ^
    How can I correct this?
    Thanks.
    Vijay

    were your method to return a Map<Object, Object> rather than a HashMapyou could transparently return either a HashMap or a HashTable - or anything else that implements the Map interface - without changing any of the code that actually calls this method. you will still, obviously, need to instantiate one inside the method
    hence the mantra "code to an abstraction, not a concrete type"

  • Problems when trying to return information for External Content Types in Sharepoint 2013

    This is my first post on the forum, until I tried on this problem but have not found anything.
    When trying to return the information from the external content displays the following error:
    Error retrieving data from mill. Administrators: query the server log for more information.
    I do not know what else to do...

    Hi,
    According to your post, my understanding is that you got an error when tried to return the information from the external content.
    Did the error occur when you created a new external content type or created a external list?
    You can check the steps with the following articles about how to create a external content type.
    http://lightningtools.com/bcs/creating-an-external-content-type-with-sharepoint-designer-2013/
    http://wyldesharepoint.blogspot.in/2012/12/sharepoint-2013-setting-up-external.html
    If the error occurred with the external list, you can check the steps with the following article.
    http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2013/01/08/how-to-create-external-data-column-in-sharepoint-2013.aspx
    You can also check the event log and ULS log to see if anything unexpected occurred.
    For SharePoint 2013, by default, ULS log is at      
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Build failed when trying to create a custom Android viewer

    I am experiencing the same issue, I get the : 'build failed. try again later' without any further information, when trying to create a custom viewer for android. Is this caused by server overloads or are there some things to check?
    Any help is appreciated! Thank you

    hey Bob,
    I did not before as I was assigned a mac that had everything running (untill now ), but to be sure I followed the steps just now using the keytool in terminal but looks like this is not making any differance.
    also, I can see the previous apps listed showing the download apk option, I have not been prompted for a certificate yet, where in iOS apps you are asked for it on save before the build starts and when you download the zip again if I'm not mistaking.
    Right now I always get the build faild error, try again later when I save the last step in the viewer creation process.

  • Windows 7 Professional PC hangs at "Loading files" when trying to boot with custom capture image on Windows Deployment Services.

    I have created a custom capture image in WDS. Now when I try to boot my reference PC into this image the PC hangs at "Loading files". The reference PC is running Windows 7 and I am using Windows Server 2012 Standard on my server.
    I have followed the instructions on how to create the custom capture image on the server to a fault. I PXE boot the PC and it shows the capture images after I hit F12. The problem is that it starts to boot and then hangs about 2/3 way through the progress
    bar.
    Any help would be appreciated.

    Hi Derrick Logan,
    We need know the detail phases your client hang, if it is irregular status, please collect the WDS log then post it. You can refer the following similar thread solution first.
    How to enable logging in Windows Deployment Services (WDS) in Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, and in Windows Server 2012
    http://support.microsoft.com/kb/936625/en-us
    Windows is loading files... Hangs on WDS
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/baacadc4-830d-43e1-ace8-3292e886958e/windows-is-loading-files-hangs-on-wds?forum=winserversetup
    WDS hangs at "Windows is loading files..." on a LAM jhl91 laptop
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/3ebb6e0b-9f05-4fee-b3c0-129c34bb879d/wds-hangs-at-windows-is-loading-files-on-a-lam-jhl91-laptop?forum=winserversetup
    I’m glad to be of help to you!
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Get an error when trying to add a new object!

    Post Author: zhaodifan
    CA Forum: Administration
    I was trying to add a new object from central management console and I got the following error:
    Retrieve Error
    There was an error while retrieving data from the server: Failed to read data from report file C:\WINNT\Temp\pres_report.rpt. Reason: Operation not yet implemented. File C:\WINNT\TEMP\tmpreport\~ci226c521bf2923e0.rpt.
    The report I am trying to add was running on a Linux box with the same version BusinessObjects Cyrstal 11 running. I want to move it to a Windows box... The report itself shouldn't have problems because it was running fine on the linux box...
    Also want you let you know that I don't know too much about Crystal Report and our Crystal Report admin quited his job last week! I will be very appreciated if anybody can give me any advice. Thank you!
    Difan

    If this is a Gmail account you might need to unlock by going here: https://accounts.google.com/DisplayUnlockCaptcha.

  • Operation failed when trying to Save a Custom Function to the Repository

    When attempting to save a Custom Function to the Repository in Crystal Reports XI R2, I get the following error message:
    "Operation failed: You do not have edit right on: "Default folder for custom functions".
    Where is the default folder for custom functions and how do I grant it the "Edit" right?
    Thanks,
    Jim

    Hi Jim,
    To give rights to a user or a group to save custom function in the Repository:
    1. Open the Business View Manager
    2. Logon to your BusinessObjects Enterprise as the Administrator
    3. In the "Repository Explorer",  right click on the "Custom Functions" folder, and in the contextual menu, select "Edit Rights"
    4. In the "Edit Rights" window, add the user or group that you want to give the right to save a custom function to the repository, and set the "Edit" right to "Granted". Finally, click on the "OK" button to accept the change.
    The user will then be able to save a Custom Function to the Repository in Crystal Reports XI R2.
    Also, note that it is important that the "Everyone" group "Edit" right isn't set to "Denied" as every user is part of the "Everyone" group.
    If the group "Everyone" is set to denied, it will take precedence to the user rights, so nobody will be able to save custom function. So ensure the "Everyone" group right is either set to "Inherited" or "Granted".

  • NoClassDefFoundError when trying to run an applet

    Hi,
    I'm new to java and am having a problem when I try to run an applet. It compiles OK, but when I try to run it using the appletviewer the console window shows this message:
    java.lang.NoClassDefFoundError: HelloApplet (wrong name: fund2/lesson1/HelloApplet)
    The last bit (fund2/lesson1) is the last bit of the path to the HelloApplet.
    and the applet window shows:
    Start: applet not initialized
    The code for the applet is:
    import java.applet.Applet;
    import java.awt.*;
    public class HelloApplet extends Applet {
         public void paint(Graphics graArg) {
              graArg.drawString("Hello World!", 50, 100);
    }The code for the html is:
    <html>
    <h1>Hello Applet Example</h1>
    <object code="HelloApplet.class"
            height=200
            width=300>
    </object>
    </html>Not even the H1 title appears in the applet window.
    The Classpath variable does contain the path to my applet folder and both the class and html files are in the same folder under this path.
    I hope someone can suggest where I'm going wrong as I've been tearing my hair out trying to get this working.
    Thanks in anticipation.
    Debbie-Leigh

    The H1 tag wouldn't appear in the applet anyway. It would appear in the HTML page itself. I think the appletviewer may ignore all non-applet markup though.
    The ".class" shouldn't be in the HTML. The code attribute refers to a class name, not the file name of the class. However I get the impression that the appletviewer and a lot of browsers just ignore the ".class", even though it's technically incorrect.
    I believe that the object tag doesn't take a code attribute. The code attribute is used in the applet tag. I suspect that's your problem. Look up and read the docs on this site re: proper use of the applet or object or embed or whatever the hell the tag you're supposed to use is, for details. I may be and probably am misremembering.

  • Remote object trying to return another remote object and a ClassCastExcepti

    I have a server running with a TreeModel (the tree model implements Remote). I also have the the TreeNodes all linked together on the server. Now, I can get to the TreeModel on the server and the root node of the remote tree model.
    treeModelStub = (treeModelIface)Naming.lookup(url+"remoteTM"); //works
    rootStub = (remoteTreeNodeIface)treeModelStub.getRoot(); //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild = (remoteTreeNodeIface)rootStub.getChildAt(index) //Does not work. "Exception in thread "main" java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown Source)
    The remote tree node method getChildAt returns TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends UnicastRemoteObject implements rdcaDataIface, Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is "+this.getClass()); // class is remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote {
    public TreeNode getChildAt(int idx) throws RemoteException;
    Any ideas why this does not work. Why can a remote object of type Object be returned just fine, but a TreeNode not be returned?
    Thank you for your help,
    Brent

    I have a server running with a TreeModel (the tree
    model implements Remote). I also have the the
    TreeNodes all linked together on the server. Now, I
    can get to the TreeModel on the server and the root
    node of the remote tree model.
    treeModelStub =
    (treeModelIface)Naming.lookup(url+"remoteTM");
    //works
    rootStub =
    (remoteTreeNodeIface)treeModelStub.getRoot();
    //works. The call to getRoot returns Object
    But when I call
    remoteTreeNodeIface aChild =
    (remoteTreeNodeIface)rootStub.getChildAt(index)******************************************
    can only be casted to rdcaDataIface. The returned object is an instanceof the rdcaDataIface_stub, which have nothing to do with TreeNode.
    //Does not work. "Exception in thread "main"
    java.lang.ClassCastException
    at remoteTreeNode_Stub.getChildAt(Unknown
    t(Unknown Source)
    The remote tree node method getChildAt returns
    TreeNode because the class implements TreeNode:
    public class remoteTreeNode extends
    UnicastRemoteObject implements rdcaDataIface,
    Comparable, TreeNode {
    public TreeNode getChildAt(int idx) {
    System.out.println("DEBUG: class is
    lass is "+this.getClass()); // class is
    remoteTreeNode
    return (remoteTreeNode)children.get(idx);
    The remote interface is defined as:
    public interface rdcaDataIface extends java.rmi.Remote
    public TreeNode getChildAt(int idx) throws
    ows RemoteException;
    Any ideas why this does not work. Why can a remote
    object of type Object be returned just fine, but a
    TreeNode not be returned?
    Thank you for your help,
    Brent

  • Photoshop CS5.1 crashes when trying to open Manage Custom Sizes in print window. Help??

    I have OS 10.10.2.  When printing and trying to access the "Manage Custom Sizes" in the print window, my Photoshop CS5.1 crashes.  I have not had problems up until now.  Not sure what changed. Can anyone help me figure this out?

    A preferences reset should fix it.
    Macintosh - CMD-SHIFT-OPTION immediately after you double-click the PS icon.
    Release those keys when you see the Delete Photoshop Settings dialog. Click "Yes" to do this.
    You may have to go into the CS5 application folder and directly double-click the Photoshop.app there.

  • Update failed when trying to update a nested object

    Hello,
    I have an enhanced class called NotifySession. It has a NotifySession type in it. When I try to update NotifySessionType in NotifySession from my transfer object, I get the following error:
    16:43:26,021 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract com.r911.core.dto.IBaseDTO com.r911.core.ejb.IBaseManager.execute(com.r911.core.dto.IBaseDTO) throws java.rmi.RemoteException,com.r911.exceptions.ApplicationException, causedBy:
    org.jboss.tm.JBossRollbackException: Unable to commit, tx_TransactionImpl:XidImpl [FormatId_257, GlobalId_scrdpc03//29, BranchQual_] status_STATUS_NO_TRANSACTION; - nested throwable: (kodo.util.FatalDataStoreException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'SessionType' when IDENTITY_INSERT is set to OFF. {prepstmnt 13784376 INSERT INTO dbo.SessionType (description, SessionTypeId) VALUES (?, ?) [params_(null) null, (int) 2]} [code_544, state_23000]
    NestedThrowables:
    com.solarmetric.jdbc.ReportingSQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'SessionType' when IDENTITY_INSERT is set to OFF. {prepstmnt 13784376 INSERT INTO dbo.SessionType (description, SessionTypeId) VALUES (?, ?) [params_(null) null, (int) 2]} [code_544, state_23000]
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'SessionType' when IDENTITY_INSERT is set to OFF.)
    at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:405)
    at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
    at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
    at org.jboss.ejb.Container.invoke(Container.java:700)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
    at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
    at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
    at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
    at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
    at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
    at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
    at $Proxy40.execute(Unknown Source)
    at com.r911.core.delegate.BaseDelegate.execute(BaseDelegate.java:50)
    at com.r911.core.actions.SessionAction.saveSession(SessionAction.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve..java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve..java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:228)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Unknown Source)
    Caused by: kodo.util.FatalDataStoreException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'SessionType' when IDENTITY_INSERT is set to OFF. {prepstmnt 13784376 INSERT INTO dbo.SessionType (description, SessionTypeId) VALUES (?, ?) [params_(null) null, (int) 2]} [code_544, state_23000]
    NestedThrowables:
    com.solarmetric.jdbc.ReportingSQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'SessionType' when IDENTITY_INSERT is set to OFF. {prepstmnt 13784376 INSERT INTO dbo.SessionType (description, SessionTypeId) VALUES (?, ?) [params_(null) null, (int) 2]} [code_544, state_23000]
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'SessionType' when IDENTITY_INSERT is set to OFF.
    at kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:42)
    at kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:24)
    at kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:507)
    at kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl.java:760)
    at kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:639)
    at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1291)
    at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:339)
    ... 74 more
    Caused by: com.solarmetric.jdbc.ReportingSQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'SessionType' when IDENTITY_INSERT is set to OFF. {prepstmnt 13784376 INSERT INTO dbo.SessionType (description, SessionTypeId) VALUES (?, ?) [params_(null) null, (int) 2]} [code_544, state_23000]
    at com.solarmetric.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:67)
    at com.solarmetric.jdbc.LoggingConnectionDecorator.access$400(LoggingConnectionDecorator.java:19)
    at com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:649)
    at com.solarmetric.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:361)
    at kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager..java:160)
    at kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager..java:89)
    at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:357)
    at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:154)
    at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:71)
    at kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:503)
    ... 78 more
    Can someone help me please. Basically all i'm wanting to update is the SessionTypeId field in my NotifySession Table. SessionTypeId relates to the NotifySessionType table.
    Did I not set something correctly in my metadata file?
    Thanks in advance,
    Kathy

    Hi Kim,
    In the database table there is a relationship with SessionTypeId .
    I used the kodo generation tools to generate all my enhanced classes so there is a Class relationship with my NotifySession Class
    Here is a snippet of my class
    * Auto-generated by:
    * kodo.jdbc.meta.ReverseMappingTool$ReverseCodeGenerator
    public class Session {
    ....<<other fields>>
    private SessionType sessionType;
    public Session() {
    public Session(int sessionId) {
    this.sessionId _ sessionId;
    public void setFromTransferObject(Session to) {
    this.setSessionName(to.getSessionName());
    <<set other fields>> _
    if (to.getSessionType()!_ null &&
    to.getSessionType().getSessionTypeId()>0)
    this.setSessionType(to.getSessionType);
    "Stephen Kim" <[email protected]> wrote in message news:c4aljb$ehr$[email protected]..
    How are you trying to set the relation? Is the relation virtual (i.e.
    just Id but no SessionType field) or concrete (a SessionType field) It
    looks like Kodo is trying to insert a new SessionType instance.
    Katherine Harrell wrote:
    Hello,
    I have an enhanced class called NotifySession. It has a NotifySession_
    type in it. When I try to update NotifySessionType in NotifySession
    from my transfer object, I get the following error:
    Can someone help me please. Basically all i'm wanting to update is the_
    SessionTypeId field in my NotifySession Table. SessionTypeId relates to_
    the NotifySessionType table.
    Did I not set something correctly in my metadata file?
    Thanks in advance,
    Kathy
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Java/lang/NoClassDefFoundError when trying to run my program in Eclipse

    I have a problem when using Eclipse. I can compile my classes in Eclipse without problems, but when I try to run the main class I get the following error message:
    Error occurred during initialization of VM
    java/lang/NoClassDefFoundError: java/lang/Object
    I have the same classpath setup when compiling and running the program. I am using JDK 1.3.1 and also have no problem running the program using javaw from a command prompt.
    Please answer if you have encountered this problem or have any idea what the problem might be.

    I start Eclipse using the exe file eclipse.exe with no special arguments.
    I use a JRE installed in e:\jdk1.3.1_01 so on the JRE page in the launch dialog box I have added a JRE with e:\jdk1.3.1_01\jre as the JRE home directory. This means that the JRE system library contain e:\jdk1.3.1_01\jre\lib\rt.jar. On the classpath page this JAR file is also listed as well as some other JAR files I use in my project.

  • Java.lang.NoClassDefFoundError when trying to start Weblogic service

    Hi,
    I'm using Weblogic 10.3.2 and have installed a service to start weblogic automatically. However, when I start the service I receive the NoClassDefFound. The error is below:
    [Wed Feb 03 16:03:04 2010] [RunJavaApp] Loading class - C:\PROGRA~1\Java\JDK16~1.0_1\jre\bin\server\jvm.dll
    java.lang.NoClassDefFoundError: C:\PROGRA~1\Java\JDK16~1/0_1\jre\bin\server\jvm/dll
    Caused by: java.lang.ClassNotFoundException: C:\PROGRA~1\Java\JDK16~1.0_1\jre\bin\server\jvm.dll
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

    Hi,
    I've gotten past this error, but I still can't start my Weblogic service. From what I can tell, there is something wrong with the PATH. I've set the path within the InstallSvc.cmd file, however, after it's installed, I checked the registry entry for the service, went to the path defined and tried to run java.exe.
    It does not work as there is no java.exe in the specified path. In the registry, the 'Path' parameter is set to 'D:\product\Oracle\11.1.1\Middleware\wlserver_10.3\server\bin' which is my weblogic home directory. Obviously, there is no java.exe in this directory, so this is normal behaviour. However, I would expect the 'Path' to be set as:
    Path=D:\product\Oracle\111~1.1\MIDDLE~1\patch_wls1032\profiles\default\native;D:\product\Oracle\111~1.1\MIDDLE~1\WLSERV~1.3\server\native\win\x64;D:\product\Ora
    cle\111~1.1\MIDDLE~1\WLSERV~1.3\server\bin;D:\product\Oracle\111~1.1\MIDDLE~1\modules\ORGAPA~1.0\bin;C:\PROGRA~1\Java\JDK16~1.0_1\jre\bin;C:\PROGRA~1\Java\JDK16
    ~1.0_1\bin;D:\product\Oracle\11.1.1\client\OraClient11g_home1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\product\Oracle\111~1.1\MIDDLE~1\WLS
    ERV~1.3\server\native\win\x64\oci920_8
    Above is what I set in the installSvc.cmd file. Maybe the 'Path' in the registry for the service has a different purpose than the 'PATH' parameter I specify above.
    Please note the Java home directory is specified in "8dot3" format. I am using version 1.6.0_18.
    Any help would be appreciated.
    Thank you.

Maybe you are looking for