(1) Where did you find the OracleLoadJava task for Ant?
(2) I loaded all JBoss-3.2.1/client jars *except* jbossall-client.jar (figuring it was redundant). Again, I'll probably start from scratch to see if I can pare down what is needed. After recompiling the INVALID classes, I'm still showing 488 classes that are marked INVALID. Many of them look pretty fundamental (i.e., necessary), so I'm wondering once we move beyond a trivial example if this will continue to work.
(3) Your steps say to recompile these INVALID classes. I found that the following accomplishes the same thing, and gets done much faster:
- First, load all the jar files without resolving. Don't know how to do this in Ant, but from a command line you can do it like this:
call loadjava -user GUYR/[EMAIL PROTECTED] concurrent.jar
- Then make a second pass through all the jars, this time invoking the resolver. This looks like this:
call loadjava -resolve -resolver "((* GUYR) (* PUBLIC))" -user GUYR/[EMAIL PROTECTED] concurrent.jar
Nicholas wrote:
I went back to reproducs this, and the process was
this using Windows XP Professional
JBoss jboss-3.2.0_tomcat-4.1.24
Oracle Enterprise Version 9.2.0.1.0
1. LoadJava the entire JBoss Client Jar collection into SCOTT. <project name="OracleLoadJavaExample" default="all" basedir="."> <taskdef name="OracleLoadJava" classname="org.apache.tools.ant.taskdefs.optional.oraclejava.OracleLoadJava"/> </target> <target name="all"> <patternset id="all.jars"> <include name="**/*.jar"/> </patternset> <OracleLoadJava oci="on" user="SCOTT/[EMAIL PROTECTED]" resolve="on" debug="on" force="no" noverify="on" verbose="on" noserverside="on" schema="scott" synonym="on" time="on"> <fileset dir="C:/jboss-3.2.0_tomcat-4.1.24/client"> <patternset refid="all.jars"/> </fileset> </OracleLoadJava> </target> </project>
2. Recompile all the invalid classes. To do this, generate a script with this SQL logged in as SCOTT:
select 'ALTER JAVA CLASS SCOTT."' || object_name || '" COMPILE;' from USER_OBJECTS where object_type in ('JAVA CLASS', 'JAVA SOURCE') and status = 'INVALID'
Run the script that is generated.
3. Grant the following rights to SCOTT:
dbms_java.grant_permission( 'SCOTT',
'SYS:java.net.SocketPermission', '<IP ADDRESS>:1024-',
'listen,resolve' ); dbms_java.grant_permission( 'SCOTT',
'SYS:java.net.SocketPermission', '<IP ADDRESS>:3495',
'connect,accept,resolve' );
dbms_java.grant_permission(
'SCOTT','SYS:java.lang.RuntimePermission','org.jboss.security.SecurityAssociation.getPrincipalInfo',
'' );
dbms_java.grant_permission(
'SCOTT','SYS:java.io.SerializablePermission',
'enableSubstitution', '' );
dbms_java.grant_permission( 'SCOTT',
'SYS:java.net.SocketPermission','<IP ADDRESS>:8093',
'connect,resolve' );
There may be some extra ones in there. I was also trying to communicate with some JMS processes, but generally, Oracle will tell you exactly which permissions you need in the error message if you fail to have one.
3. Load EJB. Again, I used the Ant task and loaded the JAR I deployed to JBoss and a simple test client of a simple EJB:
EJB:
import javax.ejb.*;
public class StringLibBean implements SessionBean {
SessionContext sessionContext;
public void ejbCreate() throws CreateException {
}
public void ejbRemove() { }
public void ejbActivate() { }
public void ejbPassivate() { }
public void setSessionContext(SessionContext
sessionContext) {
this.sessionContext = sessionContext;
}
public String reverse(java.lang.String a) {
return new StringBuffer(a).reverse().toString();
}
}
Client Code:
public static String reverse(String ejbName, String
message) {
System.out.println("reverse(" + ejbName + "," +
message + ");");
try {
if(ctx==null) {
ctx = getJBossContext();
System.out.println("Aha! Connnected To :" +
ctx.getEnvironment().get(ctx.PROVIDER_URL));
}
if(home == null) {
System.out.println("Looking Up:" + ejbName);
Object obj = ctx.lookup(ejbName);
System.out.println("Found Object Ref:" + obj);
home = (StringLibHome)obj;
System.out.println("Cast to Home");
}
remote = home.create();
String tmp = remote.reverse(message);
System.out.println("StringLib.reverse Result:" +
tmp);
return tmp;
}
catch (Exception ex) {
System.err.println("Exception:" + ex);
ex.printStackTrace();
return null;
}
}
public static Context getJBossContext() throws
Exception {
Properties p = new Properties();
p.put(Context.PROVIDER_URL, "localhost:1099");
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
return new InitialContext(p);
}
4. Recompiled invalid Java Classes again.
5. Created test SQL Script (testreverse.sql):
connect scott/[EMAIL PROTECTED] SET SERVEROUTPUT ON DECLARE AA VARCHAR2(30) := 'NULL'; BEGIN dbms_java.set_output(10000); AA := REVERSE('StringLib', 'Calling JBoss From PLSQL'); dbms_output.put_line('Reversed ='|| AA);
END; / exit /
6. Created test command file (reverse.cmd):
@echo off cls sqlplus /NOLOG @testreverse.sql
7. Ran the command file:
C:\test>reverse
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Jun 9 06:07:03 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected. reverse(StringLib,Calling JBoss From PLSQL); Aha! Connnected To :localhost:1099 Looking Up:StringLib Found Object Ref:StringLibHome Cast to Home StringLib.reverse Result:LQSLP morF ssoBJ gnillaC Reversed =LQSLP morF ssoBJ gnillaC
PL/SQL procedure successfully completed.
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.1.0 - Production
I found Oracle to be a little unstable when testing this, but once it is loaded and all the classes are fully compiled in Oracle, it is pretty snappy.
//Nicholas
--- Guy Rouillier <[EMAIL PROTECTED]> wrote:
Nicholas and Stephano, I've tried to get this-------------------------------------------------------
working numerous times in the past, but I'm still not there. You can find my
previous posts on this by searching the archives.
Nicholas, I can load the JBoss classes into the
Oracle JVM using loadjava. But whenever I try to run the simplest
EJB invocation, I get all kinds of errors. Have you successfully invoked
a method on an EJB running under JBoss from within an Oracle stored
procedure? If so, I would very much like details on how you did this. Would make a great HOWTO for this group. Thanks.
Nicholas wrote:
Stefano;
I have had some luck loading classes using a
custom
Ant task. It is really just a wrapper for
LoadJava
but easier to use if you are Ant inclined. It
looks
like this: <patternset id="oracle.load.classes"> <include name="jbossall-client.jar"/> </patternset> <target name="LoadJBossToOracle"> <OracleLoadJava oci="on"
user="SCOTT/[EMAIL PROTECTED]"
resolve="on" debug="on" force="on" noverify="on" verbose="on" noserverside="on" schema="scott" synonym="on" time="on"> <fileset
dir="C:/jboss-3.2.0_tomcat-4.1.24/client">
<patternset refid="oracle.load.classes"/> </fileset> <grant name="scott"/> </OracleLoadJava> </target>
The keys are the following:
1. Defer resolution until the second pass. (set resolve="on") 2. Recompile all classes when you are done. You
can
generate a script to do this as follows:
select 'ALTER JAVA CLASS <USER NAME>."' ||
object_name
|| '" COMPILE;' from ALL_OBJECTS where object_type
in
('JAVA CLASS', 'JAVA SOURCE') and OWNER = '<USER NAME>'
Run the output as a SQL script. It will take quite
a
long time.......
Anyways, email me off line and I'll send you the
Ant
tasks, examples and doc.
//Nicholas
--- Stefano Maestri <[EMAIL PROTECTED]> wrote:
We are trying to write a java Stored procedure for
oracle that call a session bean. We are experiencing some troble because when
we set the InitialContext we get an error because
org.jnp.interfaces.NamingContextFactory is not present in Aurora. We tryied to load it (extracted
from jbossall-client.jar),
but Oracle failed to resolve that class. We tryied
also to load all jbossall-client.jar with a lot of resolving error.
Ideas? Domeone had already did something like
that.
We are using Jboss-3.2.1 for the bean (and for the jabossall-client.jar)
and
Oracle 9.2 on HP-UX for the DB.
Thanks a lot for the attention.
P.S.: We had not also javax.ejb in Aurora, but it load correctly.
--
--------------- all work and no play makes Jack a
dull boy --------------- bye Stefano [EMAIL PROTECTED]
www.javalinux.it
MSN messanger: [EMAIL PROTECTED] ICQ uin: 122192578
Jabber: canezen
Yahoo MSN: canezen
#jedit IRC channel as <maeste>
https://lists.sourceforge.net/lists/listinfo/jboss-userThis SF.net email is sponsored by: Etnus, makers
of
TotalView, The best thread debugger on the planet. Designed with
thread
debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED]
-------------------------------------------------------
===== Nicholas Whitehead Home: (973) 377 9335 Cell: (201) 615 2716 [EMAIL PROTECTED] Get Your News From The Crowbar:
http://crowbar.dnsalias.com:443/crowbar/
https://lists.sourceforge.net/lists/listinfo/jboss-userThis SF.net email is sponsored by: Etnus, makers
of TotalView, The best
thread debugger on the planet. Designed with
thread debugging features
you've never dreamed of, try TotalView 6 free at
www.etnus.com.
_______________________________________________ JBoss-user mailing list [EMAIL PROTECTED]
-- Guy Rouillier
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
===== Nicholas Whitehead Home: (973) 377 9335 Cell: (201) 615 2716 [EMAIL PROTECTED] Get Your News From The Crowbar: http://crowbar.dnsalias.com:443/crowbar/
------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
-- Guy Rouillier
------------------------------------------------------- This SF.NET email is sponsored by: eBay Great deals on office technology -- on eBay now! Click here: http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user