[JBoss-user] HOWTO: Configure Windows 2000 Server for high-end JBoss-Tomcat

2003-09-01 Thread Sheldon Hearn
As promised, here are my notes on getting a serious JBoss-Tomcat
deployment functional on Windows 2000 Server, assuming you aren't
in a position to use a real operating system.

So I've finally managed to get JBoss-Tomcat working on a dual-Xeon 4GB
Windows 2000 server.

The problems were:

1) Use of the /3GB boot.ini switch radically reduces the number of PTEs
   available.  This results in a very low limit on concurrent threads.

   If you don't need >2GB virtual address space per process,
   don't enable /3GB.  If you can't live without it, see
   http://support.microsoft.com/default.aspx?scid=kb;en-us;313707 for
   information on tuning SystemPages to increase available PTEs.

2) The default Windows 2000 TCP connection backlog is ridiculously
   low (20).  This is a problem for when the server is configured to
   ramp the number of connection handlers up as load increases. See
   http://support.microsoft.com/default.aspx?scid=kb;en-us;142641 for
   information on enabling dynamic backlog handling.

3) The default Windows 2000 local user socket limit is ridiculously
   low (5000).  This is a problem when the server accesses resources
   (such as databases and application containers) over the network. See
   http://support.microsoft.com/default.aspx?scid=kb;en-us;319502 for
   information on increasing this limit to the defaults found on most
   sensible server platforms.

4) [SPECULATION] Windows 2000 imposes an immutable limit on the number
   of open files / handles allowed for a process started from a CMD.EXE
   prompt.  See http://wrapper.tanukisoftware.org/doc/english/ for
   information on installing JBoss-Tomcat as an NT service using the
   Java Service Wapper.

5) [SPECULATION] Windows 2000 imposes a 48MB heap limit for processes
   started via the desktop (22MB for Terminal Services desktops).  The
   solution for (4) above applies.

I don't have KB article references to support (4) and (5).  I read stuff
that led me to believe them, but didn't record references.  However,
running Jboss-Tomcat as an NT service avoided undiagnosed resource
starvation problems not covered in (1) through (3).

With these changes made, a Windows 2000 server can be made to service
a serious JBoss-Tomcat deployment configured to operate under the kind
of load that Unix-like operating systems tend to handle out of the box.
The host is able to service at least 2,000 concurrent HTTP connections
without application server failure.

This does _not_ mean that a Windows 2000 server's _performance_ will
match that of a Unix-like operating system.  At this stage, I'm just
trying to get this rubbish to stay on its feet when I poke it with a
pointy stick.


Ciao,
Sheldon.
-- 
Windows sucks.


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] HOWTO: Call an EJB from an Oracle Java Stored Procedure

2003-06-14 Thread Guy Rouillier
Sure, I'd be willing to help with this, since I'm benefiting from it. 
Two additional thoughts came to mind after I sent my last message:

(1)  Your steps said to load the EJB into Oracle.  Technically, you just 
want to load the home and remote interfaces, and not the bean class. 
With versions 2.x of JBoss, having the bean class in the client 
classpath would make hot deploy appear not to work.  Don't know if that 
is still true in 3.x.

(2)  The Oracle JVM has IIOP support built-in.  I'm wondering if we 
switch to IIOP instead of defaulting to JRMP, if we can eliminate having 
to load a bunch of protocol classes into Oracle.  As an aside, I 
happened to notice reading through some Oracle JVM documentation that 
they specifically say not to do RMI inside Java stored procedures.  It 
said that RMI starts up its own threads, and starting threads in stored 
procs is discouraged since it makes Oracle's session management flaky. 
Oh, well, we'll have to ignore this rule since without RMI we'd be done 
before we started.

Nicholas wrote:

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.
default="all"

basedir=".">


classname="org.apache.tools.ant.taskdefs.optional.oraclejava.OracleLoadJava"/>







dir="C:/jboss-3.2.0_tomcat-4.1.24/client">






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', 'ADDRESS>:1024-',

