UnsatisfiedLinkError - Trying to access a DLL from Java

I am trying to use the Java Native Interface (JNI) to run some C++ code from Java. I tried a simple test program to teach myself that, and it worked perfectly. However, now that I'm tackling a bigger project (A data acquisition program), I get an UnsatisfiedLinkError in the line that calls the function from the DLL.
Here is the stacktrace: Exception in thread "AWT-EventQueue-0" java.lang.Error: java.lang.reflect.Invoca
tionTargetException
        at org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAc
tion.java:859)
        at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(App
licationAction.java:665)
        at org.jdesktop.application.ApplicationAction.actionPerformed(Applicatio
nAction.java:698)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
95)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:236)
        at java.awt.Component.processMouseEvent(Component.java:6263)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
        at java.awt.Component.processEvent(Component.java:6028)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
        at java.awt.Container.dispatchEventImpl(Container.java:2085)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(App
licationAction.java:662)
        ... 26 more
Caused by: java.lang.UnsatisfiedLinkError: fileiotest.dllinterface.startget()V
        at fileiotest.dllinterface.startget(Native Method)
        at fileiotest.dllinterface.start_daq(dllinterface.java:26)
        at fileiotest.FileIOTestView.startrun(FileIOTestView.java:680)
        ... 31 moreI have made sure that the DLL is in the classpath, using both the -classpath tag and by setting the PATH variable. Is something wrong with my DLL itself, perhaps?

Yes, I have.
I didn't include the code yet because I thought if someone had similar trouble, there might be something obvious I am overlooking and they wouldn't even need to see the code. I can provide it, however.
This is the C++ DLL
// consoledaq.cpp : Defines the entry point for the console application.
#include <windows.h>                    /* Compiler's include files's */
#include <string.h>                  
#include <stdio.h>
#include "cbw.h"
#include "stdafx.h"
#include "dllinterface.h"
#include "jni.h" //can copy or give full path
#include <math.h>
BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
    return TRUE;
#define BOARD_NUM      0                /* Number of A/D board as defined with InstaCal */
#define BUF_SIZE       10048            /* Size of buffer */
#define NUM_SECS       10                /* Number of secs to collect data */
#define ADRANGE        BIP5VOLTS        /* A/D voltage range */
#define TIMER_NUM      1                /* Windows timer used by this program */
static HGLOBAL  MemHandle32;       
/* Variables for AinScan */
static unsigned short *ADValues;    /* Win32 pointer to A/D buffer */
static HGLOBAL   ADMemHandle;
static short     ADCurStatus;       /* Current status for D/A scan */
static long      ADCurCount;        /* Current count for A/D scan  */
static long      ADCurIndex;        /* Current index for A/D scan  */
int              ADOptions;
long       Count, Rate;
float      Voltage, Voltage2;
unsigned short CurValue, CurValue2;
JNIEXPORT void JNICALL
Java_daq_startget(JNIEnv *env, jobject obj)
     cbErrHandling (PRINTALL, STOPALL);  /* Set library's error handling */
     ADCurStatus = RUNNING;
     ADCurIndex = 0l;
     ADCurCount = 0l;
     /* Allocate A/D Windows buffer */
     ADMemHandle = cbWinBufAlloc ((long)BUF_SIZE);
     /* Allocate a local WIN32 buffer to hold A/D Data */
     MemHandle32 = GlobalAlloc(GMEM_FIXED | GMEM_DDESHARE, BUF_SIZE *sizeof(short));
     /* Get a 32-bit pointer to the A/D WIN32 buffer */
     ADValues = (unsigned short *)GlobalLock(MemHandle32);
     /* Start up background A/D scan */
     Count = BUF_SIZE;
     Rate = BUF_SIZE / (NUM_SECS * 2);
     ADOptions = BACKGROUND | CONTINUOUS;
     cbAInScan (BOARD_NUM, 0, 1, Count, &Rate, ADRANGE, ADMemHandle, ADOptions);
