10 Replies Latest reply on Jul 9, 2004 10:28 AM by nickman

    Call JBOSS EJB from ORACLE

    pedrosalazar

      Greetings,

      I'm trying to call an EJB from an Oracle Java stored procedure as it's described in the Wiki pages:
      http://www.jboss.org/wiki/Wiki.jsp?page=CallingEJBsFromOracleJVM.

      I reproduce the similar steps as described in the article but I'm getting an exception when I do a lookup for the JNDI bean name:

      Connnected To :localhost:1099
      Looking Up: ejb/Test
      javax.naming.CommunicationException: recvfrom() timed out
      Resource temporarily unavailable. Root exception is
      java.io.InterruptedIOException: recvfrom() timed out
      Resource temporarily unavailable
      at java.net.PlainDatagramSocketImpl.peek(PlainDatagramSocketImpl.java)
      at java.net.DatagramSocket.receive(DatagramSocket.java)
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1089)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1196)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:516)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509)
      

      I run the same class that I put in the database as java stored procedure but now outside the database, and it works just fine.

      What is the problem here?

      BTW, in the step 2 (compiling the java classes in the database), I'm getting several warnings in the classes of jboss from jbossall-client.jar.And I'm using the loadjava and dropjava tools from oracle instead the ant task.

      I'm using Oracle 9.2.0.4 and JBOSS 3.2.5.

        • 1. Re: Call JBOSS EJB from ORACLE

          Pedro;

          Did you set resolve=on when you loaded the client.jar into Oracle ?

          • 2. Re: Call JBOSS EJB from ORACLE
            pedrosalazar

            Yes I did.

            I set the resolve=on for the jbossall-client.jar plus my EJB interfaces and for the proxy class. Are any other classes (jar files) need to be loaded to oracle?

            I also compiled the invalid classes in oracle:

            select 'ALTER JAVA CLASS &1.."' || object_name ||
            '" RESOLVER ((* USER)(* OTHER)(* PUBLIC)) COMPILE;'
            from ALL_OBJECTS where object_type in
            ('JAVA CLASS', 'JAVA SOURCE') and status = 'INVALID' and OWNER = 'USER';
            


            But I get always a few that still invalid in the end. If I'm not mistake, about 537 classes.

            Thanks.

            Regards,
            Pedro Salazar.

            • 3. Re: Call JBOSS EJB from ORACLE

              Now I am not sure. I will see if I can reproduce this on Oracle 9.2.0.4. What platform are you on ?

              • 4. Re: Call JBOSS EJB from ORACLE
                pedrosalazar

                Hi nickman,

                I just tested now in Oracle Server 9.2.0.5 (before I had tried in 9.2.0.4), but the problem remains.
                I only submitted in the database the jbossall-client.jar (537 classes unresolved).
                Can you tell me what jars did you loaded to your database? And from jboss version?

                Another info:

                -I'm testing in a Linux environment, with Oracle Server 9.2.0.{4,5} and JBOSS 3.2.5.

                -I only granted the following privileges (the ones that oracle complained):

                call dbms_java.grant_permission(
                 'UIF',
                 'SYS:java.net.SocketPermission',
                 'localhost:1024-',
                 'listen,resolve' );
                call dbms_java.grant_permission(
                 'UIF',
                 'SYS:java.net.SocketPermission',
                 '230.0.0.4',
                 'connect,accept,resolve');
                


                -And here it goes the properties I set:
                 java.util.Properties p = new java.util.Properties();
                 p.put(Context.INITIAL_CONTEXT_FACTORY,
                 "org.jnp.interfaces.NamingContextFactory");
                 p.put(Context.URL_PKG_PREFIXES,
                 "org.jboss.naming:org.jnp.interfaces");
                 p.put(Context.PROVIDER_URL,
                 "localhost:1099");
                 ic = new javax.naming.InitialContext(p);
                


                Regards,
                Pedro Salazar

                • 5. Re: Call JBOSS EJB from ORACLE

                  Windows XP Professional
                  JBoss jboss-3.2.0_tomcat-4.1.24
                  Oracle Enterprise Version 9.2.0.1.0

                  You can see the narrative of a prior thread starting here: http://www.mail-archive.com/jboss-user@lists.sourceforge.net/msg28259.html//www.mail-archive.com/jboss-user@lists.sourceforge.net/msg28259.html

                  • 6. Re: Call JBOSS EJB from ORACLE
                    pedrosalazar

                    Well, I'll try to download the jbossall-client.jar from jboss 3.2.0 release, to see if with those client jars work (I'll post later the results).

                    Another interesting issue is that even with jboss stopped, the error is the same (recvfrom() timed out).
                    Could it be that a request from Oracle to JBOSS (even down), never got its response (OK or FAILURE) because oracle server is blocking the reply? ... just guessing...

                    Can you tell me exactly the permissions granted on oracle in your succefull test? I already tried all the referred ones in wiki and in the other jboss thread, but nothing.

                    When you got the results of your test, now in Oracle Server 9.2.0.4, give a feedback here, please.

                    Thanks.

                    Regards,
                    Pedro Salazar.

                    • 7. Re: Call JBOSS EJB from ORACLE
                      pedrosalazar

                      With the jbossall-client.jar from jboss 3.2.0, I still get unresolved classes (351 against 537 of jboss 3.2.5) but it should be normal because, for instance, the JASS classes are not included in the bundle jbossall-client.jar. The question is why call jbossall-client.jar if it doesn't contains really all the classes?

                      So, the only difference now is oracle version: 9.2.0.1 against my tested versions 9.2.0.{4,5}. Oh, yes the O.S. too. Linux against Windows :-)

                      When you get more info about this, please post here.

                      Regards,
                      Pedro Salazar.

                      • 8. Re: Call JBOSS EJB from ORACLE

                        Pedro;

                        If you are intent on going down this road, I recommend you adopt an alternate approach. Even though I believe it is possible to make the JBoss client run in the Oracle VM, it is still unpredictable and inherently unsupportable. However, Oracle has AQ/JMS which can work as well, is easier to set up, probably performs faster and is more stable.

                        You basically need to set up a command pattern and have PL/SQL package up the command in a message and publish it. Then you have an MBean or an MDB listening on that queue, retrieving the command package and executing it.

                        Honestly, I think you will be happier witth that approach, although I do not know exactly what you are doing :) .......

                        //Nicholas

                        • 9. Re: Call JBOSS EJB from ORACLE
                          pedrosalazar

                          Hi Nicholas,

                          How strange..., I was just reading something about Oracle AQ/JMS. But I'm still not aware how it works.

                          Do you say I can send a JMS message to a destination queue registered outside in a JBOSS server on message driven?

                          Or it sends only messages to oracle queues itself?

                          regards,
                          Pedro Salazar.

                          • 10. Re: Call JBOSS EJB from ORACLE

                             

                            Do you say I can send a JMS message to a destination queue registered
                            outside in a JBOSS server on message driven?


                            Yes.