'listen,resolve' ); 
dbms_java.grant_permission( 'SCOTT',
'SYS:java.net.SocketPermission', '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','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 java

Re: [JBoss-user] HOWTO: Call an EJB from an Oracle Java Stored Procedure

2003-06-14 Thread Nicholas
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.
> >  default="all"
> > basedir=".">
> >  >
>
classname="org.apache.tools.ant.taskdefs.optional.oraclejava.OracleLoadJava"/>
> > 
> > 
> > 
> > 
> > 
> >  > resolve="on" debug="on" force="no" noverify="on"
> > verbose="on" noserverside="on" schema="scott"
> > synonym="on" time="on">
> >  dir="C:/jboss-3.2.0_tomcat-4.1.24/client">
> > 
> > 
> > 
> > 
> > 
> > 
> > 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', ' ADDRESS>:1024-',
> > 'listen,resolve' ); 
> > dbms_java.grant_permission( 'SCOTT',
> > 'SYS:java.net.SocketPermission', ' 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',' 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:
> > 
> >   

Re: [JBoss-user] HOWTO: Call an EJB from an Oracle Java Stored Procedure

2003-06-12 Thread Guy Rouillier
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.














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', ':1024-',
'listen,resolve' ); 
dbms_java.grant_permission( 'SCOTT',
'SYS:java.net.SocketPermission', ':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',':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
A

Re: [JBoss-user] HOWTO: Call an EJB from an Oracle Java Stored Procedure

2003-06-10 Thread Stefano Maestri
Cool!
It works.

Thanks a lot


On Monday 09 June 2003 12:10, 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.
>  basedir=".">
>classname="org.apache.tools.ant.taskdefs.optional.oraclejava.OracleLoadJava
>"/> 
>   
>   
>   
>   
>resolve="on" debug="on" force="no" noverify="on"
> verbose="on" noserverside="on" schema="scott"
> synonym="on" time="on">
>   
>   
>   
>   
>   
> 
>
> 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', ':1024-',
> 'listen,resolve' );
> dbms_java.grant_permission( 'SCOTT',
> 'SYS:java.net.SocketPermission', ':3495',
> 'connect,accept,resolve' );
> dbms_java.grant_permission(
> 'SCOTT','SYS:java.lang.RuntimePermission','org.jboss.security.SecurityAssoc
>iation.getPrincipalInfo', '' );
> dbms_java.grant_permission(
> 'SCOTT','SYS:java.io.SerializablePermission',
> 'enableSubstitution', '' );
> dbms_java.grant_permission( 'SCOTT',
> 'SYS:java.net.SocketPermission',':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.NamingContextFact
>ory"); 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(1);
> 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 lit

[JBoss-user] HOWTO: Call an EJB from an Oracle Java Stored Procedure

2003-06-09 Thread Nicholas
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.















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', ':1024-',
'listen,resolve' ); 
dbms_java.grant_permission( 'SCOTT',
'SYS:java.net.SocketPermission', ':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',':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(1);
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

Re: [JBoss-user] Howto get server/container (real) name/id ? request.getServerName()does not...

2002-12-06 Thread David Ward
Joao,

Because IP_LIB fronts the actual servers, it is correct behavior that 
request.getServerName() returns IP_LIB.  This way, you can use the 
request to build URLs to forward with that the client will actually be 
able to access.

Now, if you want to know the *actual* server the app is running on, do 
not use the Servlet API.  Use java.net.InetAddress.  It has many helpful 
methods.  The specific one you are looking for is this:

java.net.InetAddress.getLocalHost().getHostName().

Note that in JDK1.4 there are a lot more methods added, and also two new 
subclasses (Inet4Address and Inet6Address) that you might find useful.

Hope this helps,
David

--

[EMAIL PROTECTED] wrote:
I think this is server specific, and not java standart so.. forgive me if
I'm wrong:

I would like to report the server name in my servle output, something like
"request receive by 'server1'"

I tried to use the "request.getServerName()" but this reports the name of
the server asked in the request... Not exactly the same:

I have a cluster with a front-end doing layer4 dispatching
(linuxvirtualserver) so I have


IP_LB ---+--- IP_SERV1
  \-- IP_SERV2

I send a http request to IP_LB and it is routed to one of the other two.
If i use a "request.getServerName()" I always get IP_LB as the answer
instead of the name of the server that is really working. I haven0t found
anithyng else in java API that would give the srver/container name, so
maybe jboss api has it?

Thanks
Joao Clemente





---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



--

-
David Ward
[EMAIL PROTECTED]
http://www.dotech.com



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] Howto get server/container (real) name/id ? request.getServerName() does not...

2002-12-06 Thread jpcl
I think this is server specific, and not java standart so.. forgive me if
I'm wrong:

I would like to report the server name in my servle output, something like
"request receive by 'server1'"

I tried to use the "request.getServerName()" but this reports the name of
the server asked in the request... Not exactly the same:

I have a cluster with a front-end doing layer4 dispatching
(linuxvirtualserver) so I have


IP_LB ---+--- IP_SERV1
  \-- IP_SERV2

I send a http request to IP_LB and it is routed to one of the other two.
If i use a "request.getServerName()" I always get IP_LB as the answer
instead of the name of the server that is really working. I haven0t found
anithyng else in java API that would give the srver/container name, so
maybe jboss api has it?

Thanks
Joao Clemente





---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] howto layout mbeans and ejb's in template