JNIEXPORT void JNICALL
Java_daq_stopget(JNIEnv *env, jobject obj)
     cbStopBackground(BOARD_NUM, AIFUNCTION);  /* Stop A/D subsystem background scan */
     if (ADMemHandle)                 
          cbWinBufFree (ADMemHandle);   /* Free allocated memory */
     if (MemHandle32)
          GlobalFree (MemHandle32);
JNIEXPORT jfloatArray JNICALL
Java_daq_getpoint(JNIEnv *env, jobject obj)
     jfloatArray theArray;
     if (ADCurIndex >= 0)
          /* Copy Data from memory to 32 bit memory buffer */
          cbWinBufToArray(ADMemHandle, &ADValues[ADCurIndex], ADCurIndex ,2);
          CurValue = ADValues[ADCurIndex];
          CurValue2 = ADValues[(ADCurIndex + 1)];
     else
          CurValue = 0;
          CurValue2 = 0;
     jfloat tmp[2];
     theArray =  env->NewFloatArray(2);
     cbToEngUnits(BOARD_NUM,ADRANGE,CurValue,&Voltage);                      
     cbToEngUnits(BOARD_NUM,ADRANGE,CurValue2,&Voltage2);
     tmp[0] = Voltage;
     tmp[1] = Voltage2;
     env->SetFloatArrayRegion(theArray, 0, 2, tmp);
     return theArray;
}And this is the Java class:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package fileiotest;
* @author Owner
public class dllinterface {
    public native void startget();
    public native float[] getpoint();
    public native void stopget();
    static {
     System.loadLibrary("daqdll");//This is firstJNI.DLL
     /*if generated by borland
     System.loadLibrary("firstjni");//This is firstjni.dll
    public static void start_daq()
        dllinterface DI=new dllinterface();
        DI.startget();
    public static void stop_daq()
        dllinterface DI=new dllinterface();
        DI.stopget();
    public static float[] get_data_point()
      dllinterface DI=new dllinterface();
      float newtempfloat[];
      newtempfloat = DI.getpoint();
      return newtempfloat;
}

Similar Messages

  • How to access vc dll with java

    I need to access vc dll with java. Now I only have *.h,*.lib, *.dll,no *.cpp,because the dll is from others. I cann't modify the *.cpp files for java. so what should I do .
    Best wishes.

    Create a JNI wrapper for rhe dll:
    1)Create a java class that defines methods that correspond to the methds in the c++ dll
    2)compile this, and compile it with the jni compiler to get the c++ header files.
    3)Create a C++ file that implements the methods defined in the header file, calling the c++ code as necesssary and using the JNI helpess to translate parameters from java form to C++ from.
    4)Perform any initialisation of th c++ dll by adding a DllMain() or equivalent under unix/linux
    5)create a makefile to build a dll from the above, linking to your import (.lib) library
    6)make sure both DLLs are with your java class files when you run the java app.

  • How to call dll from Java

    Hi everybody,
    I am trying to call a dll from my java application. Pls tell me how to do it, I seached and found JNI. Is it true
    pls help me and send me some examples
    Thank you and have a nice day

    java_and_me wrote:
    I am trying to call a dll from my java application. Pls tell me how to do it, I seached and found JNI. Is it trueYes, it is true. JNI is the way to go. You'll probably have to write some C code on your own as well, as the DLL is unlikely to be in the format expected by Java already.
    pls help me and send me some examplesOf course. [Here you are|http://www.lmgtfy.com/?q=JNI+tutorial].

  • Trying to access 10gr2 database from sqlplus utility but it connects to 11g

    Hi All,
    I am facing below issue while access 10gr2 database from sqlplus.
    I am having two oracle homes on one server one belongs to 11gr2 and another belongs to 10gr2.
    I want to access a 10gr2 database through sqlplus utility.but instaed of connecting to 10gr2 it is connecting to 11gr2 after I enter a user name and passowrd.
    I have set all the env variables such as oracle_home ,oracle_sid and path with respect to Oracle 10gr2.
    Can you please let me kno what I need to do to connect to 10gr2 database and not 11gr2 database through sql plus.
    Let me know if I need to give any more details on this.
    Best Regards,
    Dipti S

    Hi Rocky,
    I got the resolution.
    I made a mistake by creating an oracle instance/service(e.g. fsdmo) when Oracle_home was pointing to 11gR2 Directory.so that service was refering to 11gr2 oracle home.
    hence when I was setting oracle_sid(fsdmo) and trying to access database instance from 11g sqlplus utility ,it was directing to 11g and not 10g since oracle service was pointing to 11g.
    So now after chnaging the oracle home directory to 11g,I am creating a service and its working fine.
    thank you so much for responding.
    hope I am clear with my reply.
    Best Regards,
    Dipti S

  • I have a MacBook purchased in 2009 with Snow Leopard. I tried to access "special characters" from the Finder menu and an intermittent blank pop ups and will not stop. It also happens when I run Word or Pages.

    The blank pop up began as I tried to access "special characters" from the finder menu. I restarted, turned off and restarted and it did not work. It interferes with any application because I cannot work fast. Every new step takes a few seconds longer such as saving, finding text, check spelling and many more. I am desperate to solve this. Thanks in advance for any help given.
    Consuelo Corretjer

    Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
    This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps.

  • Calling back c++ method in an exe (not a dll) from java?

    Hi all,
    I have to make an hybrid C++/java from an existing C++
    application that compiled is a big single exe not a dll.
    I'm running under win32.
    The application consists of several windows. The hybrid
    will have widows in C++ and some in java. They have the
    same menu and tool bar. In the C++, there are some
    callbacks called when a button is pressed. How to call
    these callback from java given the fact that the JVM and
    the java classes are launched by the exe file.
    I know how, from C++, start JVM and call my java window.
    I also know how to call a C++ method that is in a dll from
    java. It's from the tutorial
    http://java.sun.com/docs/books/tutorial/native1.1/index.html
    But I don't know how to call a C++ method that is in in an
    exe which has launch a JVM from an object running in this
    JVM.
    Is there somewhere an example like this?
    Thanks,
    Xavier.

    Thanks this helped.
    For those who want a complete example, here it is:
    Tested on XP, java 1.4.2, VC++ 6.0.
    ************ File invoke.cpp *****************************
    #include <stdlib.h>
    #include <jni.h>
    #ifdef _WIN32
    #define PATH_SEPARATOR ';'
    #else /* UNIX */
    #define PATH_SEPARATOR ':'
    #endif
    #define USER_CLASSPATH "." /* where Prog.class is */
    void JNICALL displayHelloWorld(JNIEnv *env, jobject obj)
        printf("Hello world: made by printf from C++\n");
        return;
    void main() {
        JNIEnv *env;
        JavaVM *jvm;
        JavaVMInitArgs vm_args;
        jint res;
        jclass cls;
        jmethodID mid;
        jstring jstr;
        jobjectArray args;
        char classpath[1024];
         int result;
        /* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
         JavaVMOption options[3];
         options[0].optionString = "-verbose:gc";
         sprintf (classpath, "-Djava.class.path=%s", USER_CLASSPATH);
         options[1].optionString = classpath;
         options[2].optionString = "-Djava.compiler=NONE";
         vm_args.options = options;
         vm_args.nOptions = 3;
         vm_args.ignoreUnrecognized = JNI_TRUE;
            vm_args.version = JNI_VERSION_1_4;
         /* IMPORTANT: Note that in the Java 2 SDK, there is no longer any need to call
          * JNI_GetDefaultJavaVMInitArgs. It causes a bug
        /* Append USER_CLASSPATH to the end of default system class path */
        /* Create the Java VM */
        res = JNI_CreateJavaVM(&jvm,(void**)&env, &vm_args);
        if (res < 0) {
            fprintf(stderr, "Can't create Java VM\n");
            exit(1);
        cls = env->FindClass("mypackage/Prog");
        if (cls == 0) {
            fprintf(stderr, "Can't find mypackage/Prog class\n");
            exit(1);
       JNINativeMethod nm;
       nm.name = "displayHelloWorld";
       /* method descriptor assigned to signature field */
       nm.signature = "()V";
       nm.fnPtr = displayHelloWorld;
       env->RegisterNatives(cls, &nm, 1);
        mid = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
        if (mid == 0) {
            fprintf(stderr, "Can't find Prog.main\n");
            exit(1);
        jstr = env->NewStringUTF(" from C++! calleded by C++, using argument from C++ but java method");
        if (jstr == 0) {
            fprintf(stderr, "Out of memory\n");
            exit(1);
        args = env->NewObjectArray(1,
                            env->FindClass("java/lang/String"), jstr);
        if (args == 0) {
            fprintf(stderr, "Out of memory\n");
            exit(1);
        env->CallStaticVoidMethod(cls, mid, args);
        jvm->DestroyJavaVM();
    }********************* File ./mypackage/Prog.java **************************
    package mypackage;
    public class Prog {
           public native void displayHelloWorld();
        public static void main(String[] args) {
            System.out.println("Hello World" + args[0] +"\n");
            Prog prog = new Prog();
            prog.displayHelloWorld();
            System.out.println("(called from java)");
            System.out.println("\nSo to sumurize:");
            System.out.println(" -1 Starting point is an exe (not DLL, there is no DLL) so C++ code");
            System.out.println(" -2 From C++ call java method using argument from C++");
            System.out.println(" -3 From java, that was launched by the exe, call to");
            System.out.println("    a native using the RegisterNatives in C++\n");
            System.out.println("You got a bidirectional example with as starting point");
            System.out.println("a single exe, launching JVM, loading class call back C++!");
    }******************* Command line for all ****************************************
    javac mypackage/Prog
    cl -I"D:\Program Files\j2sdk1.4.2_03\include" -I"D:\Program Files\j2sdk1.4.2_03\include\win32" -MT
    invoke.cpp -link D:\PROGRA~1\j2sdk1.4.2_03\lib\jvm.lib
    (Remark, the last path is using the short name for "Program Files" because with the blank
    even adding double quotes result into an error)
    You must have jvm.dll in your path for me it's Path=D:\Program Files\j2sdk1.4.2_03\jre\bin\client;
    Then simply call invoke and see the result. :-)

  • Fall into a trouble when calling a dll from java in linux

    Hi, experts:
    I encountered a big trouble when using JNI to call a C++-compiled DLL from java in Linux: The DLL function didn't execute immediately after the invocation, and was deferred till the end of the Java execution. But all worked well after migrating to windows. This problem made me nearly crazy. Can somebody help me? Thanks in advance.
    Linux: fedora core 8, jdk1.6.0_10,
    compile options: g++ -fPIC -Wall -c
    g++ -shared

    It looks like the OP compiled the C source file and linked it into a Windows .dll, which would explain why it worked flawlessly in Windows. (Though I must say the usage of GCC would make someone think it was compiled in Linux for Linux, GCC also exists for Windows, so I'm not sure it's a Windows .dll either...)
    @OP: Hello and welcome to the Sun Java forums! This situation requires you to make both a .dll and a .so, for Windows and Linux. You can then refer to the correct library for the operating system using System.loadLibrary("myLibrary"); without any extension.
    s
    Edited by: Looce on Nov 21, 2008 11:33 AM

  • To call a VB dll from java

    Hi,
    I want to know how one can call a VB dll from Java.I know it is something like calling a C dll which in turn calls the VB dll.I also went through the tutorial provided on the sun site and was able to call a C dll through java but I still do not know how to call a VB dll from java.
    regards,
    Anshuman

    Have you checked google?
    First hit. Reply 17.

  • I am trying to access tax forms from the IRS.  I download them to my comuter and they read fine (version XI).  However, when iItry to open them on another computer (version 4) they will not open.  Version 4 opens all other documents fine, just no the ones

    I am trying to access tax forms from the IRS.  I download them to my comuter and they read fine (version XI).  However, when iItry to open them on another computer (version 4) they will not open.  Version 4 opens all other pdf documents fine, just not the ones from the IRS.  Any ideas?

    Version 4 is oh so old.
    The IRS and many other providers of forms are using products like LIveCycle which require at least version 7.05.
    Saving, Filling, and Printing PDF Files
    We use Adobe Acrobat PDF files as a means to electronically provide forms & publications. You will need to have the Adobe Reader software installed to access them (available FREE from the Adobe Reader download page on Adobe's Web site). We recommend using the most recent version of Adobe Reader.

  • XMLAnalysis Error while trying to execute a MDX query on MS SSAS - Accessing the cube from Java through Olap4j driver

     Am trying to access MS SSAS data cube from Java through olap4j driver(through msmdpump.dll). I am able to connect , but when I try to execute a query, i am getting the below error: Please help
    me out . (I tested the http://XXXX/OLAP/msmdpump.dll in MS Excel , and it is working fine)
    org.olap4j.OlapException: XMLA provider gave exception: <soap:Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>
    XMLAnalysisError.0xc10a0004
    </faultcode>
    <faultstring>
    The CRASHDWHSRG cube either does not exist or has not been processed.
    </faultstring>
    <detail>
    <Error Description="The CRASHDWHSRG cube either does not exist or has not been processed." ErrorCode="3238658052" HelpFile="" Source="Microsoft SQL Server 2012 Analysis Services">
    </Error>
    </detail>
    </soap:Fault>

    See my other answer where you asked this same question on another thread
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22dfc400-668d-4bd4-b76d-7c6b9ddda47a/msmdpumpdll-not-getting-registered?forum=sqlanalysisservices
    http://darren.gosbell.com - please mark correct answers

  • How to access data structures in C dll from java thru JNI?

    We have been given API's( collection of C Functions) from some vendor.
    SDK from vendor consist of:
    Libpga.DLL, Libpga.h,Libpga.lib, Along with that sample program Receiver.h (i don't know its written in C or C++), I guess .C stnads for C files?
    Considering that I don't know C or C++ (Except that I can understand what that program is doing) & i have experience in VB6 and Java, In order to build interface based on this API, I have two option left, Use these dll either from VB or Java.
    As far as I know, calling this DLL in VB requires all the data structures & methods to be declared in VB, I guess which is not the case with Java (? I'm not sure)
    I experiemnted calling these function from Java through JNI, and I successfully did by writting wrapper dll. My question is whether I have to declare all the constants & data structures defined in libpga.h file in java, in order to use them in my java program??
    Any suggesstion would be greatly appreciated,
    Vini

    1. There are generators around that claim to generate suitable wrappers, given some dll input. I suggest you search google. Try JACE, jni, wrapper, generator, .... Also, serach back through this forum, where there have been suggestions made.
    2. In general, you will need to supply wrappers, and if you want to use data from the "C side" in java, then you will need java objects that hold the data.

  • Call a C# dll from java is work only with the machine which is build C# dll

    hi all,
    I've built a VC++(win32 console dll app)..
    Created a Java program to access the said VC++ dll
    It was successful in the machine(say machine 1) which is created the VC++ dll..But Not work with machine2
    n.b VC++ dll is accessing another VC#dll
    If I combile the VC++ dll in machine2 then then its works fine with machine2 while access from java But not work with machine1
    Problem comes when I run the same application in a different system where all the
    needed visual studio files are installed...
    I tried by create the VC++ dll with skipping the part of accessing VC# dll, then it works fine with anotther machine
    NB: error accurs only when it is run on a different machine...
    Error is:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # Internal Error (0xe06d7363), pid=4024, tid=4028
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_09-b01 mixed mode, sharing)
    # Problematic frame:
    # C [kernel32.dll+0x1eb33]
    # An error report file with more information is saved as hs_err_pid4024.log
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    i've done "googling" with this error... but no one has come up with some satisfactory answer...
    Pls help.....
    conf. of both machine
    Windows XP
    jdk1.5.0_09, jre1.5.0_09
    thanks in advance..

    Normally any system exception that occurs when working with JNI is caused by one of the following.
    - pointer problems
    - incorrect usage of another api
    - bug in the api being used.
    The last two are often still pointer problems.
    The fact that it ones one machine and not another makes it more likely it is a pointer problem (in one or more of the above.)
    A pointer problem cause cause the system to fail long after the point where the bug actually is (coded.) Different execution paths, such as running on different machines, means the bug will manifest itself differently.

  • Security exception when trying to call a DLL from an applet

    Hi all,
    I really hope someone out there can help me. I'm trying to call a windows DLL from an applet but always get some error when the call to the DLL comes. If I run it on the command line (calling a dummy main function that only calls the dll) I don't get any error. However, with the -Djava.security.manager, I get an ExceptionInitialiserError. When running it in a browser, I seem to get any of three errors, the above, securityAccessControlException (as I was expecting) and even NoClassDefFoundError.
    I realise of course that this has to do with the permissions in effect but nothing seems to happen when I change the policy file, so I have to feeling that I'm chaning the wrong file. The one I'm using is the one the JRE entry in the registry is pointing to, Java Runtime Environment->CurrentVersion...
    I even tried giving everything in the applet's directory AllPermission.
    So what I'm wondering is this. Is there any way to check if your policies are actually working and when you update the files, what do you need to do to make the changes take effect?
    Best regards,
    G�sli

    I have the same problem. Have you solved your problem, if so please let me know what the solution is.
    Einar �rn

  • Column Not found error while trying to access database through JSP+Java Bea

    I am trying to access MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the database is incorporated in the bean.The JSP only calls the particular method of the bean .
    Code for Java Bean:
    package ActiveViewer;
    import java.sql.*;
    import java.util.*;
    public class CompanyBean
    Connection con;
    ResultSet rs=null;
    Statement st;
    public CompanyBean(){}
    public void connect()
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Here4");
    con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
    System.out.println("Here1");
    catch (ClassNotFoundException e)
    System.out.println("Could not locate driver.");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An unknown Exception has occured :: "+e);
    e.printStackTrace();
    public void disconnect()
    try
    if (con!=null)
    con.close();
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    public ResultSet select(String username)
    if(con!=null)
    try
    st=con.createStatement();
    rs=st.executeQuery("select * from company where username='" + username + "'");
    catch (SQLException e)
    System.out.println("An SQL Exception has occured :: "+e);
    e.printStackTrace();
    catch (Exception e)
    System.out.println("An Exception has occured while retrieving :: "+e);
    e.printStackTrace();
    else
    System.out.println("Connection to database was lost.");
    return rs;
    The code for JSP that uses the above bean is:
    <%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
    <jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
    <html>
    <body>
    <% String username=request.getParameter("username");
    String password=request.getParameter("password");
    System.out.println("username:"+username);
    System.out.println("password:"+password);
    conn.connect();
    ResultSet rs=conn.select(username);
    System.out.println("Below select ");
    while (rs.next())
    String dbusername=rs.getString("username");
    String dbpassword=rs.getString("password");
    if(dbusername.equals(username) && dbpassword.equals (password))
    { %> out.println("OK");
    <% }
    else { %>Invalid Username and / or Password.
    <br>Clickhere to go back to Login Page.
    <% }
    } %>
    </body>
    </html>
    I get the following error:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Column not found
    though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
    Here4 (from connect method above)
    Here 1 (from connect method above)
    Below Select (from jsp)
    This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
    All other things like creating package for bean in WEB-INF/classes,incorporating the packakage are done.
    Can someone please help me with their precious advice?

    Hi, I too have a problem with an SQL exception, the message is Column not found.
    I'm using the sun jdbc odbc driver with access.
    the first few lines of the stack trace are
    sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1852)
    sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
    net.homeip.sdaniels.MemberBean.ejbFindByUnamePwd(MemberBean.java:127)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    I am of course sure that the column does infact exist. I can insert into the column no problems. the sql looks like this:
    SELECT * FROM Members WHERE uName ='Stewart' AND encPwd='�F2C�3����h�1Y�'
    Can any one tell me if there is a common cause to this problem?
    Thanks

  • "access denied" error from Java Web Start

    I can successfully download the jar file, but always have error message "access denied" when the java application tries to open a local file in C:\temp\poc1.xml.
    I can successfully execute the java application from DOS,but failed when using Java Web Start. The error message is as follows:
    Java Web Start Console, started Wed Nov 28 16:30:31 PST 2001Java 2 Runtime Environment: Version
    1.3.1 by Sun Microsystems Inc.java.security.AccessControlException: access denied
    (java.io.FilePermission C:\temp\poc1.xml read)     at
    org.apache.xerces.framework.XMLParser.parse(Unknown Source)     at
    org.apache.xerces.framework.XMLParser.parse(Unknown Source)     at
    com.hotlocker.client.HLSessionParser.parse(Unknown Source)     at
    com.hotlocker.client.UploadDownloadClient.uploadFiles(Unknown Source)     at
    com.hotlocker.client.UploadDownload.main(Unknown Source)     at
    java.lang.reflect.Method.invoke(Native Method)     at
    com.sun.javaws.Launcher.executeApplication(Unknown Source)     at
    com.sun.javaws.Launcher.executeMainClass(Unknown Source)     at
    com.sun.javaws.Launcher.continueLaunch(Unknown Source)     at
    com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)     at
    com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)     at
    com.sun.javaws.Launcher.run(Unknown Source)     at java.lang.Thread.run(Unknown Source)

    Hi,
    you can't get a file like in a "normal" app
    because a JWS-app runs in the restricted
    sandbox environment by default.
    So you either sign your app with a digital certificate
    or you use a special FileOpenService (JNLP-API).
    You could also put the file into the app-jar and
    load it by a classloader.
    Regards,
    Mathias

Maybe you are looking for

  • Lack of music/apps in South Africa

    I know this topic has been discussed before, yet there never seems to be a satisfactory answer. http://www.thyon.com/blog-entry/items/apples-lack-of-games-music-movies-tv-in-so uth-africa.html The lack of availability of music, games and other apps o

  • How does Delete overlapping requests work?

    We have a extract which does a full loads into a cube for the current year and a we run this daily. In the process chain we do a delete overlapping requests which I understand will delete the previous requests with the same condition. What happens wh

  • Eastern European characters in PDF report

    Hi. I have successfully integrate Apache FOP into APEX as per http://www.oracle.com/technology/products/database/application_express/html/configure_printing.html document. The only problem (for now) I have is displaying eastern european characters in

  • Buttons on toolbar do not work in Microsoft Office 2003 programs.

    I am using Adobe Acrobat Elements 6.0.  My toolbar buttons do not work in any of my Microsoft Office 2003 programs.  I can Print file and change the print file to Adobe PDF to convert, but it would be nice to be able to use these buttons on the tool

  • IWork 09 installed via CD-ROM does not appear in app store as "installed"

    I have a legal copy of iWork 09 installed via CD-ROM, it does not appear as "installed" in the app store. Any idea why?