I wrote the OracleLoadJava task. I just have not got around to submitting it.
I wanted to write a whole set of PL/SQL-JBoss services so I figured I would just load the whole JBoss client dir, but I also noticed a large number of invalid classes. I think we just have to ramp up the complexity of the calls and track what's needed where and for what. I will start docuemnting what you have here and we should compare notes periodically, and I'll put them on a wiki somewhere. Agreed ? //Nicholas --- Guy Rouillier <[EMAIL PROTECTED]> wrote: > Nicholas, I finally got around to trying this, and > it works - thanks! I > struggled with this for about 6 months and got > nowhere (including > working with someone inside Oracle!) I had to go > through several > iterations and fix missing permissions identified in > udump. I really > should delete all Java permissions and start from > scratch to identify > exactly what is needed; I have a bunch already in > there from when I > tried the last time. A couple of points/questions: > > (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); > > } > === message truncated === ===== 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: 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