php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8280 Segmentation violation
Submitted: 2000-12-15 11:14 UTC Modified: 2001-03-09 20:45 UTC
From: jzacarias at somm dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.3pl1 OS: Linux 2.2.17 on i386
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jzacarias at somm dot com
New email:
PHP Version: OS:

 

 [2000-12-15 11:14 UTC] jzacarias at somm dot com
hi guys,

I have a problem when i try to call a java class from PHP code.

The problem is the following:
I have a weblogic server that server me EJB, I try to call
an EJB from this weblogic server that is in another machine, but always that I try to call the function "", that is necessary to call EJB.

The source of the java client code is:

/****************************************
/****************************************
package test;

import javax.ejb.*;
import javax.naming.*;
import java.util.*;

public class TestProxyPHPClient
{
        public static void main(String[] args)
        {
                if (args != null && args.length > 0) {
                        for (int i = 0; i < args.length; i++) {
                                switch(i) {
                                        case 0:
                                        url = args[i];
                                        break;
                                        case 1:
                                        user = args[i];
                                        break;
                                        case 2:
                                        password = args[i];
                                        break;
                                        default:
                                }
                        }
                }

                try {
                        Context ctx = getInitialContext();
                        TestProxyPHPHome home = (TestProxyPHPHome) ctx.lookup("TestProxyPHP");
                        TestProxyPHP the_ejb = home.create();
                        //System.out.println("the_ejb = " + the_ejb.toString());

                        // to do: call business methods
                        System.out.println(the_ejb.getHello());

                        the_ejb.remove();
                }
                catch (Exception e) {
                        e.printStackTrace();
                }
        }

        public static Context getInitialContext()
        throws NamingException
        {
                Properties p = new Properties();
                p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.TengahInitialContextFactory");
                p.put(Context.PROVIDER_URL, url);

                if (user != null) {
                        p.put(Context.SECURITY_PRINCIPAL, user);
                        if (password == null)
                                password = "";
                        p.put(Context.SECURITY_CREDENTIALS, password);
                }
                return new InitialContext(p);
        }

        public String getHello() throws Exception
        {
          String result;
                        Context ctx = getInitialContext();
                        test.TestProxyPHPHome home = (test.TestProxyPHPHome) ctx.lookup("TestProxyPHP");
                        test.TestProxyPHP the_ejb = home.create();
                        //System.out.println("the_ejb = " + the_ejb.toString());

                        // to do: call business methods
                        result = the_ejb.getHello();
                        the_ejb.remove();
                        return result;

          //throw new Exception();
          //return "Hola";
        }

        static String url = "t3://192.168.7.20:7601";
        static String user = null;
        static String password = null;

}

/****************************************
/****************************************


The apache server give me this error in the error_log:


********************************************
********************************************

SIGSEGV   11*  segmentation violation
    si_signo [11]: SIGSEGV   11*  segmentation violation
    si_errno [0]: Success
    si_code [0]: SI_USER [pid: 0, uid: 0]
        stackpointer=0xbfffd564

Full thread dump Classic VM (1.2.2_006, native threads):
    "Finalizer" (TID:0x40f78320, sys_thread_t:0x82b7940, state:CW, native ID:0xc04) prio=8
        at java.lang.Object.wait(Native Method)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:108)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:123)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:170)
    "Reference Handler" (TID:0x40f783b0, sys_thread_t:0x82ad858, state:CW, native ID:0x803) prio=10
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:420)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)
    "SIGQUIT handler" (TID:0x40f783e0, sys_thread_t:0x82b2220, state:R, native ID:0x402) prio=5
    "main" (TID:0x40f781e0, sys_thread_t:0x8231fb0, state:R, native ID:0x400) prio=5
Monitor Cache Dump:
    java.lang.ref.ReferenceQueue$Lock@40F78338/40FAE028: <unowned>
        Waiting to be notified:
            "Finalizer" (0x82b7940)
    java.lang.ref.Reference$Lock@40F783C0/40FADB20: <unowned>
        Waiting to be notified:
            "Reference Handler" (0x82ad858)
Registered Monitor Dump:
    utf8 hash table: <unowned>
    JNI pinning lock: <unowned>
    JNI global reference lock: <unowned>
    BinClass lock: <unowned>
    Class linking lock: <unowned>
    System class loader lock: <unowned>
    Code rewrite lock: <unowned>
    Heap lock: <unowned>
    Monitor cache lock: owner "main" (0x8231fb0) 1 entry
    Thread queue lock: owner "main" (0x8231fb0) 1 entry
    Monitor registry: owner "main" (0x8231fb0) 1 entry

********************************************
********************************************


This error is in the line of the java code :
       return new InitialContext(p); 

Otherwise, if I call this code in the same server like a normal java code:
    java -classpath (classpath equal to php.ini) TestProxyPHPClient

works perfecly.

The source of the php page is:

***********************************
***********************************

<html>
<?

  $system = new Java("test.TestProxyPHPClient");
  print "PreGet<br>";
  print $system->getHello();
?>
</html>

***********************************
***********************************

Thanks in advance,
Jordi


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-28 13:35 UTC] akilov@php.net
I'm not sure but I think new Java("name") is designed to invoke a constructor (not a standalone class that contains a main() function).
 [2000-12-29 03:22 UTC] jzacarias at somm dot com
I tried to make the same with a class with a constructor and the problem was the same.

Maybe, it's because I didn't enable the socket support when I configured my apache with php4 with support to Java?
 [2001-01-13 13:42 UTC] cynic@php.net
have you tried that with socket support enabled? did it help?
 [2001-03-09 20:45 UTC] sniper@php.net
No feedback.


--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 03 19:01:28 2024 UTC