Access COM component in Java

I am trying to access a COM component in Java. I want to bring up the Windows clock (which I understand is a component) and call it up from within my code. I just need it to appear - not do anything specific. I did post this question and one person said it was not something normally done in Java and that I should use a Java-COM bridge. While I am not opposed to that - I am trying to keep the solution within Java without using third party components if possible.
I have got the impression from some things I've read in various forums and elsewhere that it is possible to do with JNI by using a wrapper written in C. Have I got that right? If so - how would I go about doing that? Could someone point me in the right direction of some examples that might be similar to what I'm trying to do?
Any help would be appreciated....

Regarding the reasons behind the clock:
I am using a product (work-related) that has a java engine built into it to allow the user to manipulate columns of a database with built in functions written in Java. However, within this mini-development area you can also run regular java code.
I will in the not-too-distant future need to access a COM component from a third party vendor that will allow me to do various data checks on data (i.e. post code verification) so I want to know how to access COM components generally as well. The idea behind accessing the windows clock (and by "accessing" I mean just throwing it up on the screen and not doing anything else) is that (a) it is an easily recognizable COM component in the windows environment and (b) it should then be fairly easy to translate what I have learned to allow me to integrate the other component. ( I hope! )
I think for the time being I will look to the tutorial and see if I can get anywhere with that.
Having explained a little further what I'm trying to do - any further suggestions on things to read or look at are welcome. And thanks to everyone who responded - this is new territory for me and I'm muddling through it as best I can. I do appreciate you all taking the time to help me.

