ID: 8280
Updated by: cynic
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Feedback
Bug Type: Unknown/Other Function
Assigned To: 
Comments:

have you tried that with socket support enabled? did it help?

Previous Comments:
---------------------------------------------------------------------------

[2000-12-29 03:22:18] [EMAIL PROTECTED]
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?

---------------------------------------------------------------------------

[2000-12-28 13:35:13] [EMAIL PROTECTED]
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-15 11:14:12] [EMAIL PROTECTED]
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



---------------------------------------------------------------------------


Full Bug description available at: http://bugs.php.net/?id=8280


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to