2002-10-19 Thread Marco Dubbeld
How should I use the template when developing a package with EJB's and
MBeans together.

Should I build all the classes for MBeans and EJB's under
src/main/ in org..yyy etc?

Or should I make subtree:
src/main/ejb and org..yyy for all ejb's and
src/main/jmx and org..yyy for all mbeans
and modify build.xml?

Sorry if it is a newby quest, but I tried to find a answer in the
forums, payed jboss docs, Wrox j2ee and ejb books without luck.



---
This sf.net email is sponsored by:
Access Your PC Securely with GoToMyPC. Try Free Now
https://www.gotomypc.com/s/OSND/DD
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



Re: [JBoss-user] Howto handle Alternate keys in EJB 2.0 CMP

2002-07-28 Thread Asif Ahmed

Dain:
First of all thanks for your interest, its an Honor.
Well, Alternate key is like a primary key, its just another key. For example if we use a surrogate key (generated artificial keys) for people/person then Social security number would become an alternate key or if we have Userid as unique key it would also be an Alternate key. Anything that is candidate for a primary but is not chosen to be PK becomes an alternate key and thus can also be NULL/changeable over time but UNIQUE. 
The situation I have is of a Unique Key. When I call the set method on the CMP field with a non-unique I get javax.ejb.EJBException: Store failed; CausedByException is:
Invalid argument value: Duplicate entry 'test' for key 2, which actually is thrown to the container not to the caller on the method so it can not be trapped and processed or even interpreted.
What I have done is made custom method over the CMP filed so I can check if the new value is unique or not before actually calling the CMP set method. It does work but it has to make two trips to the DB when it could be done with one the other major problem is that while I check and set the filed/column some other instance can take/use the checked unique value as there is no lock on the table and the caller would not know as the javax.ejb.EJBException is not thrown to the caller but to the container. DB’s typically use indexes and lock the full index as to prevent this. 
I think we need to some how or the other have to indicate to the persistent manager in the jbosscmp-jdbc.xml the fileds which are unique similar to not-null and also tell the container in the mapping that which actual SQLExceptions are thrown to be mapped to these conditions so the solution is independent of a DB provider and then proper Exception should be throws when set methods are called on these fields.
Let me know of your thoughts on this and also how I can help in implementing this. 
-Asif Rafiq Ahmed.
 
Example code:
public void setFullURL(String newFullURL) throws UniqueKeyException {
if(newFullURL!=null && !newFullURL.equals("")){
try{
((LocalOrganizationHome)this.entityContext.getEJBLocalHome()).findByFullURLIgnoreSelf(newFullURL,(LocalOrganization)this.entityContext.getEJBLocalObject());
throw new UniqueKeyException("URL already used");
}
catch(FinderException fe){
this.setFullURLCmp(newFullURL);
}
}
}
 
 

.

 
 
 
 
 
 


*** 

Asif R. Ahmed. 





2954 WEALD WAY# 2721

SACRAMENTO, CA 95833

Day Phone: (916) 730-6831 



Even Phone:(916) 924-8786 



*** 





From: Dain Sundstrom <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED] 
To: [EMAIL PROTECTED] 
Subject: Re: [JBoss-user] Howto handle Alternate keys in EJB 2.0 CMP 
Date: Sat, 27 Jul 2002 18:59:29 -0500 

What is an Alternate key? 

-dain 

Asif R. Ahmed wrote: 
>All: 
> Has anybody an Idea how to handle the Alternate keys elegantly as 
>the Primary Keys are handles in ejb2.0. 
> What is an elegant solution to handle alternate keys in ejb2.0 
>using cmp. When I set a CMP field which represents an alternate key 
>to a already existing value I get javax.ejb.EJBException which has 
>source exception of java.sql.SQLException which can be any db error. 
> I would appreciate an Idea or even an Hint. 
> Thanks in Advance, 
> -Asif Rafiq Ahmed 
> 




--- 
This sf.net email is sponsored by:ThinkGeek 
Welcome to geek heaven. 
http://thinkgeek.com/sf 
___ 
JBoss-user mailing list 
[EMAIL PROTECTED] 
https://lists.sourceforge.net/lists/listinfo/jboss-user 
Chat with friends online, try MSN Messenger: Click Here


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] Howto handle Alternate keys in EJB 2.0 CMP

2002-07-27 Thread Dain Sundstrom

What is an Alternate key?

-dain

