Problem Calling JNI from a servlet

Hi guys,
How can I trace a C program called from a servlet using JNI ? The problem is a cant see the standard output of the C program because I call it from an applet, not from the console. I would preffer not to generate an error output from the C program, only see the text output this program outputs to the console.
Thanks.

Have you tried adding a pipe to the calling command?
For example:
Process p = Runtime.getRuntime().exec("myutil.exe > output.txt");
p.waitFor();
Once the program has finished, the output from the myutil.exe can be found in the file output.txt.
HTH

Similar Messages

  • Calling JNI from my servlet

    Hai,
    I am using a servlet and I am calling the JNI method, but it is throwing an error like
    "java.lang.UnsatisfiedLinkError: check_file". (check_file is my JNI method.)
    I have checked the included header file name and function name, they are proper and correct. Can any one tell me some solution forthis problem. Thanks in advance.
    Bala

    Hai ,
    I found the solution for this query from jguru forum. I thought it will be helpful for persons like me, so i am posting it here. Consider the flg. example.
    All programs are under package "com.myprogram"
    MyServlet.java (My servlet program)
    GetInfo.java (My Java link program)
    GetInfofromCLib.c(My JNI interface program)
    MyServlet.java ---> Servlet that calls the get_info() native method of GetInfo.java
    ******GetInfo.java*****
    public class GetInfo
    public native void get_info();
    static{
    System.load("/usr/home/com/myprogram/mylib.so");
    so now if u create "javah -jni GetInfo"
    it will create the function name like
    Java_get_1info(JNIEnv*, jobject);
    but we need to rewrite this function name, so that it is representing the total path as
    Java_com_myprogram_get_1nfo(....);
    And also in the GetInfofromCLib.c we need to refer this way. Hope this will help others......
    Thanks,
    Bala....

  • [Fwd: Security problem accessing MBeanServer from a servlet]

    Reposting to Security and Servlet newsgroups.
    -------- Original Message --------
    Subject: Security problem accessing MBeanServer from a servlet
    Date: 10 Feb 2004 13:02:09 -0800
    From: Alain <[email protected]>
    Reply-To: Alain <[email protected]>
    Organization: BEA NEWS SITE
    Newsgroups: weblogic.developer.interest.management
    Hi,
    I am trying to understand how WLS 7.0 secures a call to an MBean. Got
    the following
    scenario:
    - I am in a servlet context
    - I have created and registered an MBean with the WLS MBeanServer. Fine
    so far
    - Within the same call I can retrieve the MBean attributes. Fine so far
    - I keep the MBeanServer reference in an object global to the servlet
    context
    The problem:
    - When I do another request and try to use the cached MBeanServer
    instance to
    access the MBean, I get the following error:
    weblogic.management.NoAccessRuntimeException: Access not allowed for
    subject:
    principals=[], on ResourceType ...
    Any idea?
    Alain

    PaulF <paulf@reply_in_newsgroup.com> wrote:
    On 10 Feb 2004 13:02:09 -0800, Alain <[email protected]> wrote:
    Hi,
    I am trying to understand how WLS 7.0 secures a call to an MBean. Got
    the following
    scenario:
    - I am in a servlet context
    - I have created and registered an MBean with the WLS MBeanServer.Fine
    so far
    - Within the same call I can retrieve the MBean attributes. Fine sofar
    - I keep the MBeanServer reference in an object global to the servlet
    context
    The problem:
    - When I do another request and try to use the cached MBeanServer
    instance to
    access the MBean, I get the following error:
    weblogic.management.NoAccessRuntimeException: Access not allowed for
    subject:
    principals=[], on ResourceType ...
    Any idea?
    AlainWhat ResourceType are you trying to access. From the Exception you're
    trying to access it as an Anonymous user (principals=[]) and evidently
    you're attempting to access something that is protected. I can't tell
    what
    from the snippet you've included.
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
    Thanks Paul for your reply.
    You are right. I can access my custom MBeans if I am authenticated for example
    as an Administrator. My problem is that I want any application to access this
    MBean authenticated or not. I am trying to find how I could grant permission to
    this MBean to everyone. Still searching.
    Thanks.

  • Problem calling simplebutton from library

    Hi guys,
    I'd like to ask for your assistance. I have a problem calling
    SimpleButton from library. I already checked the Linkage:Export for
    actionscript but still an error appear "Call to a possibly
    undefined method OkBtn". I'm just wondering because this method
    works on my MovieClips except for SimpleButtons. Is there another
    way to call SimpleButtons?
    Here's my code calling MovieClip:
    var mc:MovieClip = new ourProduct();
    and same in calling my SimpleButton:
    var myOkBtn:SimpleButton = new OkBtn();
    please help.
    Thank you very much

    Hi again,
    Since I could not call my SimpleButton inside the library, I
    was thinking of putting my button inside the movieclip and call
    that clip inside my library.
    On my stage, I called
    underConstructionPane() movieclip. This
    underConstructionPane contains
    myOkBtn which previously I wanted to call but as a work
    around, I just put it inside
    underConstructionPane movieclip with instance name of
    okBtn. I added eventHandler on
    okBtn which supposed to call
    showHome() function outside
    underConstructionPane.
    showHome() was declared on the stage or root (I don't know
    the correct term. hehehe
    sorry.) but I don't know how to call that function.
    I tried this:
    var home = new showHome();
    but it won't work.
    Please help me
    Thank you.

  • Couldn't Load DLL and Call JNI in Portal Servlet !!!

    Hello,
    I'm trying to write a small test servlet in portal which will call functions in a DLL using JNI. Here is my source code. I put my DLL in \Window\system32, usr/sap/J2E/JC01/j2ee/os_libs, even included into my portal project \PORTAL-INF\lib. But everytime when I try to preview my page, I got the following error and I couldn't find the log file specified in the error message. Please help me out. Thanks a lot!
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    MyTestDLL.
    Exception id: 12:25_23/12/06_0029_11241950
    See the details for the exception ID in the log file
    Source Code:
    import com.sapportals.portal.prt.component.*;
    public class CIViewTest extends AbstractPortalComponent
         public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
              response.write("Hello From Java Servlet!!!\n");
         static {
              try {
                   Runtime.getRuntime().loadLibrary("MyTestDLL");
    // I've also tried System.LoadLibrary("MyTestDLL");
              } catch (UnsatisfiedLinkError ule) {
                   throw ule;

    Nobody used JNI in Portal Servlet??? Please advice. Thanks!

  • Calling XSQL from java servlet

    I'm able to call XSQL, process the page, and display it. But, how do I set the stylesheet from within my java servlet.
    I tried params.put( "xml-stylesheet", "[path to sheet]" ), and then passing that to process(), but it just ignores it. I want to be able to set the stylesheet dynamicaly like when you call XSQL from the command line or from the XSQL servlet.
    XSQLRequest req = new XSQLRequest( xsql );
    Hashtable params = new Hashtable(2);
    params.put( "mths", "6");
    params.put( "run_id", "30");
    params.put( "grade", "A" );
    params.put( "xml-stylesheet", xsl ); <-- just seems to ignore this.
    ByteArrayOutputStream ostr = new ByteArrayOutputStream(2048);
    req.process( params, ostr, new PrintWriter(System.err) );

    Thanks for the help Steve (and thanks for a really nice book by the way.)
    To answer your first question, I have implemented a report caching servlet. In the application we're writing, reports are generated in HTML or PDF (using XSQL) on demand. However, the data really only changes once a day at most so I wanted to have a way to store the reports once they were generated. So this servlet basically gets the request for a report, checks to see if the report has already been generated and, if not, generates the report using XSQLRequest. Finally it returns the report to the user.
    One benefit to doing this is that it masks the generation process from the user (ie, they can just hit a link like http://somehost/path/to/report.pdf and they get a pdf report.) Of course the other benefit is that reports only need to be generated once, reducing server load.
    I will definitely try your suggestion and just redirect to the XSQL servlet. I guess I was thinking about it too hard, this is a simple solution which will probably address the problem with a minimum of fuss. ;o) Using XSQLRequest directly works, it's just that I want to be able to reference external images using relative paths... it's funny that relative references to XSL pages works though.
    Thanks again,
    Van
    null

  • Calling JNI from a java sp.

    I read in 8.1.5 docs that JNI is not enabled in the Oracle JVM (for customers)
    Still the case in in 8.1.7?
    Has anyone (Brian?) had success when making RMI calls from the Oracle JVM?
    Thanks,
    Matt
    [email protected]

    Well, the problem with JNI, is a difficult issue. See, the C code would have to be linked with the Oracle executable itself and if not functionning properly (er, say core-dumping, or referencing random places in memory) could corrupt the quality of your precious data in the database. (For example, bogus code could overwrite data in the buffer caches). So JNI is indeed here and used in-house for most natives but is not available for customers. Sigh.
    Now, doing an RMI callout to a standalone RMI server that uses JNI is a GOOD IDEA. It's functional and recommended.
    The issues about RMI and scalability is when you want to use oracle itself as an RMI server. Not when you want to do RMI callouts.
    Hope this helps,
    matthieu

  • Calling application from a servlet

    Hi,
    I am having trouble sending automated email messages from a servlet. Someone else in this office has had luck with getting an application to send email. I was wondering if my servlet could call the application .class file? It is possible for a servlet to call an application and if so how do I do it?
    Thanks

    // you need activation.jar in you class path
    // also note that your SMTP host may have to allow relaying from your
    / ip address
    import java.io.*;
    import java.net.InetAddress;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    * @author Scott Shaver
    * @version
    public class EMailMessage {
    private static String mailHost = null;
    private static String to = null;
    private static String subject = null;
    private static String from = null;
    private static String text = null;
    private static String cc = null;
    private static String bcc = null;
    private Vector attachments = new Vector(2);
    private boolean bodyIsHTML = false;
    /** Creates new Message */
    public EMailMessage() {
    /** Creates new Message */
    public EMailMessage(String to, String from, String subject, String text) {
    setTo(to);
    setFrom(from);
    setSubject(subject);
    setText(text);
    /** Creates new Message */
    public EMailMessage(String to, String from, String subject, String text, String host) {
    setTo(to);
    setFrom(from);
    setSubject(subject);
    setText(text);
    setMailHost(host);
    public void sendNoExceptions() {
    try
    send();
    catch(Exception x)
    public void send() throws AddressException, MessagingException {
    try
    Properties props = System.getProperties();
    props.put("mail.smtp.host", mailHost);
    MimeBodyPart msgTextBP = null;
    Multipart content = new MimeMultipart();
    Session session = Session.getInstance(props, null);
    javax.mail.Message msg = new javax.mail.internet.MimeMessage(session);
    if(from!=null)
    msg.setFrom(new InternetAddress(from));
    if(to!=null)
    msg.setRecipients(javax.mail.Message.RecipientType.TO,InternetAddress.parse(to, false));
    if(cc!=null)
    msg.setRecipients(javax.mail.Message.RecipientType.CC,InternetAddress.parse(cc, false));
    if(bcc!=null)
    msg.setRecipients(javax.mail.Message.RecipientType.BCC,InternetAddress.parse(bcc, false));
    if(subject!=null)
    msg.setSubject(subject);
    if(text!=null)
    msgTextBP = new MimeBodyPart();
    if(bodyIsHTML)
    msgTextBP.setContent(text, "text/html");
    else
    msgTextBP.setText(text);
    content.addBodyPart(msgTextBP);
    //msg.setText(text);
    msg.setHeader("X-Mailer", "EMailMessage");
    msg.setSentDate(new Date());
    int fac = attachments.size();
    for(int loop=0;loop<fac;loop++)
    File file = (File)attachments.elementAt(loop);
    DataSource source = new FileDataSource(file);
    MimeBodyPart bp = new MimeBodyPart();
    bp.setDataHandler(new DataHandler(source));
    bp.setFileName(file.getName());
    content.addBodyPart(bp);
    msg.setContent(content);
    Transport.send(msg);
    catch(AddressException ax)
    System.out.println("EMailMessage.send() AddressException");
    System.out.println(ax);
    ax.printStackTrace();
    catch(MessagingException mx)
    System.out.println("EMailMessage.send() MessagingException");
    System.out.println(mx);
    mx.printStackTrace();
    public void addAttachment(File a) {
    attachments.addElement(a);
    public void setMailHost(String host) {
    mailHost = host;
    public String getMailHost() {
    return mailHost;
    public void setTo(String to) {
    this.to = to;
    public String getTo() {
    return to;
    public void setSubject(String subject) {
    this.subject = subject;
    public String getSubject() {
    return subject;
    public void setFrom(String from) {
    this.from = from;
    public String getFrom() {
    return from;
    public void setBodyIsHTML() {
    bodyIsHTML = true;
    public void setText(String text) {
    this.text = text;
    public String getText() {
    return text;
    public void setCC(String cc) {
    this.cc = cc;
    public String getCC() {
    return cc;
    public void setBCC(String bcc) {
    this.bcc = bcc;
    public String getBCC() {
    return bcc;
    public static void main(String[] args) {
    /*EMailMessage m = new EMailMessage(
    "[email protected]",
    "[email protected]",
    "This is the subject of a test message.",
    "This is the text of the message.\nThis is another line.",
    "mail");
    try{
    m.send();
    catch(Exception x)
    x.printStackTrace();

  • Problem calling java from vb via activex bridge

    I am trying to call java from vb via ActiveX Bridge and I am running into problems. I would appreciate any help.
    I am using Visual Basic 2010 express, and Java JDK 1.6.0_16. I have used the http://download.oracle.com/javase/1.4.2/docs/guide/beans/axbridge/developerguide/index.html page as a guideline. To try to make it work I took the following steps:
    1. Wrote a very simple java class (below):
    package xxx;
    import java.io.Serializable;
    public class axb implements Serializable {
    public int get_axb_Handle() {
    int Address = 12345678;
    return Address;
    2. After I compiled, and created the jar file. I built the dll using the following command:
    "C:\Program Files\Java\jdk1.6.0_16\bin\packager" -out "C:\Program Files\Java\jdk1.6.0_16\jre\axbridge\bin" E:\axb\dist\axb.jar xxx.axb
    3. I then registered using: regsvr32 axb.dll
    4. In Visual Basic Express IDE I use Project -> Add Reference to add Iterop.axb (dump below), and axb namespace
    5. In my basic code I use the following lines
    Dim axb1 As axb.axb
    axb1 = New axb.axb <== Crash here with AccessViolationException ( full exception below)
    What am I missing? Any help would be greatly appreciated
    Thanks
    Iterop.axb partial dump
    ___[MOD] C:\Documents and Settings\Elie A. Cohen.USINC022\My Documents\Visual Studio 2010\Projects\Repo API Example\Repo API Example\obj\x86\Release\Interop.axb.dll
    | M A N I F E S T
    |___[NSP] axb
    | |___[INT] axb.axb
    | | | .class interface public abstract auto ansi import /*02000006*/
    | | | implements axb.axbDispatch/*02000003*/
    | | | implements axb.axbSource_Event/*02000005*/
    | | | .custom /*0C000018:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 34 45 36 44 30 44 41 38 2D 36 41 45 44 // ..$4E6D0DA8-6AED ...
    | | | .custom /*0C000019:0A000007*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.CoClassAttribute/*01000009*/::.ctor(class [mscorlib/*23000001*/]System.Type/*01000007*/) /* 0A000007 */ = ( 01 00 0C 61 78 62 2E 61 78 62 43 6C 61 73 73 00 // ...axb.axbClass. ...
    | |
    | |___[CLS] axb.axbClass
    | | | .class public auto ansi import /*02000004*/
    | | | implements axb.axbDispatch/*02000003*/
    | | | implements axb.axb/*02000006*/
    | | | implements axb.axbSource_Event/*02000005*/
    | | | .custom /*0C00000F:0A000008*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ClassInterfaceAttribute/*0100000A*/::.ctor(int16) /* 0A000008 */ = ( 01 00 00 00 00 00 ) ...
    | | | .custom /*0C000010:0A000009*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ComSourceInterfacesAttribute/*0100000B*/::.ctor(string) /* 0A000009 */ = ( 01 00 0F 61 78 62 2E 61 78 62 53 6F 75 72 63 65 // ...axb.axbSource ...
    | | | .custom /*0C000011:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 43 44 42 46 36 42 33 33 2D 45 32 33 46 // ..$CDBF6B33-E23F ...
    | | | .custom /*0C000012:0A000002*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.TypeLibTypeAttribute/*01000003*/::.ctor(int16) /* 0A000002 */ = ( 01 00 02 00 00 00 ) ...
    | | |___[MET] method .ctor : void()
    | | |___[MET] method equals : bool(object)
    | | |___[MET] method getClass : object()
    | | |___[MET] method get_axb_Handle : int32()
    | | |___[MET] method hashCode : int32()
    | | |___[MET] method notify : void()
    | | |___[MET] method notifyAll : void()
    | | |___[MET] method toString : string()
    | | |___[MET] method wait : object(object,object)
    AccessViolationException exception
    System.AccessViolationException was unhandled
    Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    Source=mscorlib
    StackTrace:
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    at System.Activator.CreateInstance(Type type)
    at WindowsApplication1.Form1.getPatientHandle_Click(Object sender, EventArgs e) in C:\Documents and Settings\Elie A. Cohen.USINC022\my documents\visual studio 2010\Projects\Repo API Example\Repo API Example\Repo API Example.vb:line 13
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.Run(ApplicationContext context)
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    InnerException:

    In case you haven't figured it out already... Or if anyone else is curious... Or for myself when I get old and forgetful...
    h2. Object Creation
    For starters, when you create an ActiveX object from within VB, use:
    Set myObject = CreateObject("JavaObject.Bean")When I refer to JavaObject.Bean, I'm meaning the full object name + ".Bean". So, in your case, you should use:
    Set myObject = CreateObject("xxx.axb.Bean")h2. Location
    The .dll file must be located in the JRE that is used at the time of calling. Meaning, the .dll file must be placed under <jre_home>\axbridge\bin and registered there.
    In your case:
    DLL:
    C:\Program Files\Java\jre6\axbridge\bin
    Jar:
    C:\Program Files\Java\jre6\axbridge\libh4. A Note:
    The only supported JRE is a 32bit version as far as I know with regards to the ActiveX bridge. Just like the packager.exe can only be found in the 32bit JDK.
    h2. Methods
    h3. Object Types
    ActiveX Bridge does not support passing literals or arrays. However, it does support passing java's primitive data types as Objects.
    Simply meaning:
    h4. Invalid:
    public int get_axb_Handle() {
         int Address = 12345678;
         return Address;
    }h4. Valid:
    public Integer get_axb_Handle() {
         int Address = 12345678;
         return Address;
    }On a normal circumstance, there's little difference between the two methods. However, in the second example, the JVM does a typecast from a literal data type to a object data type, resulting in a valid object to pass through to Visual Basic. Now, obviously there are multiple ways to do a proper change, new Integer(int) for example. It doesn't matter to me. At the end of the day, you have to pass an object.
    As a side note, the same idea applies when receiving data from Visual Basic.
    h4. Invalid:
    public void set_axb_Handle(int newHandle) {
         int Address = newHandle;
    }h4. Valid:
    public void set_axb_Handle(Integer newHandle) {
         int Address =newHandle;

  • Possible problem calling java from Windows DLL

    I'm am developing on Windows NT 4.0 using JDK 1.3.1.
    What I want to do is to create a DLL that calls into java using the Invocation APIs.
    I am able to successfully create a JVM inside my DLL and find the java classes that i need. The problem is if one of those java classes happens to perform a JNDI function (e.g. InitialDirContext), my DLL doesn't ever return from a call to that class's method.
    Does anyone have any suggestions?

    Thanks for your reply.
    All my JNI functions return ok with out error/exception. The problem is, the one function never returns so that I can check for errors/exceptions.
    I found a work around for the problem. For some reason if I wrap the JNI code in a C++ class, the call hangs. But if I pull that code outside a C++ class, it works like it is supposed to. Not sure why this would be the problem.
    Thanks again for your reply

  • Security problem accessing MBeanServer from a servlet

    Hi,
    I am trying to understand how WLS 7.0 secures a call to an MBean. Got the following
    scenario:
    - I am in a servlet context
    - I have created and registered an MBean with the WLS MBeanServer. Fine so far
    - Within the same call I can retrieve the MBean attributes. Fine so far
    - I keep the MBeanServer reference in an object global to the servlet context
    The problem:
    - When I do another request and try to use the cached MBeanServer instance to
    access the MBean, I get the following error:
    weblogic.management.NoAccessRuntimeException: Access not allowed for subject:
    principals=[], on ResourceType ...
    Any idea?
    Alain

    PaulF <paulf@reply_in_newsgroup.com> wrote:
    On 10 Feb 2004 13:02:09 -0800, Alain <[email protected]> wrote:
    Hi,
    I am trying to understand how WLS 7.0 secures a call to an MBean. Got
    the following
    scenario:
    - I am in a servlet context
    - I have created and registered an MBean with the WLS MBeanServer.Fine
    so far
    - Within the same call I can retrieve the MBean attributes. Fine sofar
    - I keep the MBeanServer reference in an object global to the servlet
    context
    The problem:
    - When I do another request and try to use the cached MBeanServer
    instance to
    access the MBean, I get the following error:
    weblogic.management.NoAccessRuntimeException: Access not allowed for
    subject:
    principals=[], on ResourceType ...
    Any idea?
    AlainWhat ResourceType are you trying to access. From the Exception you're
    trying to access it as an Anonymous user (principals=[]) and evidently
    you're attempting to access something that is protected. I can't tell
    what
    from the snippet you've included.
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
    Thanks Paul for your reply.
    You are right. I can access my custom MBeans if I am authenticated for example
    as an Administrator. My problem is that I want any application to access this
    MBean authenticated or not. I am trying to find how I could grant permission to
    this MBean to everyone. Still searching.
    Thanks.

  • How can I call EJB from JSP/Servlets in iWS?

    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

    Park,
    Why Are you running your JSP/Servlets in iWS instead of iAS? For whatever
    reason,
    look at the Converter sample from iAS. You will be doing RMI/IIOP in this
    case and the sample explains in detail what to do.
    hth,
    -robert
    "SungHyun, Park" <[email protected]> wrote in message
    news:9jpfmt$[email protected]..
    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

  • Problem calling WebService from Oracle Forms created by JDeveloper

    Hi All,
    I am trying to call a Webservice from Oracle Form using JAVA Class created by Oracle JDeveloper.
    The Java Function (in JDeveloper) is as follows:
    public Vector GetPIValue(String TagName, String ReadingTime) throws Exception
    URL endpointURL = new URL(endpoint);
    Envelope requestEnv = new Envelope();
    Body requestBody = new Body();
    Vector requestBodyEntries = new Vector();
    requestBodyEntries.addElement(TagName);
    requestBodyEntries.addElement(ReadingTime);
    requestBody.setBodyEntries(requestBodyEntries);
    requestEnv.setBody(requestBody);
    Message msg = new Message();
    msg.send(endpointURL, "http://tempuri.org/GetPIValue", requestEnv);
    Envelope responseEnv = msg.receiveEnvelope();
    Body responseBody = responseEnv.getBody();
    return responseBody.getBodyEntries();
    When this Class is Imported into Oracle Forms the Function is converted into the following PL/SQL code:
    FUNCTION GetPIValue(
    obj ORA_JAVA.JOBJECT,
    a0 VARCHAR2,
    a1 VARCHAR2) RETURN ORA_JAVA.JOBJECT IS
    BEGIN
    Message('param passed: '||a0||' - '||a1);
    cls := JNI.GET_CLASS('oracle/forms/demos/webservice/ConnectToPIStub');
    mid := JNI.GET_METHOD(FALSE, cls, 'GetPIValue', '(Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;');
    args := JNI.CREATE_ARG_LIST(2);
    JNI.ADD_STRING_ARG(args, a0);
    JNI.ADD_STRING_ARG(args, a1);
    Message('I am Here');
    RETURN JNI.CALL_OBJECT_METHOD(obj, mid, args);
    END;
    When I am calling this Function from Within Forms and Passing into it the Parameters, I am displaying some Debugging Messages. When the Code reaches "JNI.CALL_OBJECT_METHOD" there is NO RESPONSE from the Webservice and nothing is moving forward after this Point...
    A similar Webservice that can be Tested is:
    http://www.webservicex.com/CurrencyConvertor.asmx
    with WSDL file:
    http://www.webservicex.com/CurrencyConvertor.asmx?wsdl
    Kindly note that this Webservice is running properly from the Web Browser but the call from Oracle Forms is not Succeeding!!!! :-((
    Any help is much appreciated.
    Regards,
    Baz

    Hi,
    Yes, you need to compile your source files with JDK 1.3 (since JInit 1.3.x.x uses JDK 1.3).
    Other solution would be to use JRE 1.5 (instead of JInitiator).
    Check out [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=550563] on how to use JRE1.5
    -Arun

  • Calling JNI from within a ejb

    Hi,
    I'm trying to call a native method from a EJBean class,using iPlanet App Server, after deployment, when i run, I'm getting the following error,
    "com.netscape.server.eb.UncheckedException: java.lang.Error thrown by impl nextgensecurity.NgtnSecurityBean@1ade762, err = java.lang.UnsatisfiedLinkError: validateinHSM "
    But the same thing is working when tried with a simple java class,
    can any one help regarding this ASAP,
    Thanx in advance
    Kiran

    Hi Joe,
    Thanks a lot for ur reply,
    But the LD_LIBRARY PATH is set to the user that runs the App Server, Since it is throwing a UnsatisfiedLinkError, there must be a problem with the link only(i.e calling native method).
    The flow of data is as follows
    1 A method from ejb calls another java method in an other java class which is in the same jar file,passing the actual arguments.
    2 That java method calls the Native methos residing in the same class file
    3 The Native mentod calls a c function as usual
    My ejb is working fine up to the Native Method call, at this point it is throwing an error
    All my java files are in a package, and my .h file contains package name in the prototype of c function
    If you get any ideas please mail me ASAP
    ThanQ
    Kiran

  • Web Service : problem calling it from PDF.

    Hi everyone,
    I want to make a call to a web service created by SAP/ABAP.
    I have the wsdl file and I created a new data connection in the Adbobe designer.
    I draged and droped the data connection to the editor : so it created
    2 text fields and a button.
    The web service waits from the user to enter an input string and it gives back as an answer a string as output...simple, isn't it ?
    I also added a button in the designer that points to the connection I created. The button is in mode "execute".
    Finally, I saved all this in a PDF file.
    When I double click the PDF file, I enter a string as input and press the button....Then I go an error message saying that I should specify username and password. So I changed the mode of the button from "Execute" to "Submit". I added to the URL my username and password because the web service points to a backend which is SAP.
    Now I do get another error message which is : Cannot handle content type:text/xml; charset=utf-8.
    I read in the doc that maybe I should use XDP ?
    Can someone please explane me how to solve the problem.
    Thanks in advance for the precious help.
    Thanks in advance.
    Regards.

    The problem is caused by the fact that your web service is returning a content-type header of text/html. The reader product can only handle PDF responses from a web server. In any case, your form data is received OK by the web service; it is just the response back that Acrobat cannot handle.
    To get around this, I created a little "thank you for your response" PDF file and put it on my web server. I then set my perl CGI backend script to send a simple redirect to the PDF when it gets a response. (Obviously, you would want to harvest the form values from your user before redirecting). This solved the problem for me.
    My little perl script is shown below:
    #! /usr/bin/perl
    use CGI;
    $query = CGI::new(); # invoke a new CGI object for the input
    @params = $query->param();
    # do something with the values....
    print $query->redirect(-uri => 'http://mycompany.com/myapp/cgi-bin/thankyou.pdf');

Maybe you are looking for

  • Lost menu (side index)

    All of a sudden I've lost the menu on the left side of iTunes that shows my Library, my playlists, links to the ITMS, my shopping cart, etc. How did I do this? How do I get it back? iTunes v7

  • Help me with Hp Probook 4515s

    Hi everybody! (Sorry with my English) I have installed Archlinux x86_64 on my laptop HP Probook 4515s. After installation is completed, restart the computer has been suspended. I also tried with OpenSUSE and Debian, I found the problem in Ethernet ca

  • Item Codes with description in inventory - R12

    Dear All In R12, Inventory module, from where and how to get the item code and item description simultaneously. e.g: Suppose I have an item having 3 segments. I want to display the item code with descriptions like this: 01-Stores | 001-Waste | 0001-C

  • Can anyone explain the advantage of entity beans

    Hi All, I was wondering if anyone can explain the advantage of entity beans versus session beans. We argue that session beans can perform retrival/storage more efficiently than having an extra layer of entity beans. Basically we can't see any advanta

  • Re: Importing of Roland Fantom-S sounds

    Hello, complete noob here with a lame question. Can I import my extra-sweet sounds that were dearly paid for and dutifully placed on my Fantom-S years ago and put them in a place usable by Logic Pro? Does this question make any sense? I had a PC-base