Similar Messages

  • How to create and call a COM component in Java

    Hi All,
    can you suggest how to create and call a COM component..or if have any sample simple application can you send it to me...i will try to develop my project.
    actually i am configuring a OCR Engine using SDK which is in VB .Net when i contacted their support they told that if i have any sample COM based component Project they will help me...
    So please can you help in this.
    Thanks in advance.

    As said by my fellow posters Java Devolopment Environment (Except Microsoft implementation of JVM,this is no longer supported by MS themseleves) does not provide an built-in support to serve this cause.
    If you are looking to devolop a custom based solution the below is a good place to start with where end user is talking about Java <=> JNI <=> Native <=> COM connectivity.
    [http://bloggershetty.blogspot.com/2004/12/java-jni-com-activex-bridge-lots-of.html]
    However,if you are looking for ready made solutions ?
    Implementation any one of the solutions stated below might serve your cause.
    Open Source Solutions:
    [http://j-interop.org/]
    [http://www.danadler.com/jacob/]
    Commercial Solutions:
    [http://javacombridge.com/]
    [http://www.jnbridge.com/]
    [http://www.nevaobject.com/j2cdetails.asp?kw=java%20com%20bridge]
    [http://j-integra.intrinsyc.com/]
    Hope this might help :)
    REGARDS,
    RaHuL

  • Calling a VB Com component from Java

    Hi,
    I wish to call some legacy VB 6 COM dlls from some new Java code I am writing. I was looking (just read quickly haven't tried the examples yet) at the ActiveX Bridge documentation and get the impression that it only goes one way -i.e. make Java into an ActiveX Component to be used from VB, whereas I wish to call VB from Java.
    Have I missed something or is this not the way to go to get to the legacy code?
    The legacy code also has an MIDL file. Ideally, I would love to just be able to access that from Java, but I can't find any (non-Microsoft VJ++ based) tools to help with either converting MIDL to IDL so I can use Sun's idlj.exe or just converting the MIDL to Java.
    Any pointers/tips on any of this would be appreciated.
    Thanks,
    Cheryl

    I looked at Jacob, but didn't get far either.
    Right now I'm looking at Jawin -
    http://jawinproject.sourceforge.net/jawin.html. Not
    making a lot of headway yet.
    IDL is OMG's IDL (Interface Definition Language) -
    http://www.omg.org/gettingstarted/omg_idl.htm.
    MIDL is Microsoft's version of IDL for COM - I believe
    it uses IDL., but can't seem to find a conversion
    tool.
    idlj.exe is in the bin directory of whatever JDK you
    have loaded. This tool will convert OMG IDL into Java.
    Good luck to you.Hi,
    I am facing a similar problem. I need to access a vb dll methods. I took and look at jawin and installed it.
    I want to invoke a method in the dll from my servlet.
    So do I have to create stubs for it. I opened the Type Browser that comes with jawin. It is a GUI through which I am supposed to create stub java files for that dll. But I am getting this error:
    [EXCEPTION] InfoPanel.generateInfo() failed to generated info
    org.jawin.browser.xsl.TransformationException: TransformationManager.cacheStyles
    heet() failed to compile stylesheet from: stylesheets/info/library.xsl - javax.x
    ml.transform.TransformerConfigurationException: javax.xml.transform.TransformerC
    onfigurationException: javax.xml.transform.TransformerException: java.net.Malfor
    medURLException: no protocol: stylesheets/info/library.xsl
    at org.jawin.browser.xsl.TransformationManager.cacheStylesheet(Transform
    ationManager.java:130)
    at org.jawin.browser.xsl.TransformationManager.checkStylesheet(Transform
    ationManager.java:180)
    at org.jawin.browser.xsl.TransformationManager.transform(TransformationM
    anager.java:147)
    at org.jawin.browser.info.InfoPanel.generateInfo(InfoPanel.java:68)
    at org.jawin.browser.info.InfoPanel.selectionChanged(InfoPanel.java:61)
    at org.jawin.browser.tree.TypeDataTree.fireSelectionChanged(TypeDataTree
    .java:61)
    Is anyone sucessfully able to generate stub files for the dll in jawin using Type Browser ?
    Please let me know
    my mailid is tanveerrameez(at) yahoo dot com
    thanks
    Tanveer

  • Accessing COM from Java using JCOM

    When I tried to access a simple COM component with the com2java generated files,
    I got the following error. Can someone help me with this?
    <Nov 8, 2001 3:37:24 PM CST> <Error> <HTTP> <[WebAppServletContext(366665,Defaul
    tWebApp,/DefaultWebApp)] Servlet failed with IOException
    AutomationException: 0x80070005 - General access denied error
    at com.bea.jcom.bm.b(bm.java)
    at com.bea.jcom.Rpc.a(Rpc.java)
    at com.bea.jcom.bf.a(bf.java)
    at com.bea.jcom.Dispatch.createDispatch(Dispatch.java)
    at com.bea.jcom.Dispatch.<init>(Dispatch.java)
    at com.ak.jcomtest._JComTestProxy.<init>(_JComTestProxy.java:33)
    at com.ak.jcomtest.JComTest.<init>(JComTest.java:105)
    at com.ak.jcomtest.JComTest.<init>(JComTest.java:77)
    at jsp_servlet.__jcom._jspService(__jcom.java:91)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:265)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2456)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2039)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >

    I did everything earlier except the second point you mentioned. Everything started
    working as soon as I added a line to call com.bea.jcom.AuthInfo.setDefault() method.
    I didn't think this was necessary since I already gave permissions to that user
    using DCOMCNFG. Thanks for you help.
    "BEA jCOM Support" <[email protected]> wrote:
    >
    Your jcom.log indicates you are trying to access the COM object with
    Authentication
    "BXDOMAIN/akumar". Add this user to the default access/launch permissions
    (using
    DCOMCNFG) on the machine hosting the COM object.
    Also, make sure you put this in your Java code:
    com.bea.jcom.AuthInfo.setDefault("BXDOMAIN", "akumar", "<password>");
    "Anil Kumar" <[email protected]> wrote:
    Here's the log
    jCOM checkconfig 6.1 Beta - Copyright (C) 2001 BEA Systems, Inc. Copyright
    (C)
    1999-2001 Linar Ltd. and Intrinsyc Software, Inc. http://www.bea.com/jcom/
    --- Checking OS ---
    Microsoft Windows NT 5.0 (Build: 2195) Service Pack 2
    --- Checking Time ---
    Time: 15:20:49
    Date: 11/13/01
    --- opening typelib: JComTestProject.exe ---
    Class Name = JComTest
    Class Id = 742db055-77df-404a-a579-e0cbfd3007a7
    Class Name = JComTestProject.JComTest
    AppID = {742DB055-77DF-404A-A579-E0CBFD3007A7}
    {742DB055-77DF-404A-A579-E0CBFD3007A7} = JComTestProject.JComTest
    Implemented Categories = no value(259)
    {40FC6ED5-2438-11CF-A3DB-080036F12502} = no value(259)
    LocalServer32 = D:\Program Files\Microsoft Visual Studio\VB98\Projects\JCom\JComTestProject.exe
    ("D:\Program Files\Microsoft Visual Studio\VB98\Projects\JCom\JComTestProject.exe"
    file exists)
    ProgID = JComTestProject.JComTest
    Programmable = no value(259)
    TypeLib = {E0BF28D6-6347-4017-8D2E-52B145CE47DA}
    VERSION = 2.0
    --- Checking Username ---
    USER:WARANGAL\akumar
    GROUP:WARANGAL\None
    GROUP:\Everyone
    ALIAS:WARANGAL\ORA_DBA
    ALIAS:BUILTIN\Administrators
    ALIAS:BUILTIN\Users
    ALIAS:BUILTIN\Power Users
    GROUP:\LOCAL
    GROUP:NT AUTHORITY\INTERACTIVE
    GROUP:NT AUTHORITY\Authenticated Users
    --- Checking DCOM settings ---
    DCOM version supports accessing Java from COM
    EnableDCOM = Y
    DefaultLaunchPermission:
    Access enabled for NT AUTHORITY\SYSTEM
    Access enabled for NT AUTHORITY\INTERACTIVE
    Access enabled for BUILTIN\Administrators
    --- Connecting to SCM ---
    Connecting to SCM on localhost
    Connect successful
    --- IP configuration ---
    Hostname = warangal.bxsys.com
    Address 0 = 172.18.32.102
    Connecting to SCM on 172.18.32.102
    Connect successful
    Address 1 = 169.254.25.129
    Connecting to SCM on 169.254.25.129
    Connect successful
    --- Winsock Information ---
    Version: 202
    Description: WinSock 2.0
    --- Environment Variables ---
    ALLUSERSPROFILE=C:\WINNT\Profiles\All Users
    APPDATA=C:\WINNT\Profiles\anil\Application Data
    BOOKSHELF=D:\ifor\WIN\BIN\EN_US
    CLASSPATH=.;d:\mystuff\javastuff\jarz;d:\weblogic\lib\weblogic510sp6boot.jar;d:/jdk122/javamail112/mail.jar;d:/jdk122/jaf-1.0.1/activation.jar;d:/jdk122/jsdk2.1/server.jar;d:/jdk122/jsdk2.1/servlet.jar;D:\WebLogicCommerceServer3.2\classes;D:\Oracle\Ora81\jdbc\lib\classes111.zip;D:\weblogic\lib\WebLogic_RDBMS.jar;D:\Oracle\Ora81\orb\classes\yoj.jar;D:\Oracle\Ora81\orb\classes\share.zip
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=WARANGAL
    ComSpec=C:\WINNT\system32\cmd.exe
    HELP=D:\IBMVJava3.0\eab\;D:\IBMVJava20\eab\;D:\ifor\WIN\BIN
    HOMEDRIVE=C:
    HOMEPATH=\
    I4_INSTALL_DRIVE=D:
    I4_LANG=EN_US
    IPF_PATH32=D:\ifor\WIN\BIN\EN_US
    J2EE_CLASSPATH=D:\j2ee121\lib\cloudscape\cloudspace.jar;
    JAVA_HOME=d:\jdk13
    LOGONSERVER=\\WARANGAL
    NLSPATH=D:\ifor\LS\MSG\%L\%N
    NUMBER_OF_PROCESSORS=1
    OS=Windows_NT
    Os2LibPath=C:\WINNT\system32\os2\dll;
    Path=d:\jdk13\bin;D:\Oracle\Ora81\bin;D:\Oracle\Ora81\orb\bin;C:\WINNT;C:\WINNT\system32;C:\WINNT\system32\WBEM;d:\jdk13\bin;D:\CVS;D:\ifor\WIN\BIN;D:\ifor\WIN\BIN\EN_US;D:\JavaStuff\jakarta-ant-1.3\bin;D:\BEA\wlserver6.1\jcom\bin;D:\WebGain\VisualCafe\Java2\Bin;C:\Program
    Files\Common Files\WebGain Shared;D:\WebGain\VisualCafe\Bin;
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 3, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=0803
    ProgramFiles=C:\Program Files
    PROMPT=$P$G
    StarTeam=D:\StarTeam 4.0\StarTeam.ini
    StarTeamApp=D:\StarTeam 4.0
    STLicense=D:\StarTeam 4.0
    SystemDrive=C:
    SystemRoot=C:\WINNT
    TEMP=D:\TEMP
    TMP=D:\TEMP
    USERDOMAIN=WARANGAL
    USERNAME=akumar
    USERPROFILE=C:\WINNT\Profiles\anil
    windir=C:\WINNT
    WorkstationID=D:\StarTeam 4.0\ConnectionManager.ini
    "Damon Hon" <[email protected]> wrote:
    hi anil,
    can you run the checkconfig tool as well
    checkconfig /typelib <path to tlb> config.log
    and post the log
    thanks
    damon
    "Anil Kumar" <[email protected]> wrote in message
    news:[email protected]...
    Hi Damon,
    I am just calling the default constructor of the com2Java generatedclass(in this
    case, it is JComTest.class) from a simple JSP. I am not calling anymethods on
    this component. Here are the contents of the log file.
    jCOM version 6.1 Beta logger started in immediate mode at Tue Nov
    13
    12:32:41
    CST 2001 at level 3 (VERBOSE)
    License:
    Classloader is bootstrap
    java.version is 1.3.1
    java.vendor is Sun Microsystems Inc.
    java.class.path is..;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;D:\BEA\wlserver6.1\jcom\lib\jcom.
    jar;D:\Projects\JCom\src
    java.library.path isD:\BEA\jdk131\bin;.;C:\WINNT\System32;C:\WINNT;.\bin;d:\jdk13\bin;D:\Oracle\
    Ora81\bin;D:\Oracle\Ora81\orb\bin;C:\WINNT;C:\WINNT\system32;C:\WINNT\system
    32\WBEM;d:\jdk13\bin;D:\CVS;D:\ifor\WIN\BIN;D:\ifor\WIN\BIN\EN_US;D:\JavaStu
    ff\jakarta-ant-1.3\bin;D:\BEA\wlserver6.1\jcom\bin;D:\WebGain\VisualCafe\Jav
    a2\Bin;C:\Program
    Files\Common Files\WebGain Shared;D:\WebGain\VisualCafe\Bin;
    os.name/os.arch/os.version is Windows 2000/x86/5.0
    1005676361251 +: New RemOxidResolver initialised for Net={{ 0x7,127.0.0.1[135]}}
    Sec={}
    1005676361271 +: Looking for free connection handler to 127.0.0.1[135]for
    BXDOMAIN/akumar
    1005676361311 : OXID Resolver started. Listening on port 3895
    1005676361321 : Object Exporter binding is Net={{ 0x7,172.18.32.102[3896]},
    { 0x7, 169.254.25.129[3896]}} Sec={{ 0xa, 0xffff, }, { 0x0, 0x0,
    OXID
    is 1005676361311
    1005676361331 +: Opening a TCP/IP connection to 127.0.0.1[135] withauth
    BXDOMAIN/akumar
    1005676361361 : Sending RemoteActivation request to Net={{ 0x7,127.0.0.1[135]}}
    Sec={} to activate cls/iid742db055-77df-404a-a579-e0cbfd3007a7/fbcd1246-3557-4b95-8046-cfec093310b5
    1005676361832 : Sending IRemoteActivation::RemoteActivation request,with
    RPC
    call id 2 on ipid null
    1005676361892 : Received the response toIRemoteActivation::RemoteActivation
    request, with RPC call id 2
    1005676361902 +: Remote server's version: 5.1
    1005676361942 *: Error activating742db055-77df-404a-a579-e0cbfd3007a7/fbcd1246-3557-4b95-8046-cfec093310b5:
    AutomationException: 0x80070005 - General access denied error
    "Damon Hon" <[email protected]> wrote:
    hi anil,
    can you post the snippet of java code that is calling the methods
    from your COM object and post the following logs
    jcom.log
    - In your java code, add the following line to the start of your
    initialization code.
    com.bea.jcom.Log.logImmediately(3, "c:\\temp\\jcom.log");
    config.log
    - Run the checkconfig utility to generate this log
    checkconfig /typelib <path to tlb> config.log
    thanks
    damon
    "Anil Kumar" <[email protected]> wrote in message
    news:[email protected]...
    Thanks for the info. I had already done this before. I checked
    everything
    a dozen
    times. I am not sure why this is happening. Please let me know,
    if
    there
    are any
    other ideas.
    "Damon Hon" <[email protected]> wrote:
    hi anil,
    The exception you are getting, indicates that your java client
    does
    not
    have
    sufficient permissions to access your com component.
    if you are running your java code and com component on the same
    machine,
    - make sure that your jcom/bin directory is in your path environment
    variable
    - run the DCOMCNFG tool to configure accesss for the interactiveuser
    or the
    user you are logged in as.
    if you are not running your java code under windows, add this
    call
    in
    your
    java code:
    com.bea.jcom.AuthInfo.setDefault("nt domain", "user", "password");
    - use the DCOMCNFG tool to configure has dcom access to the
    com
    component for this user
    let me know if this helps
    damon
    "Anil Kumar" <[email protected]> wrote in message
    news:[email protected]...
    When I tried to access a simple COM component with the com2java
    generated
    files,
    I got the following error. Can someone help me with this?
    <Nov 8, 2001 3:37:24 PM CST> <Error> <HTTP><[WebAppServletContext(366665,Defaul
    tWebApp,/DefaultWebApp)] Servlet failed with IOException
    AutomationException: 0x80070005 - General access denied error
    at com.bea.jcom.bm.b(bm.java)
    at com.bea.jcom.Rpc.a(Rpc.java)
    at com.bea.jcom.bf.a(bf.java)
    at com.bea.jcom.Dispatch.createDispatch(Dispatch.java)
    at com.bea.jcom.Dispatch.<init>(Dispatch.java)
    at
    com.ak.jcomtest._JComTestProxy.<init>(_JComTestProxy.java:33)
    at com.ak.jcomtest.JComTest.<init>(JComTest.java:105)
    at com.ak.jcomtest.JComTest.<init>(JComTest.java:77)
    at jsp_servlet.__jcom._jspService(__jcom.java:91)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:265)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2456)
    atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2039)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >

  • How to Use COM Component in a Java Bean

    Dear Sir,
    How can I use a COM Component in a Java-Bean . I am having a COM Component for reading Weighment Reading on a Serial Port and want to use this Component in a Java-Bean . I would also like to call the methods of this COM Component inside my Java-Bean . COM Component is a dll file .
    Please guide me how to go ahead . If possible kindly provide some sample code for the same .
    With Thanks and Regards
    B V Mittal

    You need a Java to COM bridge like Jacob. Try searching this forum for more information, I've answered this question several times before.
    Dom.

  • Accessing methods of COM component

    I have a COM component whose methods I want to access in Developer/2000 Forms.
    Is this possible? Does Forms have support for COM and COM+ servers? Which version of Forms have support for accessing COM components?
    Also, Can I pass parameters while executing the application created using Developer/2000? If yes, can you tell me how to do it?
    Thanks.
    Mustansir Udaipurwala

    You can use the OLE2 built in package (see online help) to communicate with com objects and pass parameters.
    I'll suggest you'll have a look at the forms demos to see integration with excel and on metalink.oracle.com for more samples.

  • How can JSP access a COM+ component

    I have to develop JSP pages that leverage existing Microsoft COM+ components. Can anyone suggest a good resource or provide me with a quick explanation/overview of how I would access a COM+ component from JSP? I'm getting exhausted searching the internet for answers only to come up empty. Thanks...

    I use Neva Object (www.nevaobject.com) for this sort of thing. This is a commercial product. The product does what it says it does and that is as far as I will endorse it.
    Since purchasing it I came accross
    http://staff.develop.com/halloway/code/jawin.html
    This looks like it will do much of the same thing but is more suitable for scriptable COM objects. It is also an open source license.
    I don't have any experience with jawin but the support community looks strong. Checking out their website will be worth your time.
    Good luck
    Bill

  • How to interact with a COM component from a Java class

    Hi, could someone give a hint on what API I should explore in order to interact with a COM component from a Java class?
    Thanks in advance
    Luis

    jacob sounds nice...http://danadler.com/jacob/

  • Error "cannot access com.sun.java..."

    edit i mistyped in the topic name, i mean to say "com.sun.j3d..."
    I've set myself up using JCreator, installed j3d, j2sdk, and jdk. Tried a few test programs to make sure everything was working (a basic hello world and my chess game i created my junior year in highschool). It was all running fine.
    So i started reading into j3d tutorials, and came across the HelloUniverse sample program. I slapped the code in and compiled it, only to be met with:
    "cannot access com.sun.j3d.utils.applet.MainFrame".
    I commented out the import line that included this, compiled, and it gave me another message complaining about the same thing, only this time ending in:
    "...geometry.ColorCube"
    Obviously, its just running down the line with all of the j3d imports, so i ran through and reinstalled all my j3d files; still didnt work. I can't figure out what's wrong with it. Please help.
    Message was edited by:
    philjoh

    May be, it is not getting the class it is pointing to, in your classpath. Have u put jaxrpc-ri.jar in your classpath, since this jar contains ur class?
    Regards,
    - Tinu

  • 1)unexpected Exception:page fault accessing tag table 2)java.rmi.MarshalException:Unexpected Exception page fault accessing page table

    i am trying to call WCF service by using Jsr 172 method
    but i got the two error
    1)unexpected Exceptionage fault accessing tag table
    2)java.rmi.MarshalException:Unexpected Exception page fault accessing page table
    does anybody knows about how to solve this error.
    Plz help me
    thanks in advance!!!!!!!!!!!
      My Code is:-----
    package com.rim.sample.webservicedemo;
    import java.rmi.RemoteException;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.container.MainScreen;
    public class webservice extends UiApplication
        public webservice()
            pushScreen(new myscreen());
        public static void main(String[] args)
            webservice t=new webservice();
            t.enterEventDispatcher();
    final class myscreen extends MainScreen implements FieldChangeListener
        //taking this program from :-http://blog.bayestech.com/?p=78
         public myscreen()
             setTitle("HI");
             ButtonField g=new ButtonField("OK",ButtonField.CONSUME_CLICK);
             g.setChangeListener(this);
             add(g);
        public void fieldChanged(Field field, int context)
            try
                testServiceCall();
            catch (RemoteException e)
                Dialog.alert(e.getMessage());
                Dialog.alert(e.toString());
         public void testServiceCall() throws RemoteException
                TestService_Stub service = new TestService_Stub();
                //String  message = service.helloWorld();
               // Dialog.alert(message);
              // String  message2=service.echoName("ankush,nilesh,chetan,ravi");
                //Dialog.alert(message+"  second message  "+message2);
                // Object addition_output=service.addition(7,2);
                 //Dialog.alert("your addition is" +  String.valueOf(addition_output));
                 String  login_message = service.logOn_method("abcdefg","aaaaa");
                 Dialog.alert("login successfully");
                 Dialog.alert(login_message);
    //////////////TestService_Stub class file///////////////////////
    package com.rim.sample.webservicedemo;
    import java.rmi.RemoteException;
    import javax.xml.rpc.JAXRPCException;
    import javax.xml.namespace.QName;
    import javax.microedition.xml.rpc.Operation;
    import javax.microedition.xml.rpc.Type;
    import javax.microedition.xml.rpc.ComplexType;
    import javax.microedition.xml.rpc.Element;
    import net.rim.device.api.ui.component.Dialog;
    public class TestService_Stub implements TestService,javax.xml.rpc.Stub
        ///calling web services by using jsr-172 method
        //website link :- http://blog.bayestech.com/?p=78
        private String[] _propertyNames;
        private Object[] _propertyValues;
      //  private Object[] _propertyValues1;
        public TestService_Stub()
            _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
           // _propertyValues = new Object[] { "http://test.bayestech.com/Services/TestService.asmx" };
          // _propertyValues = new Object[] { "http://soft21/testWCF/Service.svc" };
            _propertyValues = new Object[] { "< url name >" };
     protected void _prepOperation(Operation op)
            for (int i = 0; i < _propertyNames.length; ++i)
                op.setProperty(_propertyNames[i], _propertyValues[i].toString());
     public String logOn_method(String usr_name,String password_name ) throws java.rmi.RemoteException
          Object inputObject[] = new Object[]
                  usr_name,
                  password_name
          Operation op = Operation.newInstance( _qname_operation_logOn, _type_logOn, _type_logOnResponse );
          _prepOperation( op );
          op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "<soap action name >" );
          Object resultObj;
          try
              resultObj = op.invoke( inputObject );
              Dialog.alert((String)resultObj);
          catch( JAXRPCException e )
              Throwable cause = e.getLinkedCause();
              if( cause instanceof java.rmi.RemoteException )
                  throw (java.rmi.RemoteException) cause;
              Dialog.alert(e.getMessage());
              throw e;
          return (String )((Object[])resultObj)[0];
     protected static final QName _qname_operation_logOn = new QName( "<soap action name>", "logOn" );
        protected static final QName _qname_logOnResponse = new QName( "<soap action name>", "logOnResponse" );
        protected static final QName _qname_logOn = new QName( "<soap action name>", "logOn" );
        protected static final Element _type_logOn;
        protected static final Element _type_logOnResponse;
        static
     _type_logOn = new Element( _qname_logOn, _complexType( new Element[] {
                 new Element( new QName( "<soap action name>", "usr_name" ), Type.STRING, 0, 1, false ),
                 new Element( new QName( "<soap action name>", "password_name" ), Type.STRING, 0, 1, false )}), 1, 1, false );
            _type_logOnResponse = new Element( _qname_logOnResponse, _complexType( new Element[] {
                  new Element( new QName( "<soap action name>", "logResult" ), Type.INT, 0, 1, false )}), 1, 1, false );
        private static ComplexType _complexType( Element[] elements )
            ComplexType result = new ComplexType();
            result.elements = elements;
            return result;
        public void _setProperty(String name, Object value) {
            // TODO Auto-generated method stub
        public Object _getProperty(String name) {
            // TODO Auto-generated method stub
            return null;
        public String echoName(String name) throws RemoteException {
            // TODO Auto-generated method stub
            return null;
        public String helloWorld() throws RemoteException {
            // TODO Auto-generated method stub
            return null;
    i am trying to call WCF service by using Jsr 172 method
    but i got the two error
    1)unexpected Exceptionage fault accessing tag table
    2)java.rmi.MarshalException:Unexpected Exception page fault accessing page table
    does anybody knows about how to solve this error.
    Plz help me
    thanks in advance!!!!!!!!!!!
      My Code is:-----
    package com.rim.sample.webservicedemo;
    import java.rmi.RemoteException;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.container.MainScreen;
    public class webservice extends UiApplication
        public webservice()
            pushScreen(new myscreen());
        public static void main(String[] args)
            webservice t=new webservice();
            t.enterEventDispatcher();
    final class myscreen extends MainScreen implements FieldChangeListener
        //taking this program from :-http://blog.bayestech.com/?p=78
         public myscreen()
             setTitle("HI");
             ButtonField g=new ButtonField("OK",ButtonField.CONSUME_CLICK);
             g.setChangeListener(this);
             add(g);
        public void fieldChanged(Field field, int context)
            try
                testServiceCall();
            catch (RemoteException e)
                Dialog.alert(e.getMessage());
                Dialog.alert(e.toString());
         public void testServiceCall() throws RemoteException
                TestService_Stub service = new TestService_Stub();
                //String  message = service.helloWorld();
               // Dialog.alert(message);
              // String  message2=service.echoName("ankush,nilesh,chetan,ravi");
                //Dialog.alert(message+"  second message  "+message2);
                // Object addition_output=service.addition(7,2);
                 //Dialog.alert("your addition is" +  String.valueOf(addition_output));
                 String  login_message = service.logOn_method("abcdefg","aaaaa");
                 Dialog.alert("login successfully");
                 Dialog.alert(login_message);
    //////////////TestService_Stub class file///////////////////////
    package com.rim.sample.webservicedemo;
    import java.rmi.RemoteException;
    import javax.xml.rpc.JAXRPCException;
    import javax.xml.namespace.QName;
    import javax.microedition.xml.rpc.Operation;
    import javax.microedition.xml.rpc.Type;
    import javax.microedition.xml.rpc.ComplexType;
    import javax.microedition.xml.rpc.Element;
    import net.rim.device.api.ui.component.Dialog;
    public class TestService_Stub implements TestService,javax.xml.rpc.Stub
        ///calling web services by using jsr-172 method
        //website link :- http://blog.bayestech.com/?p=78
        private String[] _propertyNames;
        private Object[] _propertyValues;
      //  private Object[] _propertyValues1;
        public TestService_Stub()
            _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
           // _propertyValues = new Object[] { "http://test.bayestech.com/Services/TestService.asmx" };
          // _propertyValues = new Object[] { "http://soft21/testWCF/Service.svc" };
            _propertyValues = new Object[] { "< url name >" };
     protected void _prepOperation(Operation op)
            for (int i = 0; i < _propertyNames.length; ++i)
                op.setProperty(_propertyNames[i], _propertyValues[i].toString());
     public String logOn_method(String usr_name,String password_name ) throws java.rmi.RemoteException
          Object inputObject[] = new Object[]
                  usr_name,
                  password_name
          Operation op = Operation.newInstance( _qname_operation_logOn, _type_logOn, _type_logOnResponse );
          _prepOperation( op );
          op.setProperty( Operation.SOAPACTION_URI_PROPERTY, "<soap action name >" );
          Object resultObj;
          try
              resultObj = op.invoke( inputObject );
              Dialog.alert((String)resultObj);
          catch( JAXRPCException e )
              Throwable cause = e.getLinkedCause();
              if( cause instanceof java.rmi.RemoteException )
                  throw (java.rmi.RemoteException) cause;
              Dialog.alert(e.getMessage());
              throw e;
          return (String )((Object[])resultObj)[0];
     protected static final QName _qname_operation_logOn = new QName( "<soap action name>", "logOn" );
        protected static final QName _qname_logOnResponse = new QName( "<soap action name>", "logOnResponse" );
        protected static final QName _qname_logOn = new QName( "<soap action name>", "logOn" );
        protected static final Element _type_logOn;
        protected static final Element _type_logOnResponse;
        static
     _type_logOn = new Element( _qname_logOn, _complexType( new Element[] {
                 new Element( new QName( "<soap action name>", "usr_name" ), Type.STRING, 0, 1, false ),
                 new Element( new QName( "<soap action name>", "password_name" ), Type.STRING, 0, 1, false )}), 1, 1, false );
            _type_logOnResponse = new Element( _qname_logOnResponse, _complexType( new Element[] {
                  new Element( new QName( "<soap action name>", "logResult" ), Type.INT, 0, 1, false )}), 1, 1, false );
        private static ComplexType _complexType( Element[] elements )
            ComplexType result = new ComplexType();
            result.elements = elements;
            return result;
        public void _setProperty(String name, Object value) {
            // TODO Auto-generated method stub
        public Object _getProperty(String name) {
            // TODO Auto-generated method stub
            return null;
        public String echoName(String name) throws RemoteException {
            // TODO Auto-generated method stub
            return null;
        public String helloWorld() throws RemoteException {
            // TODO Auto-generated method stub
            return null;

    Vishnu,
    I'm working on Ludwig's testcase.
    Ludwig's testcase is based on read-only View Objects.
    Is it also the case in your application ?
    I was unable to reproduce with VOs based on EOs.
    With read-only VOs, you can avoid the ArrayIndexOutOfBoundsException by setting the "Key Attribute" property for the PK of the Master VO.
    See the ADF Developer's Guide, topic "7.9.3 What You May Need to Know About Enabling View Object Key Management for Read-Only View Objects"
    URL: http://download-uk.oracle.com/docs/html/B25947_01/bcvoeo009.htm#BABJEEFA
    Regards,
    Didier.

  • "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

  • Exception while accessing com port from servlet

    I am trying to access communication port from a Servlet using java communications api's.
    But Following exception was thrown
    Caught java.lang.NullPointerException:name can't be null while loading driver com.sun.comm.Win32Driver
    The SecurityManager do not allow that opeartion.
    java.security AccessControlException:access denied (java.io.FilePermission c:\j2sdk1.4.1\jre\lib\javax.comm.properties delete)
    at java.security.AccessControlContext.java:270) at java.security.AccessController.checkPermission(SecurityManager.java)
    at java.lang.SecurityManager.checkDelete()
    at java.comm.CommPortIdentifier.getPortIdentifiers(CommportIdentifier.java)
    Please help me.Tell me what to do.how to successfully access a communication port from a Servlet.

    Hi there. I am also facing the problem accessing com port via servlet. if u have the solution, kindly forward to me at [email protected]
    many thanks

  • Accessing ACTIVE DIRECTORY FROM JAVA CODE

    I am trying to access the Active DIrectory user through a java code.
    Kindly let me know the steps apart from creating the user in ADS to be followed so that the following java code may work.
    presently it is giving the following error.
    problem serching the directory
    //package com.axa;
    import java.util.Hashtable;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    import javax.naming.*;
    public class AdHelper
         public static void main(String args[])
    System.out.println("1");
              Hashtable env = new Hashtable();
              String adminName = "CN=user,CN=Users,DC=BDC4AXA.CO.IN";
              String adminPassword = "user";
              String ldapURL = "ldap://10.1.242.51:636";
    System.out.println("2");
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              env.put(Context.PROVIDER_URL,ldapURL);
    System.out.println("3");
              try {
                   // Create the initial directory context
                   DirContext ctx = new InitialLdapContext(env,null);
    System.out.println("4");
                   SearchControls searchCtls = new SearchControls();
              System.out.println("5");
                   //Specify the attributes to return
                   String returnedAtts[]={"sn","givenName","mail"};
                   searchCtls.setReturningAttributes(returnedAtts);
                   //Specify the search scope
                   searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                   //specify the LDAP search filter
                   String searchFilter = "(&(objectClass=user)(mail=*))";
    System.out.println("6");
                   //Specify the Base for the search
                   String searchBase = "DC=ANTIPODES,DC=COM";
    System.out.println("7");
                   //initialize counter to total the results
                   int totalResults = 0;
                   // Search for objects using the filter
                   NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
    System.out.println("8");               //Loop through the search results
                   while (answer.hasMoreElements()) {
              SearchResult sr = (SearchResult)answer.next();
                   totalResults++;
    System.out.println("9");
                   System.out.println(">>>" + sr.getName());
                   Attributes attrs = sr.getAttributes();
                        if (attrs != null) {
                             try {
                             System.out.println(" surname: " + attrs.get("sn").get());
                             System.out.println(" firstname: " + attrs.get("givenName").get());
                             System.out.println(" mail: " + attrs.get("mail").get());
                             catch (NullPointerException e)     {
                             System.out.println("Errors listing attributes: " + e);
                   System.out.println("Total results: " + totalResults);
                   ctx.close();
                   catch (NamingException e) {
                   System.err.println("Problem searching directory: " + e);
              catch(Exception e)
                   System.out.println("Unhandled Exception: " + e);
    }

    This is what I have for my LDAP connection.
    public Hashtable<String, String> env = null;
         public LdapContext ldapContext = null;
         public Control[] connCtls = null;
         Context ctx;
         DirContext dirContext;
    public LDAPAuth(String ldapurl) {
              ldapurl = "ldap://" + serverIP + ":389";
              try {
                   env = new Hashtable<String, String>();
                   env.put(Context.INITIAL_CONTEXT_FACTORY,
                             "com.sun.jndi.ldap.LdapCtxFactory");
                   env.put(Context.SECURITY_AUTHENTICATION, "simple");
                   env.put(Context.PROVIDER_URL, ldapurl);
                   env.put(Context.SECURITY_PRINCIPAL, "cn=username,cn=users" + baseName);
                   env.put(Context.SECURITY_CREDENTIALS, "password" + baseName);
                   env.put(Context.SECURITY_PROTOCOL, "ssl");
                   ctx = new InitialContext(env);
              } catch (Exception e) {
                   System.out.println(" bind error: " + e);
                   e.printStackTrace();
              try {
                   ldapContext = new InitialLdapContext(env, connCtls);
              } catch (AuthenticationException e) {
                   System.out.println("Authentication exception " + e);
              } catch (NamingException e) {
                   System.out.println("Naming exception " + e);
         public Attributes fetch(String username) throws NamingException {
              DirContext ctx = new InitialDirContext(env);
              Attributes attributes = ctx.getAttributes(username);
              try {
                   System.out.println("fetching: " + username);
                   Object obj = ctx.lookup("cn=" + username
                             + baseName);
                   System.out.println("cn=" + username + baseName + "is bound to: " + obj);
                   //attributes = obj.getAttributes("");
                   for (NamingEnumeration<?> ae = attributes.getAll(); ae
                             .hasMoreElements();) {
                        Attribute attr = (Attribute) ae.next();
                        String attrId = attr.getID();
                        for (NamingEnumeration<?> vals = attr.getAll(); vals.hasMore();) {
                             String value = vals.next().toString();
                             System.out.println(attrId + ": " + value);
              } catch (NamingException e) {
                   System.out.println(" Problem looking up " + username + baseName + ". " + e);
              return attributes;
    Now, I'm sure it has something to do with how I'm passing in the username and the groups. But I want to have ANY user log in, not just this test. I may be a little confused on how this works, but if anyone could explain to me why what I am trying to do doesn't work, I would greatly appreciate it.
    Thanks in advance,
    Tetsuya.
    Edited by: tetsuyamasamune on Sep 8, 2008 3:55 PM

  • Use COM (Component Object Model) libraries

    I am new in Java but can write simple application already.
    Now I have a need to write a simple application to manage my Nokia cellphone via a cable. I have downloaded the Nokia PC Connectivities SDK already. In the manual, it states that "all the libraries are implemented as COM (Component Object Mode) Libraries". All examples inside are Visual Basic...
    How can I make use of the libraries in Java? What area of Java should I study for this purpose?
    Thanks a lot.

    Sun has a Java-COM bridge somewhere on the Java website for this purpose. Also, there are a heap of third-party ones too, both commercial and open-source. Just search for 'Java COM bridge' on Google.

  • Import COM.dll in java source?

    Is there a way to import a DLL from a COM-object into java source code? And if so, how does it work?

    I have a COM interface and need to use its methods etc. within Java. My Java program has to access the methods decared in my COM interface. So somehow i have to import it or how does that work?

Maybe you are looking for