Asif R. Ahmed wrote:
> All:
>  
> Has anybody an Idea how to handle the Alternate keys elegantly as the 
> Primary Keys are handles in ejb2.0.
>  
> What is an elegant solution to handle alternate keys in ejb2.0 using 
> cmp. When I set a CMP field which represents an alternate key to a 
> already existing value I get javax.ejb.EJBException which has source 
> exception of java.sql.SQLException which can be any db error.
>  
> I would appreciate an Idea or even an Hint.
>  
> Thanks in Advance,
>  
> -Asif Rafiq Ahmed
>  
>  




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] Howto handle Alternate keys in EJB 2.0 CMP

2002-07-26 Thread Asif R. Ahmed



All:
 
Has anybody an Idea how to handle the 
Alternate keys elegantly as the Primary Keys are handles in ejb2.0. 

 
What is an elegant solution to handle alternate 
keys in ejb2.0 using cmp. When I set a CMP field which represents an alternate 
key to a already existing value I get javax.ejb.EJBException which has source 
exception of java.sql.SQLException which can be any db error. 
 
I would appreciate an Idea or even an 
Hint.
 
Thanks in Advance,
 
-Asif Rafiq Ahmed
 
 


Re: [JBoss-user] HOWTO: Castor 0.9.3.9 with JBoss 2.4.4

2002-02-02 Thread Oleg Nitz


Thanks Emil,

Information for those who want to save time:
Patrick van Kann provided the binary dowload
http://www.arcsin.co.uk/downloads/castorjdoplugin.jar

Oleg

On Friday 01 February 2002 20:27, you wrote:
> Hi,
>
> I wrote to the list a couple of weeks ago with problems getting the
> latest stable Castor (0.9.3.9) to work with JBoss 2.4.4. Well, I sorted
> it out eventually but didn't find any time to write down the procedure
> and send it off to the list.
>
> The basic procedure involves getting the latest known stable version of
> the castor JDO plugin (ie the one that shipped with JBoss 2.4.3) from
> the CVS repository, changing a few lines of code in it and building it
> against the JBoss 2.4.4 jars.
>
> Here's how I did it:
>
>o I downloaded JBoss 2.4.4 into the directory $JBOSS_244 and
>  removed the 0.8.x release of Castor that shipped with
>  it. (in $JBOSS_244/lib/ext)
>o I downloaded JBoss HEAD from CVS into $JBOSS_HEAD.
>o I reverted the Castor stuff from HEAD to the 2.4.3 release. It
>  wasn't tagged, so I had to revert by date.
>
>   > cd $JBOSS_HEAD/plugins/varia/src/main
>   > cvs update -D "2001-10-03"
>
>o Applied the patch below.
>
>o Built it manually against the 2.4.4 jars:
>   > javac -classpath
>
> $JBOSS_244/lib/ext/jboss.jar:$JBOSS_244/lib/jmxri.jar:$JBOSS_244/lib/ext/ca
>stor-0.9.3.9.jar:$JBOSS_244/lib/crimson.jar:$JBOSS_244/lib/ext/log4j.jar
> org/jboss/jdo/castor/*.java o Created a jar.
>
>   > jar cvf $JBOSS_244/lib/ext/jboss-castorjdo-2.4.4.jar
>
> org/jboss/jdo/castor/*.class
>
> Here's the unified diff, generated with "cvs diff -u
> CastorJDOImpl*.java" in org/jboss/jdo/castor. NOTE: This diff is
> generated against a snapshot of the code (Oct 3, 2001), NOT against
> HEAD.
>
> --- 8< ---
> Index: CastorJDOImpl.java
> ===
> RCS file:
> /cvsroot/jboss/contrib/varia/src/main/org/jboss/jdo/castor/CastorJDOImpl.ja
>va,v retrieving revision 1.5
> diff -u -r1.5 CastorJDOImpl.java
> --- CastorJDOImpl.java2001/09/11 20:51:32 1.5
> +++ CastorJDOImpl.java2002/02/01 17:24:33
> @@ -37,7 +37,7 @@
>  import org.exolab.castor.xml.Unmarshaller;
>
>  import org.jboss.logging.log4j.CategoryWriter;
> -import org.jboss.system.ServiceMBeanSupport;
> +import org.jboss.util.ServiceMBeanSupport;
>
>  import org.jboss.proxy.Proxy;
>  import org.jboss.proxy.Proxies;
> @@ -309,7 +309,7 @@
>
>  public PrintWriter getPrintWriter() {
>  if (writer == null) {
> -writer = new CategoryWriter(log);
> +writer = new CategoryWriter(log.getCategory());
>  }
>  return writer;
>  }
> Index: CastorJDOImplMBean.java
> ===
> RCS file:
> /cvsroot/jboss/contrib/varia/src/main/org/jboss/jdo/castor/CastorJDOImplMBe
>an.java,v retrieving revision 1.2
> diff -u -r1.2 CastorJDOImplMBean.java
> --- CastorJDOImplMBean.java   2001/08/30 02:42:38 1.2
> +++ CastorJDOImplMBean.java   2002/02/01 17:24:33
> @@ -14,7 +14,7 @@
>   *   @version $Revision: 1.2 $
>   */
>  public interface CastorJDOImplMBean
> -   extends org.jboss.system.ServiceMBean
> +   extends org.jboss.util.ServiceMBean
>  {
>  public static final String OBJECT_NAME = ":service=CastorJDO";
>
> --- 8< ---
>
> Here's a copy of the built jarfile:
>
>   http://www.eifrem.com/files/java/jboss/jboss-castorjdo-2.4.4.jar
>
> This procedure worked for me. YMMV.

___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] HOWTO: Castor 0.9.3.9 with JBoss 2.4.4

