Loading a library in my own class...

Hello,
I'm having some problems with loading my own library into a different class then the main, but I'm keep getting this error message:
run:
Exception in thread "main" java.lang.UnsatisfiedLinkError: cembedjava.CFunctions.nativePrint()V
        at cembedjava.CFunctions.nativePrint(Native Method)
        at cembedjava.Main.main(Main.java:17)
Java Result: 1The project is based around the tutorial for including some C code in a Java application. I'm working with an Ubuntu 8.10 distro, Netbeans IDE 6.1 and JDK 6 update 11. I'm new to Java programming, but I have experience with C, Delphi and Basic in different flavours.
The C code is working as it supposed to be (at least, I think, I had it running under the main class). The code implements a timer in C with an interval period of 1,5 seconds, which returns a message every time to the screen (or app). What's going wrong in the following code?
package cembedjava;
public class CFunctions
     public native void nativePrint(); 
     static {
       System.load("/home/richard/NetBeansProjects/HelloWorldNative/dist/libHelloWorldNative.so");
      // System.loadLibrary("libHelloWorldNative");
package cembedjava;
import java.lang.Thread;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
    public static void main(String[] args) {
        // TODO code application logic here
       CFunctions obj = new CFunctions();
       obj.nativePrint();
}Or do I need a new thread to keep my timer running?
Thanks

Thanks guys,
I got it working... I had a problem with the declaration of the function in my .h and .c file. In the .h file everything was okay, but I had the wrong classname in the .c file. For some reason this still compiled but gave me the exception during runtime.
Is there also a possibility not to have to put in the class name in the function declaration, right now the function are declared as this:
JNIEXPORT void JNICALL Java_cembedjava_CFunctions_nativePrint
      (JNIEnv *env, jobject obj)
With the CFunctions as class name en cembedjava as project name of the Java project. Is it possible to call my functions in a project and class that don't have the above stated names?

Similar Messages

  • Failed to load ODBC library symbol: /export/home/odbc/ODBC60/lib/libodbc.so

    I've been trying to create a database link from a MySQL database to Oracle using the Oracle dg4odbc gateway. I downloaded and installed DataDirect's ODBC package which includes mysql ODBC library (ddmysql24.so) and a generic ODBC libary (libodbc.so). After creating the DSN in odbc.ini, I tested it and it can connect to the mysql database. Then I created the init{SID}.ora file in hs/admin directory, added dg4odbc lines in the listener.ora, and added lines in tnsnames.ora. Then I tnspinged the new SID with success. Finally, I created the database link. However, when I tried to access the database, I got the ORA-28500 error. In the trace log, I found the following:
    Entered hgolofns at 2009/11/01-06:27:20
    libname=/export/home/odbc/ODBC60/lib/libodbc.so, funcname=SQLAllocHandle
    hoaerr:28500
    Exiting hgolofns at 2009/11/01-06:27:20
    Failed to load ODBC library symbol: /export/home/odbc/ODBC60/lib/libodbc.so(SQLAllocHandle)
    Exiting hgolofn, rc=28500 at 2009/11/01-06:27:20
    Exiting hgoinit, rc=28500 at 2009/11/01-06:27:20 with error ptr FILE:hgoinit.c LINE:282 ID:Loading ODBC aray of function ptrs
    Entered hgoexit at 2009/11/01-06:27:20
    I searched the functions within libodbc.so and found all the SQLAlloc* functions in this library. Why do I still get the error?
    Thanks for your help. Jeffrey
    Here's the entire trace log:
    Oracle Corporation --- SUNDAY NOV 01 2009 06:27:20.637
    Version 11.1.0.6.0
    Entered hgogprd
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "4"
    Entered hgosdip
    setting HS_OPEN_CURSORS to default of 50
    setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
    setting HS_FDS_RECOVERY_PWD to default value
    setting HS_FDS_TRANSACTION_LOG to default of "HS_TRANSACTION_LOG"
    setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
    setting HS_NLS_NCHAR to default of "AL32UTF8"
    setting HS_FDS_TIMESTAMP_AS_DATE to default of "TRUE"
    setting HS_RPC_FETCH_REBLOCKING to default of "ON"
    setting HS_FDS_FETCH_ROWS to default of "100"
    setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
    setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
    setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
    setting HS_FDS_MAP_NCHAR to default of "TRUE"
    setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
    setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
    setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
    setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
    setting HS_FDS_QUERY_DRIVER to default of "TRUE"
    HOSGIP returned value of "FALSE" for HS_FDS_SUPPORT_STATISTICS
    setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStat
    istics"
    Exiting hgosdip, rc=0
    ORACLE_SID is "MOODLE"
    Product-Info:
    Port Rls/Upd:6/0 PrdStat:0
    Agent:Oracle Database Gateway for ODBC
    Facility:hsa
    Class:ODBC, ClassVsn:11.1.0.6.0_0006, Instance:MOODLE
    Exiting hgogprd, rc=0
    Entered hgoinit
    HOCXU_COMP_CSET=1
    HOCXU_DRV_CSET=10
    HOCXU_DRV_NCHAR=873
    HOCXU_DB_CSET=873
    HOCXU_SEM_VER=102000
    Entered hgolofn at 2009/11/01-06:27:20
    HOSGIP for "HS_FDS_SHAREABLE_NAME" returned "/export/home/odbc/ODBC60/lib/libodbc.so"
    Entered hgolofns at 2009/11/01-06:27:20
    libname=/export/home/odbc/ODBC60/lib/libodbc.so, funcname=SQLAllocHandle
    hoaerr:28500
    Exiting hgolofns at 2009/11/01-06:27:20
    Failed to load ODBC library symbol: /export/home/odbc/ODBC60/lib/libodbc.so(SQLAllocHandle)
    Exiting hgolofn, rc=28500 at 2009/11/01-06:27:20
    Exiting hgoinit, rc=28500 at 2009/11/01-06:27:20 with error ptr FILE:hgoinit.c LINE:282 ID:Loading ODBC aray of function ptrs
    Entered hgoexit at 2009/11/01-06:27:20

    on which platform did you install DG4ODBC? On a 64bit? In this case did you install the 64bit DD ODBC driver?
    What is the output of: file dg4odbc
    and: file /export/home/odbc/ODBC60/lib/libodbc.so
    can you also please clarify your statement: .. and a generic ODBC libary (libodbc.so). Datadirect ODBC drivers come with their own driver manager ... and you have to use their driver manager with their drivers.

  • Servicegen:  unable to load type library from classloader weblogic.utils.cl

    Hi,
    I am new to weblogic. I am encountering an error on trying to run the 'servicegen' command from my ant build scripts, on weblogic 9.2.
    Please find the build.xml snapshot, and the stack trace given below.
    Please help me out with this.
    Points to be noted are:-
    1) The ejb-jar.xml specifies the bean class, which is very much present in the classpath. The ejb-jar.xml is generated by xdoclet. Snapshot is given below:-
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description><![CDATA[No Description.]]></description>
    <display-name>Generated by XDoclet</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <description><![CDATA[NorthBound Interface]]></description>
    <ejb-name>ArcorNBIService</ejb-name>
    <home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceHome</home>
    <remote>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService</remote>
    <local-home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocalHome</local-home>
    <local>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocal</local>
    <ejb-class>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    2) When I replace the "ejbJar" attribute in the 'service' command with "javaClassComponents" attribute, I am able to run the servicegen command successfully. Not sure why the ejbJar is creating problems.
    3) Build.xml snapshot:-
         <target name="gen-webservice" depends="init">
              <copy todir="${work.dir}" file="${export.dir}/lib/arcor-il-service-ejb.jar"/>
              <autotype javatypes="${javatypes}" targetNamespace="${targetNamespace}" destDir="${work.dir}/classes" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath"/>
              <autotype javaComponents="com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService" targetNamespace="com.alcatel.hdm.service.nbi.dto.holders" destDir="${work.dir}/classes" keepGenerated="true" classpathref="webservice.client.classpath"/>
              <servicegen destEar="${earfile}" warName="${warname}" contextURI="${contextURI}" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath">
                   <service ejbJar="${ejbLocation}" targetNamespace="${targetNamespace}" serviceName="${serviceName}" serviceURI="/${serviceName}" generateTypes="false" expandMethods="${expandMethods}" ignoreAuthHeader="false" protocol="https" style="rpc" useSOAP12="${useSOAP12}" typeMappingFile="${work.dir}/classes/types.xml">
                        <security enablePasswordAuth="true"/>
                   </service>
              </servicegen>
         </target>
    4) Exception stacktrace:-
    --- Nested Exception ---
    java.lang.AssertionError: java.io.IOException
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:42)
    at weblogic.descriptor.DescriptorManager.getDefaultMF(DescriptorManager.java:116)
    at weblogic.descriptor.DescriptorManager.getMarshallerFactory(DescriptorManager.java:125)
    at weblogic.descriptor.DescriptorManager.getDescriptorFactory(DescriptorManager.java:153)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:277)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:248)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:309)
    at weblogic.descriptor.EditableDescriptorManager.createDescriptor(EditableDescriptorManager.java:99)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:344)
    at weblogic.application.descriptor.CachingDescriptorLoader.createDescriptor(CachingDescriptorLoader.java:188)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:328)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getDescriptor(AbstractDescriptorLoader.java:237)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getRootDescriptorBean(AbstractDescriptorLoader.java:217)
    at weblogic.ejb.spi.EjbJarDescriptor.getEjbJarBean(EjbJarDescriptor.java:141)
    at weblogic.ejb.spi.EjbJarDescriptor.getEditableEjbJarBean(EjbJarDescriptor.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.processEjbJarXMLWithSchema(DDUtils.java:519)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:126)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:154)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:147)
    at weblogic.ejb.spi.DDUtils.createDescriptorFromJarFile(DDUtils.java:30)
    at weblogic.webservice.dd.EJBJarIntrospector.<init>(EJBJarIntrospector.java:52)
    at weblogic.ant.taskdefs.webservices.autotype.EJBAutoTyper.<init>(EJBAutoTyper.java:68)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.runAutoTyper(ServiceGenTask.java:339)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.generateService(ServiceGenTask.java:313)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.execute(ServiceGenTask.java:181)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    at org.apache.tools.ant.Main.runBuild(Main.java:668)
    at org.apache.tools.ant.Main.startAnt(Main.java:187)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
    Caused by: java.io.IOException
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:50)
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:40)
    ... 37 more
    Caused by: com.bea.xml.XmlException: unable to load type library from classloader weblogic.utils.classloaders.ClasspathClassLoader@1cc0a7f f
    inder: weblogic.utils.classloaders.CodeGenClassFinder@c52200 annotation:
    at com.bea.staxb.runtime.internal.BindingContextFactoryImpl.createBindingContext(BindingContextFactoryImpl.java:50)
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:48)
    ... 38 more
    Total time: 5 seconds

    Hi,
    I am new to weblogic. I am encountering an error on trying to run the 'servicegen' command from my ant build scripts, on weblogic 9.2.
    Please find the build.xml snapshot, and the stack trace given below.
    Please help me out with this.
    Points to be noted are:-
    1) The ejb-jar.xml specifies the bean class, which is very much present in the classpath. The ejb-jar.xml is generated by xdoclet. Snapshot is given below:-
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description><![CDATA[No Description.]]></description>
    <display-name>Generated by XDoclet</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <description><![CDATA[NorthBound Interface]]></description>
    <ejb-name>ArcorNBIService</ejb-name>
    <home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceHome</home>
    <remote>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService</remote>
    <local-home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocalHome</local-home>
    <local>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocal</local>
    <ejb-class>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    2) When I replace the "ejbJar" attribute in the 'service' command with "javaClassComponents" attribute, I am able to run the servicegen command successfully. Not sure why the ejbJar is creating problems.
    3) Build.xml snapshot:-
         <target name="gen-webservice" depends="init">
              <copy todir="${work.dir}" file="${export.dir}/lib/arcor-il-service-ejb.jar"/>
              <autotype javatypes="${javatypes}" targetNamespace="${targetNamespace}" destDir="${work.dir}/classes" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath"/>
              <autotype javaComponents="com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService" targetNamespace="com.alcatel.hdm.service.nbi.dto.holders" destDir="${work.dir}/classes" keepGenerated="true" classpathref="webservice.client.classpath"/>
              <servicegen destEar="${earfile}" warName="${warname}" contextURI="${contextURI}" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath">
                   <service ejbJar="${ejbLocation}" targetNamespace="${targetNamespace}" serviceName="${serviceName}" serviceURI="/${serviceName}" generateTypes="false" expandMethods="${expandMethods}" ignoreAuthHeader="false" protocol="https" style="rpc" useSOAP12="${useSOAP12}" typeMappingFile="${work.dir}/classes/types.xml">
                        <security enablePasswordAuth="true"/>
                   </service>
              </servicegen>
         </target>
    4) Exception stacktrace:-
    --- Nested Exception ---
    java.lang.AssertionError: java.io.IOException
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:42)
    at weblogic.descriptor.DescriptorManager.getDefaultMF(DescriptorManager.java:116)
    at weblogic.descriptor.DescriptorManager.getMarshallerFactory(DescriptorManager.java:125)
    at weblogic.descriptor.DescriptorManager.getDescriptorFactory(DescriptorManager.java:153)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:277)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:248)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:309)
    at weblogic.descriptor.EditableDescriptorManager.createDescriptor(EditableDescriptorManager.java:99)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:344)
    at weblogic.application.descriptor.CachingDescriptorLoader.createDescriptor(CachingDescriptorLoader.java:188)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:328)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getDescriptor(AbstractDescriptorLoader.java:237)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getRootDescriptorBean(AbstractDescriptorLoader.java:217)
    at weblogic.ejb.spi.EjbJarDescriptor.getEjbJarBean(EjbJarDescriptor.java:141)
    at weblogic.ejb.spi.EjbJarDescriptor.getEditableEjbJarBean(EjbJarDescriptor.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.processEjbJarXMLWithSchema(DDUtils.java:519)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:126)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:154)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:147)
    at weblogic.ejb.spi.DDUtils.createDescriptorFromJarFile(DDUtils.java:30)
    at weblogic.webservice.dd.EJBJarIntrospector.<init>(EJBJarIntrospector.java:52)
    at weblogic.ant.taskdefs.webservices.autotype.EJBAutoTyper.<init>(EJBAutoTyper.java:68)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.runAutoTyper(ServiceGenTask.java:339)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.generateService(ServiceGenTask.java:313)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.execute(ServiceGenTask.java:181)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    at org.apache.tools.ant.Main.runBuild(Main.java:668)
    at org.apache.tools.ant.Main.startAnt(Main.java:187)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
    Caused by: java.io.IOException
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:50)
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:40)
    ... 37 more
    Caused by: com.bea.xml.XmlException: unable to load type library from classloader weblogic.utils.classloaders.ClasspathClassLoader@1cc0a7f f
    inder: weblogic.utils.classloaders.CodeGenClassFinder@c52200 annotation:
    at com.bea.staxb.runtime.internal.BindingContextFactoryImpl.createBindingContext(BindingContextFactoryImpl.java:50)
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:48)
    ... 38 more
    Total time: 5 seconds

  • How to Load 2 library files using System.loadLibrary in one .java file!!!

    Hello,
    Someone please help me. What I am trying to do is load two .DLL files in my program. Program works fine when I
    do the following way i.e. I have two .java files and in each I am loading one .DLL file. But I don't want to have
    two .java files I want to load both the .DLL files in one program.
    **************** Example.java **********
    import java.io.*;
    import java.util.*;
    public class Example
    public native int A(String in);
    static
    System.loadLibrary( "API2" );
    public static void main( String args[])
         Ex ex = new Ex();
         int r;
         r = ex.A("TEST");
    public Example()
    *****************Ex.java*****************
    public class exsysml
    public native int A(String in);
    public exsysml()
    System.loadLibrary("API3");
    The above way works. But I need only one .java file to load both the .DLL files. i.e.
    import java.io.*;
    import java.util.*;
    public class Example
    public native int A(String in);
    static
    System.loadLibrary( "API2" );
    System.loadLibrary( "API3" );     
    public static void main( String args[])
         Example ex = new Example();
         int r;
         r = ex.A("TEST");
    public Example()
    but when I do this way it doesn't work and I get a UnSatisfiedLinkage Error at ex.A("TEST"). While doing the top way it works.
    How can I fix this to just have one .java file and load both the library files as done in the bottom program but doing this program doesn't work. Any help is appreciated.
    Thanks!

    what I figured out so far is that we can only load one library file in a single class and define all the native methods present in that library in the class where we are loading it. Means we can't load multiple library files in a single class. It's just my thought else if someone provides a better solution. I may be wrong so that's why I need your help.
    Thanks

  • Problem in loading the library through Servlet

    Hello,
    When i wrote an application which accesses my java component that has native methods and it loads the library that has the implementation of these methods, it works perfectly fine.
    But now when i am trying to access the same component through a servlet it is giving an error saying : "no library xyzDLL (xyzDLL.dll) in java.library.path" . When i have my component, servlet code and the DLL in the same directory.
    The code that is there in the component is :
    public class MyComponent {
         public native int create(double id, int a) ;
         static {
              System.out.println("loading the Library ...." ) ;
              System.loadLibrary("xyzDLL") ;
              System.out.println("Library Loaded successfully") ;
    And when i try to access the method in the servlet like :
    MyComponent com = new MyComponent() ;
    com.create(12.5,4) ;
    Can anyone please help me out how this can be solved. I feel like i have to keep the components and the DLL at a proper directory location. Can anybody help me out where should i keep these.
    I am using IBM Websphere Standard edition.
    Thanks in advance,
    patro

    Hi,
    The DLL needs to accessible in the environment of the server. I have not used websphere, but if there is a bat file that is used to start it, then put the directory where the DLL is in your PATH. Or change the system settings to have the directory in the PATH env variable. This will enable websphere to get at the DLL.
    hth
    rahul

  • How to get context information in your own class

    Hi,
    I'm new to Java and I'm trying to create my own class which stores some constants like for example mailServerHost. The class would look something like this:
    public class AppSettings {
    private static String mailServerHost="localhost";
    static{
    if(###online-server###)
    mailServerHost="another mail server";
    My problem is the if(###online-server###). I don't know how could I find informations about the underlying server.
    Is there any way to find out informations about the context(server)?
    Thanks,
    IMIA

    Do you still need ?n this case 2 different
    property-files (one for dev and one for
    online-servers).Yes, but they would have the same name. ;-)
    After all when you need to load one
    of them you'd still need in your AppSettings class on
    which server your application is running. So I'd
    still need that information.No, you use a fixed name, e.g. server.properties, for the config file.
    You might find class java.util.ResourceBundle interesting.

  • PHP & JAVA (Unable to load Java Library)

    Hello,
    I try to execute a script ncluding the call with JAVA routines, I obtain the following message:
    Fatal error: Unable to load Java Library /opt/j2sdk1.4.2_04/jre/lib/i386/libjava.so, error: libjvm.so: cannot open shared object file: No such file or directory in /usr/local/apache2/htdocs/prerequis.php on line 17
    My environment is as follows:
    Linux REDHAT 2.4.21, Apache 2.0.50, PHP 4.3.9, JDK 1.4.2_04
    Files php.ini :
    [Java]
    java.class.path = /usr/local/lib/php/php_java.jar
    java.home = /opt/j2sdk1.4.2_04
    java.library = /opt/j2sdk1.4.2_04/jre/lib/i386/libjava.so
    java.library.path = /usr/local/lib/php/extensions/no-debug-non-zts-20020429
    extension_dir = /usr/local/lib/php/extensions/no-debug-non-zts-20020429
    extension=java.so
    If somebody has an idea??
    Thanks

    Shouldn't java.library.path point to java.library?

  • Itunes will not recognise and load my library

    I know just enough about computers to be dangerous.  After years of relatively hassle free itunes I now have a distinct problem.  my most recent hard drive failure resulted in the purchase of another new drive and the loadingf of all of my programs.  This has happened numerous times in the past without upset but this time after inmstalling the latest v11.1 itunes it will not recognise and load my library.  I run 64 bit Win 7 an d to date I have:
              Uninstalled itunes and bonjour, deleted my original download, redownloaded and reinstalled.
              Checked preferences / advanced / path to make sure it is looking in the right place - changed paths and back again.
              Yes, it is 64 bit itunes.
              I only use MS Windows Defender and it has never blocked me before.
    In the past as soon as itunes has installed it has gobbled up my library but this time all I see is that stupid Mr Scruff et al.  Any suggestions would be appreciated.

    @CPL_STEELE: can you try to post these specifications in your own topic? (http://discussions.apple.com/thread.jspa?threadID=985161&tstart=0)
    It's not very nice to take over someone else this topic, because the topic starter (Ganieda) could have another problem than you. It's also very confusing for everyone who is trying to help because there are now 2 problems in the same topic.
    Never the less, feel free to follow this topic if you think it could be interesting for you problem.
    Dell   Windows XP   iTunes 7.2

  • How to load a Jar file in the class path?

    How to load a Jar file which contains class files, images, etc.. in the classpath without using URLClassLoader.

    You don't "load" jars. If it's on the classpath, you can obtain individual resources from it using various methods on either Class or ClassLoader. Do you mean "how to add a jar to the classpath at runtime"? Can't be done without using a classloader, typically URLClassLoader or a subclass thereof. Why you want to not use the proven method is beyond me. Presumably because you don't understand classloading. In which case, forget it.

  • Problem with creating my own class...

    Hi all,
    Purpose with this program:
    I want to create my own class StringThing which take a string parameter and transform the content toUpperCase().
    I have created a simple class StringThing which look like this:
    class StringThing {
    public String upperize (String u) {
    u.toUpperCase();
    return u;
    }And my class where I use the StringThing looks like this:
    import java.io.*;
    class UseStringThing{
    public static void main (String arg[]) throws Exception {
    BufferedReader keyboard = new BufferedReader(
    new InputStreamReader(System.in));
    String s,p;
    System.out.prinln("write a sentence!");
    s=keyboard.readLine();
    StringThing thing = new StringThing();
    p=thing.upperize(s);
    System.out.println(p);
    }Am I not supposed to transform my string parameter in my class by using for instance toUpperCase()? Or is there some fundamental rule or piece of code which I forgot?
    Thanks in advance,
    /Beginner-T-who-ripps-his-hear-over-this-small-problem

    Strings cannot be modified. What this line does:
    u.toUpperCase();
    is to create a new String object. toUpperCase() returns the newly created string and you are ignoring the returned value. What you want to do is:
    return u.toUpperCase();
    or
    u = u.toUpperCase();

  • Unable to load XDB library

    Hi, i have just created a new database but i keep getting the following error
    ORA-00600: internal error code, arguments: [unable to load XDB library],
    initializing SGA: sga_pass1Dynamic link error: Could not load module /u03/app/or
    acle/product/10.2.0.5/lib32/libxdb.so.
    The module has an invalid magic number.
    None of the other databases that have been running on the machine give out this error.
    I am running oracle 10.2 on aix
    I have read it may be something to do with it being 64 bit libraries. Even though none of the other DB's gave out any errors I have changed the setting in the user profile removing any mention of lib32 so they now read
    PATH=$ORACLE_HOME/bin:$ORACLE_HOME/lib:$ORACLE_HOME/lib
    LIBPATH=$ORACLE_HOME/lib
    export LIBPATH
    Ive shutdown the box, restarted the databases but the error occurs
    Any ideas?
    Many thanks

    Please check metalink doc ID 1292089.1
    It seems you have started the database with worng LIB settings, there are some steps provided to resolve this in the document
    On AIX there is special step for it and that should resolve your issue.
    Regards,
    Virendra
    Edited by: Virendra.K1.Yadav on Oct 2, 2012 1:53 PM

  • Unable to load DB2 library

    Hi,
    We are trying to install an application server on Windows in a UNIX SAP
    (abap+java) system with SAPinst.Our Central instance is in DB2/AIX
    platform and we want to install an windows application server.
    An error occured while processing start dialog instance task. Following
    error entry is displayed in dev_w0.
    "calling db_connect ...
    C  Registering callback for dynamic profile parameters
    C  *** ERROR => unable to load DB2 library 'E:\usr\sap\EBD\D01
    \exe/db6_clidriver\bin\db2app.dll'. Reason: A dynamic link library
    (DLL) initialization routine failed."
    [dbdb6.c      9714]
    C  *** ERROR in DB6Connect[dbdb6.c, 1412] CON = 0 (BEGIN)
    C  &+     DbSlConnectDB6: Unable to load DB2 libraries. Connect failed.
    Our Database instance version is DB2 9.1 with fp5 and application
    server db2 client version is also DB2 9.1 with fp5.
    Could you help us ?
    Best regards
    Gokhan Diren

    > C  Registering callback for dynamic profile parameters
    > C  *** ERROR => unable to load DB2 library 'E:\usr\sap\EBD\D01\exe/db6_clidriver\bin\db2app.dll'.
    Is that library there?
    Markus

  • ORA-00600: internal error code, arguments: [unable to load XDB library]

    hi everybody ;
    i have 9.2.0.7 db runs on SLES9 on host A. and i take full rman database backup to make a new database on different host ( host B ) with different file structure. ( sid is the same ) i had already 1 database on host B. after this duplicate now there are 2 database on host B.
    i take daily full database rman backup on the new host for my new database and there is no problem. when i try to take extra full export backup i get an error ;
    Dynamic link error: libxdb.so: cannot open shared object file: No such file or directory
    *** 2010-08-05 09:46:12.868
    ksedmp: internal or fatal error
    ORA-00600: internal error code, arguments: [unable to load XDB library], [], [], [], [], [], [], []
    as i search ; i have to stop the database and listener and set the LD_LIBRARY_PATH variable. how can i make this without make any mistake for the first database runs on Host B.
    because 2 database must be up and running on host B. can you explaın these operation step by step ?
    thank you ....

    craft wrote:
    any idea ?
    >any idea ?
    your database is out off support you should consider to upgrade. ORA-00600 indicate for bug

  • Unable to Load JdbcOdbc library -- Linux

    I know this question has been asked a lot, but I couldn't find a helpful answer in all my searches. I'm trying to use JdbcOdbc to connect to MySQL via ODBC on Linux. I have to use ODBC as part of an assignment, which is rather annoying, since the MySQL J/Connectivity JDBC driver works perfectly. But the assignment sort of assumes I'm on Windows and using MS Access, although I did have a choice to use MySQL.
    That's the background.
    This is the error I'm getting when trying to connect to ODBC. It's loading the driver all right (ie: no problems if I comment out the lines that tries to connect to the database).
    *Driver.connect (jdbc:odbc:flightData)
    JDBC to ODBC Bridge: Checking security
    No SecurityManager present, assuming trusted application/applet
    JDBC to ODBC Bridge 2.0001
    Current Date/Time: Wed Mar 19 09:12:20 CST 2003
    Loading JdbcOdbc library
    Unable to load JdbcOdbc library
    Exception in thread "main" java.lang.NullPointerException
    at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:435)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at testData.main(testData.java:17)
    I've tried variations on the URL and the connect pattern, but it seems almost certain that it cannot load the library, and it's not the URL that's the problem yet.
    What I've done:
    I did a search on google and on this forum. I found that the directory containing libJdbcOdbc.so should be in /etc/ld.so.conf. I added it and I ran ldconfig -v; the library is listed in the output of that command, so I think it is loaded. I don't know how to check if a particular library is loaded?
    In this forum, I found that there might be a problem with the access permissions. I read that I should set the AllPermission policy to see if that's a problem, but I'm not exactly sure how to do that. Policytool is kind of cryptic, and on top of that, its GUI window is not displaying properly for me. If somebody could tell me the contents I should put in ~/.java.policy to enable all permissions, it might help.
    In addition, I've tried using the JDBCTest tool, and it also was unable to connect to ODBC. However, if I use the tool called DataManager that is a part of the ODBC implementation, it can connect to the database easily (which indicates that the database is properly set up via ODBCConfig, I think).
    My System:
    I'm running Debian Linux 3.0 (Woody) / unstable. I'm using the Blackdown version of Jdk1.4, which I retreived via apt-get. I'm not absolutely certain what I've got running ODBC; I also got it via apt-get. As mentioned, the tools odbcinst, ODBCConfig, and DataManager are all installed on my system.
    I'm really confused by this problem, since all the advice I've been able to find has helped other people, yet I'm still lost!
    Thanks,
    Dusty

    After running ldd on libJdbcOdbc.so, I realized I had to make a couple of symlinks from odbc.so.1 in /usr/lib to odbc.so.
    Dusty

  • Sybase gateway problem - Failed to load dynamic library 'hsdbsyb'

    Having problems getting the Sybase gateway working on XP. Environment in Oracle 9.2.0.6 on Linux, Sybase on AIX 5.1 (moving to linux, gateway currently working well on this box) gateway on XP. I get the following error when trying to use my db link: Help appreciated
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Transparent gateway for SYBASE]DRV_InitTdp: DBTYPE.C (473): ; The specified module could not be found.
    ; at FIND_IMAGE_SYMBOL
    DBTYPE.C (7): ; [C079] Failed to load dynamic library 'hsdbsyb'
    tnsnames on linux box has:
    CIT001TSTW =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = tcp)(HOST = lons00106694)(PORT = 1521))
    (CONNECT_DATA =
    (SID = cit001tst)
    (HS = OK)
    on gateway windows box (has oracle client and gateway software and sybase client)
    listener.ora:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = c:\progra~1\oracle)
    (PROGRAM = extproc)
    (SID_DESC=
    (SID_NAME = cit001tst)
    (ORACLE_HOME = c:\progra~1\oracle)
    (PROGRAM = tg4sybs)
    initcit001tst.ora
    HS_FDS_CONNECT_INFO=CIT1_LON_TST_SQL.cit001tst
    HS_FDS_TRACE_LEVEL=ON
    HS_FDS_RECOVERY_ACCOUNT=RECOVER
    HS_FDS_RECOVERY_PWD=RECOVER
    HS_FDS_TRACE_LEVEL=4
    HS_FDS_FILE_NAME=trace
    # Environment variables required for Sybase
    set SYBASE=c:\progra~1\sybase\oc1251
    sql.ini
    [CIT1_LON_TST_SQL]
    win3_query=WNLWNSCK,loncmxs0004.uk.net.intra.,5000
    query=NLWNSCK,loncmxs0004.uk.net.intra.,5000

    Yes, this VI is damaged. I can not open it.
    Colin
    LV7.1/8.2/8.2.1/8.5/8.6/9.0/2010/2013; testing system development
    Please Mark the solution as accepted if your problem is solved and donate kudoes
    Home--www.colinzhang.net

Maybe you are looking for

  • BOM Explosion/dependant requirements

    Dear All, I have a concern regarding the "MRP 4" view in MM. BOM/Explosion Individual / Collective requirements "MRP 3" view Availability Check Availability Check (Daily / Individual) I would like to know the effect of these settings clearly with an

  • Kernel Panis

    My Mac is not even 5 months old and I keep getting kernel panics! It seems to happen when the computer is waking up from the sleep mode. Will this problem be resolved if I install the new operating system? Many thanks. Interval Since Last Panic Repor

  • Photo album without detail view

    I was wondering if there were other options for viewing a photo album than the detailed view? I would rather have you click on an image in the album and go to a enlarged view without having the small thumbnails above it. Is this possible? Are there o

  • Getting error wwc-40019

    hai, I installed successfully OCS-9.0.4.1.1. without any errors on windows as given follows I)Infratructure and information storage in WINDOWS2003 server. and II) middle tier in the WINDOWS2000 professional. with 2 applications (1) files (2) email. I

  • Problem with Ipod Classic

    Hello I have an ipod Classic 160 GB. Recently I had to re-contruct my itunes library. I have synced the library and the ipod 3-4 times. Each time itunes seems to transfer the recordings and podcasts without any difficulties. However, nothing is comin