2002-02-01 Thread Emil Eifrem

Hi,

I wrote to the list a couple of weeks ago with problems getting the
latest stable Castor (0.9.3.9) to work with JBoss 2.4.4. Well, I sorted
it out eventually but didn't find any time to write down the procedure
and send it off to the list.

The basic procedure involves getting the latest known stable version of
the castor JDO plugin (ie the one that shipped with JBoss 2.4.3) from
the CVS repository, changing a few lines of code in it and building it
against the JBoss 2.4.4 jars.

Here's how I did it:

   o I downloaded JBoss 2.4.4 into the directory $JBOSS_244 and
 removed the 0.8.x release of Castor that shipped with
 it. (in $JBOSS_244/lib/ext)
   o I downloaded JBoss HEAD from CVS into $JBOSS_HEAD.
   o I reverted the Castor stuff from HEAD to the 2.4.3 release. It
 wasn't tagged, so I had to revert by date.
> cd $JBOSS_HEAD/plugins/varia/src/main
> cvs update -D "2001-10-03"
   o Applied the patch below.
   o Built it manually against the 2.4.4 jars:
> javac -classpath
$JBOSS_244/lib/ext/jboss.jar:$JBOSS_244/lib/jmxri.jar:$JBOSS_244/lib/ext/castor-0.9.3.9.jar:$JBOSS_244/lib/crimson.jar:$JBOSS_244/lib/ext/log4j.jar
 org/jboss/jdo/castor/*.java
   o Created a jar.
> jar cvf $JBOSS_244/lib/ext/jboss-castorjdo-2.4.4.jar
org/jboss/jdo/castor/*.class

Here's the unified diff, generated with "cvs diff -u
CastorJDOImpl*.java" in org/jboss/jdo/castor. NOTE: This diff is
generated against a snapshot of the code (Oct 3, 2001), NOT against
HEAD.

--- 8< ---
Index: CastorJDOImpl.java
===
RCS file:
/cvsroot/jboss/contrib/varia/src/main/org/jboss/jdo/castor/CastorJDOImpl.java,v
retrieving revision 1.5
diff -u -r1.5 CastorJDOImpl.java
--- CastorJDOImpl.java  2001/09/11 20:51:32 1.5
+++ CastorJDOImpl.java  2002/02/01 17:24:33
@@ -37,7 +37,7 @@
 import org.exolab.castor.xml.Unmarshaller;
 
 import org.jboss.logging.log4j.CategoryWriter;
-import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.util.ServiceMBeanSupport;
 
 import org.jboss.proxy.Proxy;
 import org.jboss.proxy.Proxies;
@@ -309,7 +309,7 @@
 
 public PrintWriter getPrintWriter() {
 if (writer == null) {
-writer = new CategoryWriter(log);
+writer = new CategoryWriter(log.getCategory());
 }
 return writer;
 }
Index: CastorJDOImplMBean.java
===
RCS file:
/cvsroot/jboss/contrib/varia/src/main/org/jboss/jdo/castor/CastorJDOImplMBean.java,v
retrieving revision 1.2
diff -u -r1.2 CastorJDOImplMBean.java
--- CastorJDOImplMBean.java 2001/08/30 02:42:38 1.2
+++ CastorJDOImplMBean.java 2002/02/01 17:24:33
@@ -14,7 +14,7 @@
  *   @version $Revision: 1.2 $
  */
 public interface CastorJDOImplMBean
-   extends org.jboss.system.ServiceMBean
+   extends org.jboss.util.ServiceMBean
 {
 public static final String OBJECT_NAME = ":service=CastorJDO";
 
--- 8< ---

Here's a copy of the built jarfile:

http://www.eifrem.com/files/java/jboss/jboss-castorjdo-2.4.4.jar

This procedure worked for me. YMMV.

-- 
Emil Eifrem [[EMAIL PROTECTED]]
Kernel Developer, .windh AB


___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] howto readonly particular cmp fields

2001-09-17 Thread David Ward

I have a CMP 1.1 Entity with some fields who have both set and get 
methods, and some with just gets (both in the remote interface and bean 
class). However, on create, jboss still includes those fields when it 
does an insert. How do I make JBoss not include those fields in the 
PreparedStatement it makes to do the insert? For complex reasons, the 
bean points to an updateable VIEW in Oracle, not a TABLE. The main table 
of the view is where the insert happens, the other joins of the view are 
lookups for read-only purposes.


___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



Re: [JBoss-user] [HOWTO] Autoincrementing Primary Key with CMP

2001-06-28 Thread Konstantin Priblouda


--- Nicolai P Guba <[EMAIL PROTECTED]> wrote:
> Hello Folks
> 
> This question comes up again and again and I must
> admit that it was a
> pretty awkward thing for myself to figure out.
> 
> Big hand to Danch for pointing me in the right
> direction.  What he
> suggested works very well, so I've knocked up a
> quick Test CMP bean
> for proof of concept.  I reckon that quite a few
> people have a similar
> problem and I'm thus sending some sample code.
> 
> Here is the TestBean implementation

IMHO: The point in CMP is that it leaves all the
database mess to container. I'm usig CMP mostly to 
forget about connections and such stuff. 

I still prefer entity bean to do this. 

regards,

=
Konstantin Priblouda ( ko5tik )Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] [HOWTO] Autoincrementing Primary Key with CMP

2001-06-28 Thread Nicolai P Guba

Hello Folks

This question comes up again and again and I must admit that it was a
pretty awkward thing for myself to figure out.

Big hand to Danch for pointing me in the right direction.  What he
suggested works very well, so I've knocked up a quick Test CMP bean
for proof of concept.  I reckon that quite a few people have a similar
problem and I'm thus sending some sample code.

Here is the TestBean implementation

===
package com.frontwire.cams.entity.test;

import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;

import com.frontwire.util.beanext.ExtendedJDBC;

public class TestBean implements EntityBean
{
public String id;
public String name;

public EntityContext ctx;

public String getName() throws RemoteException 
{
return this.name;
}

public void setName( String name ) throws RemoteException 
{
this.name = name;
}

public String ejbCreate( String name ) throws RemoteException, CreateException
{
Connection connection = ExtendedJDBC.getConnection();
this.id = ExtendedJDBC.getInsertId( connection );
this.name = name;
return null;
}

public void ejbPostCreate( String name ) throws RemoteException, CreateException
{
}

public void ejbActivate() throws RemoteException {
}

public void ejbPassivate() throws RemoteException {
}

public void ejbLoad() throws RemoteException {
}

public void ejbStore() throws RemoteException {
}

public void ejbRemove() throws RemoteException {
}

public void setEntityContext(EntityContext ctx) throws RemoteException {
this.ctx = ctx;
}

public void unsetEntityContext() throws RemoteException {
this.ctx = null;
}

}// TestBean

===

ExtendedJDBC is effectively a helper class I use for getting db
connections and retrieving the values for the primary key in the db.

Here are the relevant methods.  Note that I'm setting the name of the
database to connect to from an environment variable.

===
public static Connection getConnection()
{
try {
InitialContext context = new InitialContext();
String poolname = 
(String)context.lookup( "java:/comp/env/DatabasePoolName" );

String jndiName = "java:/" + poolname;
DataSource ds = 
(DataSource)context.lookup( jndiName );
return ds.getConnection();  
}
catch( NamingException e ){
throw new EJBException( e.getMessage() );
}
catch( SQLException e ){
throw new EJBException( "ExtendedJDBC: SQLException: " + e.getMessage());
}
}

public static String getInsertId( Connection c )
{
String queryInsertIdMySQL = "SELECT LAST_INSERT_ID()";
String insertId = null;

try {   
PreparedStatement s = c.prepareStatement( queryInsertIdMySQL );
ResultSet r = s.executeQuery();
if( r.next() ) {
insertId  = r.getString( "last_insert_id()" );
try {
r.close();
}
catch( SQLException e ){
throw new EJBException( "getInsertId: ResultSet.close() "
 + e.getMessage() );
}
try {
s.close();
}
catch( SQLException e ){
throw new EJBException( "getInsertId: PreparedStatement.close() "
 + e.getMessage() );
}
}
else {
throw new EJBException( "getInsertId: NULL insertId" );
}
return insertId;
}
catch( SQLException e ){
throw new EJBException( "getInsertId: " + e.getMessage() );
}
}
===

I've started thinking about supporting retrieving the auto-increment
value for different databases.  I wouldn't expect the method/sql
changing very much though.  And in future implementation will probably
use an environment variable for determining which query to use for
retrieving that value.

Now I wonder whether one couldn't provide a similar utility with
JBoss?  Some other vendors, like Orion, provide a helper package for
getting the next primary key value for a given class (probably a very
similar implemntation like PostgreSQL uses for sequences [a much
better way of doing it than mySQL IMO]).

Not all databases support such feature.  

RE: [JBoss-user] howto for a webapp.

2001-06-11 Thread Allen Fogleson
umT
forum
  
  
ejb/message
Entity
com.crunchy.ejb.entity.MessageTHome
com.crunchy.ejb.entity.MessageT
message
  
  
user
user
  
  
siteadmin
siteadmin
  
  
manager
manager
  


  messageThread
  com.crunchy.ejb.entity.MessagethreadTHome
  com.crunchy.ejb.entity.MessagethreadT
  com.crunchy.ejb.entity.MessagethreadTBean
  Bean

com.crunchy.ejb.entity.MessagethreadT_PK
  False
  
user
user
  
  
manager
manager
  
  
siteadmin
siteadmin
  


  forum
  com.crunchy.ejb.entity.ForumTHome
  com.crunchy.ejb.entity.ForumT
  com.crunchy.ejb.entity.ForumTBean
  Bean
  com.crunchy.ejb.entity.ForumT_PK
  False
  
user
user
  
  
manager
manager
  
  
siteadmin
siteadmin
  


  message
  com.crunchy.ejb.entity.MessageTHome
  com.crunchy.ejb.entity.MessageT
  com.crunchy.ejb.entity.MessageTBeanBMP
  Bean
  com.crunchy.ejb.entity.MessageT_PK
  False
  
user
user
  
  
manager
manager
  
  
siteadmin
siteadmin
  

  
  

  user


  manager


  siteadmin


  user
  manager
  siteadmin
  
message
*
  


  user
  manager
  siteadmin
  
forum
*
  


  user
  manager
  siteadmin
  
messageThread
*
  


  user
  manager
  siteadmin
  
messageController
*
  


  
messageController
*
  
  Supports


  
forum
*
  
  Required


  
messageThread
*
  
  Required


  
message
*
  
  Required

  



and finally here is the application.xml




Some application




pagescreamer.war
/pagescreamer




message.jar



databeans.jar



userbeans.jar








-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of mroosendaal
Sent: Monday, June 11, 2001 8:21 AM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] howto for a webapp.


You should not use WEB-INF for your JSP's, as that directory is for private
resources... the public resources (protected by security or not should go in
the root of the war file.

Hope this has helped,

Al


___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] howto for a webapp.

2001-06-11 Thread mroosendaal



Hi
 
I'm trying to create a small webapp which uses an 
EJB and MySQL, but i'm not really sure on how the directory structure should 
look (where to put the servlet). Is there a way to create an .ear file at once 
or do you have to do this in stages. This is the dir-structure i've got 
now:
root
    
-com.company.package.ejb
    -META-INF
        - 
ejb-jar.xml
        - jboss.xml 
(opt)
        - jaws.xml 
(opt)
    - WEB-INF
        - 
web.xml
        - 
jboss-web.xml
        - 
jsp's
 
I assume that the WEB-INF is better not done in 
this way because it integrates the two parts too much, and you want them to be 
as flexible as possible.
 
Thanks,
Maarten


Re: [JBoss-user] HOWTO get web app relative file system path from a JSP (was (no subject))

2001-05-07 Thread Steve Swing


- Original Message -
From: "Felix Munoz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 07, 2001 4:25 am
Subject: [JBoss-user] (no subject)


> Hello:
>
> I am having a problem running a JSP and I was hoping for some advice. I am
> running embedded Tomcat.
>
> I have the following setup:
>
> index.jsp
> directory/fileA.txt
> directory/fileB.txt
>
> The job of index.jsp is to list the files in "directory." For this, I was
> trying to use something like this:
>
> File directory = new File("directory")
> String[] fileList = directory.list();
>


Did you try any of these scriptlets (using your example)?

<% File directory = new File(application.getRealPath("directory")) %>
<% File directory = new
File(application.getResource("directory").toExternalForm()) %>
<% application.getResourceAsStream("directory") %>

According to the documentation getResourceAsStream() will read resources
from a war file if it wasn't extracted during deployment. Some application
servers don't extract ears, wars, & jars during deployment unless you
instruct it to do so. This probably doesn't apply to your situation because
you're serving files from a directory.

> So the question is, is there a way to list files in a directory by using a
> path relative to the location of a JSP page?


I was going to suggest using something like the IO taglib from
Apache-Jakarta http://jakarta.apache.org/taglibs/index.html. Unfortunately
the IO taglib link on this page is broken. I don't know if it contains a tag
specifically for this purpose but it seems like the best candidate. Perhaps
you should write a tag library to list files. I suspect taglibs already
exist that do this. I just didn't know of any other taglib lists off-hand.

> Thanks in advance,
>
> Felix Munoz

I hope this is helpful.

Regards,

Steve Swing


___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



Re: [JBoss-user] howto

2001-04-02 Thread Ian McCallion

Christopher Albert wrote:
> 
> "Kimpton,C (Chris)" wrote:
> >
> > Hi,
> >
> > If you are using the default setup, it will use/create a hypersonic db by
> > default.
> >
> > It will be in the dist/db/hypersonic directory.
> >
> > HTH,
> > Chris
> >
> > > -Original Message-
> > > From: Ian McCallion [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, 02 April 2001 14:20
> > > To: [EMAIL PROTECTED]
> > > Subject: [JBoss-user] howto
> > >
> > >
> > > I'm trying to use jboss 2.1 for a small project. How do I
> > > create a database
> > > using InstantDB or Hypersonic? Are there instructions I've
> > > missed? Apologies if
> > > so.
> > >
> 
> Ian,
> You might want also to try the Petstore application, which will give you
> various examples to look at (using the CLoudscape DB), and an idea of a
> larger application. You'll have to rebuild it for Jboss. You can find it
> via the Documentation part of the jboss.org site.

I thought about Cloudbase as it provides a utility for creating and populating
tables. Perhaps I should have said I want to create a new database, create a
table in it and populate the table with some data in InstantDB or Hypersonic.

Ian

___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



Re: [JBoss-user] howto

2001-04-02 Thread Christopher Albert

"Kimpton,C (Chris)" wrote:
> 
> Hi,
> 
> If you are using the default setup, it will use/create a hypersonic db by
> default.
> 
> It will be in the dist/db/hypersonic directory.
> 
> HTH,
> Chris
> 
> > -Original Message-
> > From: Ian McCallion [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, 02 April 2001 14:20
> > To: [EMAIL PROTECTED]
> > Subject: [JBoss-user] howto
> >
> >
> > I'm trying to use jboss 2.1 for a small project. How do I
> > create a database
> > using InstantDB or Hypersonic? Are there instructions I've
> > missed? Apologies if
> > so.
> >

Ian,
You might want also to try the Petstore application, which will give you
various examples to look at (using the CLoudscape DB), and an idea of a
larger application. You'll have to rebuild it for Jboss. You can find it
via the Documentation part of the jboss.org site.

Chris


___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



RE: [JBoss-user] howto

2001-04-02 Thread Kimpton,C (Chris)

Hi,

If you are using the default setup, it will use/create a hypersonic db by
default.

It will be in the dist/db/hypersonic directory.

HTH,
Chris

> -Original Message-
> From: Ian McCallion [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 02 April 2001 14:20
> To: [EMAIL PROTECTED]
> Subject: [JBoss-user] howto
> 
> 
> I'm trying to use jboss 2.1 for a small project. How do I 
> create a database
> using InstantDB or Hypersonic? Are there instructions I've 
> missed? Apologies if
> so.
> 
> Ian McCallion
> Alexis Systems Limited
> Romsey, UK
> 
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 


This electronic message (email) and any attachments to it are subject to copyright and 
are sent for the personal attention of the addressee. Although you may be the named 
recipient, it may become apparent that this email and its contents are not intended 
for you and an addressing error has been made. This email may include information that 
is legally privileged and exempt from disclosure. If you have received this email in 
error, please advise us immediately and delete this email and any attachments from 
your computer system.Rabobank International is the trading name of Coöperatieve 
Centrale Raiffeisen-Boerenleenbank B.A. which is incorporated in the Netherlands. 
Registered with the Registrar of Companies for England & Wales No. BR002630 and 
regulated by the SFA for the conduct of investment business in the UK.

The presence of this footnote also confirms that this email has been automatically 
checked by Rabobank International for the presence of computer viruses prior to it 
being sent, however, no guarantee is given or implied that this email is virus free 
upon delivery.



___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user



[JBoss-user] howto

2001-04-02 Thread Ian McCallion

I'm trying to use jboss 2.1 for a small project. How do I create a database
using InstantDB or Hypersonic? Are there instructions I've missed? Apologies if
so.

Ian McCallion
Alexis Systems Limited
Romsey, UK

___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user