Skip to main content

can't front 3.1.2 with Apache

22 replies [Last post]
gholmer
Offline
Joined: 2003-06-11
Points: 0

I'm unable to get 3.1.2 fronted by Apache with the same technique we
used for 3.1.1:

asadmin create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-listener
asadmin set server-config.network-config.network-listeners.network-listener.jk-listener.jk-enabled=true

After doing this, we edit server-config and create a new thread pool
called jk-thread-pool with minimum size of 5 and maximum size of 150,
then assign this pool to the jk-listener just created.

I've also tried the instructions in Amy Roh's blog:

http://weblogs.java.net/blog/amyroh/archive/2012/02/15/running-glassfish...

Basically, it just doesn't look like anything's happening. There's
certainly some traffic (see attached wireshark screenshot), but clicking
on a link to the app goes nowhere (no page view, no error message,
nothing). The app does respond normally on port 8080.

I'm getting this in the mod_jk log (machine's hostname is "shadow"):

[Thu Apr 12 12:34:58 2012] ajp13 shadow 0.038683
[Thu Apr 12 12:35:10 2012] ajp13 shadow 0.027556
[Thu Apr 12 12:35:19 2012] ajp13 shadow 0.026036
[Thu Apr 12 12:35:23 2012] ajp13 shadow 0.019418
[Thu Apr 12 12:35:47 2012] ajp13 localhost 0.024984
[Thu Apr 12 12:35:53 2012] ajp13 localhost 0.017817
[Thu Apr 12 12:36:07 2012] ajp13 shadow 0.022193
[Thu Apr 12 12:38:31 2012] [32129:3055422320] [info]
ajp_send_request::jk_ajp_common.c (1496): (ajp13) all endpoints are
disconnected, detected by connect check (1), cping (0), send (0)
[Thu Apr 12 12:38:31 2012] ajp13 shadow 0.021329
[Thu Apr 12 12:41:54 2012] ajp13 shadow 0.019667

which looks fairly normal to me. Is there anything different about 3.1.2
as regards fronting it with Apache?

--
____________________________________________________________
Glenn Holmer gholmer@weycogroup.com
Software Engineer phone: 414-908-1809
Weyco Group, Inc. fax: 414-908-1601

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
amyroh
Offline
Joined: 2004-05-06
Points: 0

The same configuration should work to front GlassFish 3.1.2 with Apache.

Are mappings working? Any errors in the mod_jk or server logs?

Amy

On 4/12/12 11:18 AM, Glenn Holmer wrote:
> I'm unable to get 3.1.2 fronted by Apache with the same technique we
> used for 3.1.1:
>
> asadmin create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-listener
> asadmin set server-config.network-config.network-listeners.network-listener.jk-listener.jk-enabled=true
>
> After doing this, we edit server-config and create a new thread pool
> called jk-thread-pool with minimum size of 5 and maximum size of 150,
> then assign this pool to the jk-listener just created.
>
> I've also tried the instructions in Amy Roh's blog:
>
> http://weblogs.java.net/blog/amyroh/archive/2012/02/15/running-glassfish...
>
> Basically, it just doesn't look like anything's happening. There's
> certainly some traffic (see attached wireshark screenshot), but clicking
> on a link to the app goes nowhere (no page view, no error message,
> nothing). The app does respond normally on port 8080.
>
> I'm getting this in the mod_jk log (machine's hostname is "shadow"):
>
> [Thu Apr 12 12:34:58 2012] ajp13 shadow 0.038683
> [Thu Apr 12 12:35:10 2012] ajp13 shadow 0.027556
> [Thu Apr 12 12:35:19 2012] ajp13 shadow 0.026036
> [Thu Apr 12 12:35:23 2012] ajp13 shadow 0.019418
> [Thu Apr 12 12:35:47 2012] ajp13 localhost 0.024984
> [Thu Apr 12 12:35:53 2012] ajp13 localhost 0.017817
> [Thu Apr 12 12:36:07 2012] ajp13 shadow 0.022193
> [Thu Apr 12 12:38:31 2012] [32129:3055422320] [info]
> ajp_send_request::jk_ajp_common.c (1496): (ajp13) all endpoints are
> disconnected, detected by connect check (1), cping (0), send (0)
> [Thu Apr 12 12:38:31 2012] ajp13 shadow 0.021329
> [Thu Apr 12 12:41:54 2012] ajp13 shadow 0.019667
>
> which looks fairly normal to me. Is there anything different about 3.1.2
> as regards fronting it with Apache?
>

929 Guest
Offline
Joined: 2012-02-13
Points: 0

I have an application server running a Java method communicating to an Oracle 11.2 database stored procedure using a GlassFish 3.1.2 JNDI connection pool.

The stored procedure polls the database to determine when a process completes and then returns results to the calling Java method. This process may take some time to complete (minutes to hours).

I'm worried that some (perhaps default) setting within GlassFish (such as JNDI settings) will kill the connection before the stored procedure completes.

What are the issues that could effect this and how to access their settings to change them to something appropriate for this scenario? Any downside to doing so?

I'm using the database stored procedure to poll the database to avoid wasting resources sending traffic from the application server to the database server and back again. Although I suppose having the Java method (instead of the stored procedure) poll the database, while less efficient, would prevent anything closing this connection.

Any comments appreciated. Thanks in advance, GKK

929 Guest
Offline
Joined: 2012-02-13
Points: 0

Let me restate this question (bringing into the conversation the client connection as well):

I have an application server using a GlassFish 3.1.2 to connect a web application used by many clients over the internet to access a Java method. This Java method communicates with a stored procedure in a database server running Oracle 11.2 using a JNDI connection pool in GlassFish.

The stored procedure polls the database to determine when a process completes and then returns results to the calling Java method. This process may take some time to complete (minutes to hours).

I'm worried that some (perhaps default) setting within GlassFish will kill either the client-to-application-server connection, or the java-method-JDBC connection, before the stored procedure completes.

What are the issues that could effect this and how to access their settings to change them to something appropriate for this scenario? Any downside to doing so?

I'm using the database stored procedure to poll the database to avoid wasting resources sending traffic from the application server to the database server and back again. Although I suppose having the Java method (instead of the stored procedure) poll the database, while less efficient, would prevent anything closing this connection.

Likewise, having the client's web application poll the database would keep both connections alive, but would make things even more inefficient by using more resources.

Any comments appreciated. Thanks in advance, GKK

929 Guest
Offline
Joined: 2012-02-13
Points: 0

I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:

java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection

I'm compiling this code:

********JAVA**********
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import oracle.jdbc.OracleTypes;
import oracle.sql.*;
import oracle.jdbc.driver.*;

public class myClass {

public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
Connection conn;
CallableStatement cs;

Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup("jdbc/dbop");
conn = ds.getConnection();

ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);

ARRAY rla = new ARRAY(str_descriptor, conn, rl);
ARRAY rna = new ARRAY(str_descriptor, conn, rn);
ARRAY cna = new ARRAY(num_descriptor, conn, cn);

cs = conn.prepareCall( "{call myproc (?,?,?)}" );

cs.setArray( 1, rla);
cs.setArray( 2, rna);
cs.setArray( 3, cna);

cs.execute();

if ( conn != null ) {
try { conn.close(); } catch ( Exception ex ) {}
conn = null;
}
}
}

where the database has:

********TYPE**********
create or replace TYPE type_number AS table OF NUMBER(2,0);
create or replace TYPE type_string AS table OF VARCHAR2(150);

and

********STORED PROCEDURE**********
create or replace procedure myproc (
in_rla IN type_string,
in_rna IN type_string,
in_cna IN type_number)
as
begin

FOR ii IN 1.. 7
LOOP

INSERT INTO mytable (col_cn, col_rn, col_rl)
VALUES (in_cna(ii), in_rna(ii), in_rla(ii));

END LOOP;

COMMIT;

END myproc;

It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.

929 Guest
Offline
Joined: 2012-02-13
Points: 0

Some additional info: When I read the type of connection I have it returns:

com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456

instead of what I expected to see, which was some sort of Oracle JDBC connection.

Is this a bug?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568

----- Original Message -----
From: modjklist@comcast.net
To: users@glassfish.java.net
Sent: Thursday, April 26, 2012 1:08:33 PM
Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool

I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:

java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection

I'm compiling this code:

********JAVA**********
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import oracle.jdbc.OracleTypes;
import oracle.sql.*;
import oracle.jdbc.driver.*;

public class myClass {

public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
Connection conn;
CallableStatement cs;

Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup("jdbc/dbop");
conn = ds.getConnection();

ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);

ARRAY rla = new ARRAY(str_descriptor, conn, rl);
ARRAY rna = new ARRAY(str_descriptor, conn, rn);
ARRAY cna = new ARRAY(num_descriptor, conn, cn);

cs = conn.prepareCall( "{call myproc (?,?,?)}" );

cs.setArray( 1, rla);
cs.setArray( 2, rna);
cs.setArray( 3, cna);

cs.execute();

if ( conn != null ) {
try { conn.close(); } catch ( Exception ex ) {}
conn = null;
}
}
}

where the database has:

********TYPE**********
create or replace TYPE type_number AS table OF NUMBER(2,0);
create or replace TYPE type_string AS table OF VARCHAR2(150);

and

********STORED PROCEDURE**********
create or replace procedure myproc (
in_rla IN type_string,
in_rna IN type_string,
in_cna IN type_number)
as
begin

FOR ii IN 1.. 7
LOOP

INSERT INTO mytable (col_cn, col_rn, col_rl)
VALUES (in_cna(ii), in_rna(ii), in_rla(ii));

END LOOP;

COMMIT;

END myproc;

It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.

929 Guest
Offline
Joined: 2012-02-13
Points: 0

I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?

Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?

----- Original Message -----
From: modjklist@comcast.net
To: users@glassfish.java.net
Sent: Thursday, April 26, 2012 3:11:21 PM
Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool

Some additional info: When I read the type of connection I have it returns:

com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456

instead of what I expected to see, which was some sort of Oracle JDBC connection.

Is this a bug?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568

----- Original Message -----
From: modjklist@comcast.net
To: users@glassfish.java.net
Sent: Thursday, April 26, 2012 1:08:33 PM
Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool

I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:

java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection

I'm compiling this code:

********JAVA**********
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import oracle.jdbc.OracleTypes;
import oracle.sql.*;
import oracle.jdbc.driver.*;

public class myClass {

public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
Connection conn;
CallableStatement cs;

Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup("jdbc/dbop");
conn = ds.getConnection();

ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);

ARRAY rla = new ARRAY(str_descriptor, conn, rl);
ARRAY rna = new ARRAY(str_descriptor, conn, rn);
ARRAY cna = new ARRAY(num_descriptor, conn, cn);

cs = conn.prepareCall( "{call myproc (?,?,?)}" );

cs.setArray( 1, rla);
cs.setArray( 2, rna);
cs.setArray( 3, cna);

cs.execute();

if ( conn != null ) {
try { conn.close(); } catch ( Exception ex ) {}
conn = null;
}
}
}

where the database has:

********TYPE**********
create or replace TYPE type_number AS table OF NUMBER(2,0);
create or replace TYPE type_string AS table OF VARCHAR2(150);

and

********STORED PROCEDURE**********
create or replace procedure myproc (
in_rla IN type_string,
in_rna IN type_string,
in_cna IN type_number)
as
begin

FOR ii IN 1.. 7
LOOP

INSERT INTO mytable (col_cn, col_rn, col_rl)
VALUES (in_cna(ii), in_rna(ii), in_rla(ii));

END LOOP;

COMMIT;

END myproc;

It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.

mvatkina
Offline
Joined: 2005-04-04
Points: 0

Try this: http://docs.oracle.com/cd/E18930_01/html/821-2418/giyde.html

-marina

modjklist@comcast.net wrote:
> I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?
>
> Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?
>
> ----- Original Message -----
> From: modjklist@comcast.net
> To: users@glassfish.java.net
> Sent: Thursday, April 26, 2012 3:11:21 PM
> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> Some additional info: When I read the type of connection I have it returns:
>
> com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456
>
> instead of what I expected to see, which was some sort of Oracle JDBC connection.
>
> Is this a bug?
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568
>
>
> ----- Original Message -----
> From: modjklist@comcast.net
> To: users@glassfish.java.net
> Sent: Thursday, April 26, 2012 1:08:33 PM
> Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>
> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>
> I'm compiling this code:
>
> ********JAVA**********
> import java.sql.*;
> import java.util.ArrayList;
> import java.util.List;
> import javax.sql.DataSource;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import oracle.jdbc.OracleTypes;
> import oracle.sql.*;
> import oracle.jdbc.driver.*;
>
> public class myClass {
>
> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
> Connection conn;
> CallableStatement cs;
>
> Context context = new InitialContext();
> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
> conn = ds.getConnection();
>
> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>
> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>
> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>
> cs.setArray( 1, rla);
> cs.setArray( 2, rna);
> cs.setArray( 3, cna);
>
> cs.execute();
>
> if ( conn != null ) {
> try { conn.close(); } catch ( Exception ex ) {}
> conn = null;
> }
> }
> }
>
>
> where the database has:
>
> ********TYPE**********
> create or replace TYPE type_number AS table OF NUMBER(2,0);
> create or replace TYPE type_string AS table OF VARCHAR2(150);
>
> and
>
> ********STORED PROCEDURE**********
> create or replace procedure myproc (
> in_rla IN type_string,
> in_rna IN type_string,
> in_cna IN type_number)
> as
> begin
>
> FOR ii IN 1.. 7
> LOOP
>
> INSERT INTO mytable (col_cn, col_rn, col_rl)
> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>
> END LOOP;
>
> COMMIT;
>
> END myproc;
>
> It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.
>

929 Guest
Offline
Joined: 2012-02-13
Points: 0

Thanks Marina, I did come across that link in my searches. I tried a few ways to implement unwrapping but couldn't get anything working. Any idea how I would modify the code below to get it working?

----- Original Message -----
From: "Marina Vatkina"
To: users@glassfish.java.net
Sent: Monday, April 30, 2012 3:09:08 PM
Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool

Try this: http://docs.oracle.com/cd/E18930_01/html/821-2418/giyde.html

-marina

modjklist@comcast.net wrote:
> I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?
>
> Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?
>
> ----- Original Message -----
> From: modjklist@comcast.net
> To: users@glassfish.java.net
> Sent: Thursday, April 26, 2012 3:11:21 PM
> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> Some additional info: When I read the type of connection I have it returns:
>
> com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456
>
> instead of what I expected to see, which was some sort of Oracle JDBC connection.
>
> Is this a bug?
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568
>
>
> ----- Original Message -----
> From: modjklist@comcast.net
> To: users@glassfish.java.net
> Sent: Thursday, April 26, 2012 1:08:33 PM
> Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>
> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>
> I'm compiling this code:
>
> ********JAVA**********
> import java.sql.*;
> import java.util.ArrayList;
> import java.util.List;
> import javax.sql.DataSource;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import oracle.jdbc.OracleTypes;
> import oracle.sql.*;
> import oracle.jdbc.driver.*;
>
> public class myClass {
>
> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
> Connection conn;
> CallableStatement cs;
>
> Context context = new InitialContext();
> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
> conn = ds.getConnection();
>
> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>
> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>
> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>
> cs.setArray( 1, rla);
> cs.setArray( 2, rna);
> cs.setArray( 3, cna);
>
> cs.execute();
>
> if ( conn != null ) {
> try { conn.close(); } catch ( Exception ex ) {}
> conn = null;
> }
> }
> }
>
>
> where the database has:
>
> ********TYPE**********
> create or replace TYPE type_number AS table OF NUMBER(2,0);
> create or replace TYPE type_string AS table OF VARCHAR2(150);
>
> and
>
> ********STORED PROCEDURE**********
> create or replace procedure myproc (
> in_rla IN type_string,
> in_rna IN type_string,
> in_cna IN type_number)
> as
> begin
>
> FOR ii IN 1.. 7
> LOOP
>
> INSERT INTO mytable (col_cn, col_rn, col_rl)
> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>
> END LOOP;
>
> COMMIT;
>
> END myproc;
>
> It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.
>

mvatkina
Offline
Joined: 2005-04-04
Points: 0

What exactly did you try and how didn't it work?

-marina

modjklist@comcast.net wrote:
> Thanks Marina, I did come across that link in my searches. I tried a few ways to implement unwrapping but couldn't get anything working. Any idea how I would modify the code below to get it working?
>
> ----- Original Message -----
> From: "Marina Vatkina"
> To: users@glassfish.java.net
> Sent: Monday, April 30, 2012 3:09:08 PM
> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> Try this: http://docs.oracle.com/cd/E18930_01/html/821-2418/giyde.html
>
> -marina
>
> modjklist@comcast.net wrote:
>
>> I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?
>>
>> Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?
>>
>> ----- Original Message -----
>> From: modjklist@comcast.net
>> To: users@glassfish.java.net
>> Sent: Thursday, April 26, 2012 3:11:21 PM
>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>
>> Some additional info: When I read the type of connection I have it returns:
>>
>> com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456
>>
>> instead of what I expected to see, which was some sort of Oracle JDBC connection.
>>
>> Is this a bug?
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568
>>
>>
>> ----- Original Message -----
>> From: modjklist@comcast.net
>> To: users@glassfish.java.net
>> Sent: Thursday, April 26, 2012 1:08:33 PM
>> Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>
>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>
>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>
>> I'm compiling this code:
>>
>> ********JAVA**********
>> import java.sql.*;
>> import java.util.ArrayList;
>> import java.util.List;
>> import javax.sql.DataSource;
>> import javax.naming.Context;
>> import javax.naming.InitialContext;
>> import javax.naming.NamingException;
>> import oracle.jdbc.OracleTypes;
>> import oracle.sql.*;
>> import oracle.jdbc.driver.*;
>>
>> public class myClass {
>>
>> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
>> Connection conn;
>> CallableStatement cs;
>>
>> Context context = new InitialContext();
>> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
>> conn = ds.getConnection();
>>
>> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
>> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>>
>> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
>> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
>> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>>
>> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>>
>> cs.setArray( 1, rla);
>> cs.setArray( 2, rna);
>> cs.setArray( 3, cna);
>>
>> cs.execute();
>>
>> if ( conn != null ) {
>> try { conn.close(); } catch ( Exception ex ) {}
>> conn = null;
>> }
>> }
>> }
>>
>>
>> where the database has:
>>
>> ********TYPE**********
>> create or replace TYPE type_number AS table OF NUMBER(2,0);
>> create or replace TYPE type_string AS table OF VARCHAR2(150);
>>
>> and
>>
>> ********STORED PROCEDURE**********
>> create or replace procedure myproc (
>> in_rla IN type_string,
>> in_rna IN type_string,
>> in_cna IN type_number)
>> as
>> begin
>>
>> FOR ii IN 1.. 7
>> LOOP
>>
>> INSERT INTO mytable (col_cn, col_rn, col_rl)
>> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>>
>> END LOOP;
>>
>> COMMIT;
>>
>> END myproc;
>>
>> It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.
>>
>>

929 Guest
Offline
Joined: 2012-02-13
Points: 0

Hi Marina, the original posting had the error and code (see sections for ***JAVA***, ***TYPE*** and ***STORED PROCEDURE***). I'll copy it here for reference:

>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>
>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>
>> I'm compiling this code:
>>
********JAVA**********
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import oracle.jdbc.OracleTypes;
import oracle.sql.*;
import oracle.jdbc.driver.*;

public class myClass {

public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
Connection conn;
CallableStatement cs;

Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup("jdbc/dbop");
conn = ds.getConnection();

ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);

ARRAY rla = new ARRAY(str_descriptor, conn, rl);
ARRAY rna = new ARRAY(str_descriptor, conn, rn);
ARRAY cna = new ARRAY(num_descriptor, conn, cn);

cs = conn.prepareCall( "{call myproc (?,?,?)}" );

cs.setArray( 1, rla);
cs.setArray( 2, rna);
cs.setArray( 3, cna);

cs.execute();

if ( conn != null ) {
try { conn.close(); } catch ( Exception ex ) {}
conn = null;
}
}
}

>> where the database has:

********TYPE**********
create or replace TYPE type_number AS table OF NUMBER(2,0);
create or replace TYPE type_string AS table OF VARCHAR2(150);

>> and

********STORED PROCEDURE**********
create or replace procedure myproc (
in_rla IN type_string,
in_rna IN type_string,
in_cna IN type_number)
as
begin

FOR ii IN 1.. 7
LOOP

INSERT INTO mytable (col_cn, col_rn, col_rl)
VALUES (in_cna(ii), in_rna(ii), in_rla(ii));

END LOOP;

COMMIT;

END myproc;

----- Original Message -----
From: "Marina Vatkina"
To: users@glassfish.java.net
Sent: Thursday, May 3, 2012 2:43:13 PM
Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool

What exactly did you try and how didn't it work?

-marina

modjklist@comcast.net wrote:
> Thanks Marina, I did come across that link in my searches. I tried a few ways to implement unwrapping but couldn't get anything working. Any idea how I would modify the code below to get it working?
>
> ----- Original Message -----
> From: "Marina Vatkina"
> To: users@glassfish.java.net
> Sent: Monday, April 30, 2012 3:09:08 PM
> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> Try this: http://docs.oracle.com/cd/E18930_01/html/821-2418/giyde.html
>
> -marina
>
> modjklist@comcast.net wrote:
>
>> I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?
>>
>> Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?
>>
>> ----- Original Message -----
>> From: modjklist@comcast.net
>> To: users@glassfish.java.net
>> Sent: Thursday, April 26, 2012 3:11:21 PM
>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>
>> Some additional info: When I read the type of connection I have it returns:
>>
>> com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456
>>
>> instead of what I expected to see, which was some sort of Oracle JDBC connection.
>>
>> Is this a bug?
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568
>>
>>
>> ----- Original Message -----
>> From: modjklist@comcast.net
>> To: users@glassfish.java.net
>> Sent: Thursday, April 26, 2012 1:08:33 PM
>> Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>
>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>
>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>
>> I'm compiling this code:
>>
>> ********JAVA**********
>> import java.sql.*;
>> import java.util.ArrayList;
>> import java.util.List;
>> import javax.sql.DataSource;
>> import javax.naming.Context;
>> import javax.naming.InitialContext;
>> import javax.naming.NamingException;
>> import oracle.jdbc.OracleTypes;
>> import oracle.sql.*;
>> import oracle.jdbc.driver.*;
>>
>> public class myClass {
>>
>> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
>> Connection conn;
>> CallableStatement cs;
>>
>> Context context = new InitialContext();
>> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
>> conn = ds.getConnection();
>>
>> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
>> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>>
>> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
>> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
>> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>>
>> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>>
>> cs.setArray( 1, rla);
>> cs.setArray( 2, rna);
>> cs.setArray( 3, cna);
>>
>> cs.execute();
>>
>> if ( conn != null ) {
>> try { conn.close(); } catch ( Exception ex ) {}
>> conn = null;
>> }
>> }
>> }
>>
>>
>> where the database has:
>>
>> ********TYPE**********
>> create or replace TYPE type_number AS table OF NUMBER(2,0);
>> create or replace TYPE type_string AS table OF VARCHAR2(150);
>>
>> and
>>
>> ********STORED PROCEDURE**********
>> create or replace procedure myproc (
>> in_rla IN type_string,
>> in_rna IN type_string,
>> in_cna IN type_number)
>> as
>> begin
>>
>> FOR ii IN 1.. 7
>> LOOP
>>
>> INSERT INTO mytable (col_cn, col_rn, col_rl)
>> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>>
>> END LOOP;
>>
>> COMMIT;
>>
>> END myproc;
>>
>> It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.
>>
>>

mvatkina
Offline
Joined: 2005-04-04
Points: 0

Did you try to add connection unwrapping code as suggested in the link I
referenced?

modjklist@comcast.net wrote:
> Hi Marina, the original posting had the error and code (see sections for ***JAVA***, ***TYPE*** and ***STORED PROCEDURE***). I'll copy it here for reference:
>
>
>
>>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>>
>>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>>
>>> I'm compiling this code:
>>>
>>>
> ********JAVA**********
> import java.sql.*;
> import java.util.ArrayList;
> import java.util.List;
> import javax.sql.DataSource;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import oracle.jdbc.OracleTypes;
> import oracle.sql.*;
> import oracle.jdbc.driver.*;
>
> public class myClass {
>
> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
> Connection conn;
> CallableStatement cs;
>
> Context context = new InitialContext();
> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
> conn = ds.getConnection();
>
> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>
> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>
> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>
> cs.setArray( 1, rla);
> cs.setArray( 2, rna);
> cs.setArray( 3, cna);
>
> cs.execute();
>
> if ( conn != null ) {
> try { conn.close(); } catch ( Exception ex ) {}
> conn = null;
> }
> }
> }
>
>
>>> where the database has:
>>>
>
> ********TYPE**********
> create or replace TYPE type_number AS table OF NUMBER(2,0);
> create or replace TYPE type_string AS table OF VARCHAR2(150);
>
>
>>> and
>>>
>
> ********STORED PROCEDURE**********
> create or replace procedure myproc (
> in_rla IN type_string,
> in_rna IN type_string,
> in_cna IN type_number)
> as
> begin
>
> FOR ii IN 1.. 7
> LOOP
>
> INSERT INTO mytable (col_cn, col_rn, col_rl)
> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>
> END LOOP;
>
> COMMIT;
>
> END myproc;
>
> ----- Original Message -----
> From: "Marina Vatkina"
> To: users@glassfish.java.net
> Sent: Thursday, May 3, 2012 2:43:13 PM
> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> What exactly did you try and how didn't it work?
>
> -marina
>
> modjklist@comcast.net wrote:
>
>> Thanks Marina, I did come across that link in my searches. I tried a few ways to implement unwrapping but couldn't get anything working. Any idea how I would modify the code below to get it working?
>>
>> ----- Original Message -----
>> From: "Marina Vatkina"
>> To: users@glassfish.java.net
>> Sent: Monday, April 30, 2012 3:09:08 PM
>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>
>> Try this: http://docs.oracle.com/cd/E18930_01/html/821-2418/giyde.html
>>
>> -marina
>>
>> modjklist@comcast.net wrote:
>>
>>
>>> I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?
>>>
>>> Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?
>>>
>>> ----- Original Message -----
>>> From: modjklist@comcast.net
>>> To: users@glassfish.java.net
>>> Sent: Thursday, April 26, 2012 3:11:21 PM
>>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>>
>>> Some additional info: When I read the type of connection I have it returns:
>>>
>>> com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456
>>>
>>> instead of what I expected to see, which was some sort of Oracle JDBC connection.
>>>
>>> Is this a bug?
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568
>>>
>>>
>>> ----- Original Message -----
>>> From: modjklist@comcast.net
>>> To: users@glassfish.java.net
>>> Sent: Thursday, April 26, 2012 1:08:33 PM
>>> Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>>
>>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>>
>>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>>
>>> I'm compiling this code:
>>>
>>> ********JAVA**********
>>> import java.sql.*;
>>> import java.util.ArrayList;
>>> import java.util.List;
>>> import javax.sql.DataSource;
>>> import javax.naming.Context;
>>> import javax.naming.InitialContext;
>>> import javax.naming.NamingException;
>>> import oracle.jdbc.OracleTypes;
>>> import oracle.sql.*;
>>> import oracle.jdbc.driver.*;
>>>
>>> public class myClass {
>>>
>>> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
>>> Connection conn;
>>> CallableStatement cs;
>>>
>>> Context context = new InitialContext();
>>> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
>>> conn = ds.getConnection();
>>>
>>> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
>>> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>>>
>>> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
>>> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
>>> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>>>
>>> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>>>
>>> cs.setArray( 1, rla);
>>> cs.setArray( 2, rna);
>>> cs.setArray( 3, cna);
>>>
>>> cs.execute();
>>>
>>> if ( conn != null ) {
>>> try { conn.close(); } catch ( Exception ex ) {}
>>> conn = null;
>>> }
>>> }
>>> }
>>>
>>>
>>> where the database has:
>>>
>>> ********TYPE**********
>>> create or replace TYPE type_number AS table OF NUMBER(2,0);
>>> create or replace TYPE type_string AS table OF VARCHAR2(150);
>>>
>>> and
>>>
>>> ********STORED PROCEDURE**********
>>> create or replace procedure myproc (
>>> in_rla IN type_string,
>>> in_rna IN type_string,
>>> in_cna IN type_number)
>>> as
>>> begin
>>>
>>> FOR ii IN 1.. 7
>>> LOOP
>>>
>>> INSERT INTO mytable (col_cn, col_rn, col_rl)
>>> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>>>
>>> END LOOP;
>>>
>>> COMMIT;
>>>
>>> END myproc;
>>>
>>> It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.
>>>
>>>
>>>

929 Guest
Offline
Joined: 2012-02-13
Points: 0

Yes, I tried the following:

> Check or uncheck the Wrap JDBC Objects box on the Edit Connection Pool Advanced Attributes
> page in the Administration Console.

then re-started the glassfish domain and it made no difference (I got the same error). Is this the proper way, or do I need to change something in the java code? Thanks

----- Original Message -----
From: "Marina Vatkina"
To: users@glassfish.java.net
Sent: Thursday, May 3, 2012 3:17:34 PM
Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool

Did you try to add connection unwrapping code as suggested in the link I
referenced?

modjklist@comcast.net wrote:
> Hi Marina, the original posting had the error and code (see sections for ***JAVA***, ***TYPE*** and ***STORED PROCEDURE***). I'll copy it here for reference:
>
>
>
>>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>>
>>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>>
>>> I'm compiling this code:
>>>
>>>
> ********JAVA**********
> import java.sql.*;
> import java.util.ArrayList;
> import java.util.List;
> import javax.sql.DataSource;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import oracle.jdbc.OracleTypes;
> import oracle.sql.*;
> import oracle.jdbc.driver.*;
>
> public class myClass {
>
> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
> Connection conn;
> CallableStatement cs;
>
> Context context = new InitialContext();
> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
> conn = ds.getConnection();
>
> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>
> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>
> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>
> cs.setArray( 1, rla);
> cs.setArray( 2, rna);
> cs.setArray( 3, cna);
>
> cs.execute();
>
> if ( conn != null ) {
> try { conn.close(); } catch ( Exception ex ) {}
> conn = null;
> }
> }
> }
>
>
>>> where the database has:
>>>
>
> ********TYPE**********
> create or replace TYPE type_number AS table OF NUMBER(2,0);
> create or replace TYPE type_string AS table OF VARCHAR2(150);
>
>
>>> and
>>>
>
> ********STORED PROCEDURE**********
> create or replace procedure myproc (
> in_rla IN type_string,
> in_rna IN type_string,
> in_cna IN type_number)
> as
> begin
>
> FOR ii IN 1.. 7
> LOOP
>
> INSERT INTO mytable (col_cn, col_rn, col_rl)
> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>
> END LOOP;
>
> COMMIT;
>
> END myproc;
>
> ----- Original Message -----
> From: "Marina Vatkina"
> To: users@glassfish.java.net
> Sent: Thursday, May 3, 2012 2:43:13 PM
> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> What exactly did you try and how didn't it work?
>
> -marina
>
> modjklist@comcast.net wrote:
>
>> Thanks Marina, I did come across that link in my searches. I tried a few ways to implement unwrapping but couldn't get anything working. Any idea how I would modify the code below to get it working?
>>
>> ----- Original Message -----
>> From: "Marina Vatkina"
>> To: users@glassfish.java.net
>> Sent: Monday, April 30, 2012 3:09:08 PM
>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>
>> Try this: http://docs.oracle.com/cd/E18930_01/html/821-2418/giyde.html
>>
>> -marina
>>
>> modjklist@comcast.net wrote:
>>
>>
>>> I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?
>>>
>>> Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?
>>>
>>> ----- Original Message -----
>>> From: modjklist@comcast.net
>>> To: users@glassfish.java.net
>>> Sent: Thursday, April 26, 2012 3:11:21 PM
>>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>>
>>> Some additional info: When I read the type of connection I have it returns:
>>>
>>> com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456
>>>
>>> instead of what I expected to see, which was some sort of Oracle JDBC connection.
>>>
>>> Is this a bug?
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568
>>>
>>>
>>> ----- Original Message -----
>>> From: modjklist@comcast.net
>>> To: users@glassfish.java.net
>>> Sent: Thursday, April 26, 2012 1:08:33 PM
>>> Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>>
>>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>>
>>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>>
>>> I'm compiling this code:
>>>
>>> ********JAVA**********
>>> import java.sql.*;
>>> import java.util.ArrayList;
>>> import java.util.List;
>>> import javax.sql.DataSource;
>>> import javax.naming.Context;
>>> import javax.naming.InitialContext;
>>> import javax.naming.NamingException;
>>> import oracle.jdbc.OracleTypes;
>>> import oracle.sql.*;
>>> import oracle.jdbc.driver.*;
>>>
>>> public class myClass {
>>>
>>> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
>>> Connection conn;
>>> CallableStatement cs;
>>>
>>> Context context = new InitialContext();
>>> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
>>> conn = ds.getConnection();
>>>
>>> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
>>> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>>>
>>> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
>>> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
>>> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>>>
>>> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>>>
>>> cs.setArray( 1, rla);
>>> cs.setArray( 2, rna);
>>> cs.setArray( 3, cna);
>>>
>>> cs.execute();
>>>
>>> if ( conn != null ) {
>>> try { conn.close(); } catch ( Exception ex ) {}
>>> conn = null;
>>> }
>>> }
>>> }
>>>
>>>
>>> where the database has:
>>>
>>> ********TYPE**********
>>> create or replace TYPE type_number AS table OF NUMBER(2,0);
>>> create or replace TYPE type_string AS table OF VARCHAR2(150);
>>>
>>> and
>>>
>>> ********STORED PROCEDURE**********
>>> create or replace procedure myproc (
>>> in_rla IN type_string,
>>> in_rna IN type_string,
>>> in_cna IN type_number)
>>> as
>>> begin
>>>
>>> FOR ii IN 1.. 7
>>> LOOP
>>>
>>> INSERT INTO mytable (col_cn, col_rn, col_rl)
>>> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>>>
>>> END LOOP;
>>>
>>> COMMIT;
>>>
>>> END myproc;
>>>
>>> It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.
>>>
>>>
>>>

mvatkina
Offline
Joined: 2005-04-04
Points: 0

You were looking at the wrong section of the document (read carefully
waht wrapping it refers to). Read the other two ;)

modjklist@comcast.net wrote:
> Yes, I tried the following:
>
>
>> Check or uncheck the Wrap JDBC Objects box on the Edit Connection Pool Advanced Attributes
>> page in the Administration Console.
>>
>
> then re-started the glassfish domain and it made no difference (I got the same error). Is this the proper way, or do I need to change something in the java code? Thanks
>
> ----- Original Message -----
> From: "Marina Vatkina"
> To: users@glassfish.java.net
> Sent: Thursday, May 3, 2012 3:17:34 PM
> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>
> Did you try to add connection unwrapping code as suggested in the link I
> referenced?
>
> modjklist@comcast.net wrote:
>
>> Hi Marina, the original posting had the error and code (see sections for ***JAVA***, ***TYPE*** and ***STORED PROCEDURE***). I'll copy it here for reference:
>>
>>
>>
>>
>>>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>>>
>>>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>>>
>>>> I'm compiling this code:
>>>>
>>>>
>>>>
>> ********JAVA**********
>> import java.sql.*;
>> import java.util.ArrayList;
>> import java.util.List;
>> import javax.sql.DataSource;
>> import javax.naming.Context;
>> import javax.naming.InitialContext;
>> import javax.naming.NamingException;
>> import oracle.jdbc.OracleTypes;
>> import oracle.sql.*;
>> import oracle.jdbc.driver.*;
>>
>> public class myClass {
>>
>> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
>> Connection conn;
>> CallableStatement cs;
>>
>> Context context = new InitialContext();
>> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
>> conn = ds.getConnection();
>>
>> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
>> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>>
>> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
>> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
>> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>>
>> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>>
>> cs.setArray( 1, rla);
>> cs.setArray( 2, rna);
>> cs.setArray( 3, cna);
>>
>> cs.execute();
>>
>> if ( conn != null ) {
>> try { conn.close(); } catch ( Exception ex ) {}
>> conn = null;
>> }
>> }
>> }
>>
>>
>>
>>>> where the database has:
>>>>
>>>>
>> ********TYPE**********
>> create or replace TYPE type_number AS table OF NUMBER(2,0);
>> create or replace TYPE type_string AS table OF VARCHAR2(150);
>>
>>
>>
>>>> and
>>>>
>>>>
>> ********STORED PROCEDURE**********
>> create or replace procedure myproc (
>> in_rla IN type_string,
>> in_rna IN type_string,
>> in_cna IN type_number)
>> as
>> begin
>>
>> FOR ii IN 1.. 7
>> LOOP
>>
>> INSERT INTO mytable (col_cn, col_rn, col_rl)
>> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>>
>> END LOOP;
>>
>> COMMIT;
>>
>> END myproc;
>>
>> ----- Original Message -----
>> From: "Marina Vatkina"
>> To: users@glassfish.java.net
>> Sent: Thursday, May 3, 2012 2:43:13 PM
>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>
>> What exactly did you try and how didn't it work?
>>
>> -marina
>>
>> modjklist@comcast.net wrote:
>>
>>
>>> Thanks Marina, I did come across that link in my searches. I tried a few ways to implement unwrapping but couldn't get anything working. Any idea how I would modify the code below to get it working?
>>>
>>> ----- Original Message -----
>>> From: "Marina Vatkina"
>>> To: users@glassfish.java.net
>>> Sent: Monday, April 30, 2012 3:09:08 PM
>>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>>
>>> Try this: http://docs.oracle.com/cd/E18930_01/html/821-2418/giyde.html
>>>
>>> -marina
>>>
>>> modjklist@comcast.net wrote:
>>>
>>>
>>>
>>>> I'm guessing GlassFish's JDBC connection pool is wrapping the JDBC driver classes and proxying them seamlessly, which is causing the problem. How do others get around this so that Oracle specific features may be used?
>>>>
>>>> Most of my Java methods work fine as is, but I need one Java method to use a specific Oracle feature. Is that possible using a JDBC Connection pool with GlassFish?
>>>>
>>>> ----- Original Message -----
>>>> From: modjklist@comcast.net
>>>> To: users@glassfish.java.net
>>>> Sent: Thursday, April 26, 2012 3:11:21 PM
>>>> Subject: Re: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>>>
>>>> Some additional info: When I read the type of connection I have it returns:
>>>>
>>>> com.sun.gjc.spi.jdbc40.ConnectionWrapper40@31c74456
>>>>
>>>> instead of what I expected to see, which was some sort of Oracle JDBC connection.
>>>>
>>>> Is this a bug?
>>>>
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=300568
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: modjklist@comcast.net
>>>> To: users@glassfish.java.net
>>>> Sent: Thursday, April 26, 2012 1:08:33 PM
>>>> Subject: getting error passing array from Java to Oracle stored procedure related to GlassFish pool
>>>>
>>>> I'm trying to pass some arrays from Java to an Oracle 11.2 stored procedure and I'm getting a runtime error. The error I'm seeing is:
>>>>
>>>> java.lang.ClassCastException : com.sun.gjc.spi.jdbc40.ConnectionWrapper40 cannot be cast to oracle.jdbc.OracleConnection
>>>>
>>>> I'm compiling this code:
>>>>
>>>> ********JAVA**********
>>>> import java.sql.*;
>>>> import java.util.ArrayList;
>>>> import java.util.List;
>>>> import javax.sql.DataSource;
>>>> import javax.naming.Context;
>>>> import javax.naming.InitialContext;
>>>> import javax.naming.NamingException;
>>>> import oracle.jdbc.OracleTypes;
>>>> import oracle.sql.*;
>>>> import oracle.jdbc.driver.*;
>>>>
>>>> public class myClass {
>>>>
>>>> public String SR(String[] rl, String[] rn, int[] cn) throws Exception {
>>>> Connection conn;
>>>> CallableStatement cs;
>>>>
>>>> Context context = new InitialContext();
>>>> DataSource ds = (DataSource)context.lookup("jdbc/dbop");
>>>> conn = ds.getConnection();
>>>>
>>>> ArrayDescriptor str_descriptor = ArrayDescriptor.createDescriptor("TYPE_STRING", conn);
>>>> ArrayDescriptor num_descriptor = ArrayDescriptor.createDescriptor("TYPE_NUMBER", conn);
>>>>
>>>> ARRAY rla = new ARRAY(str_descriptor, conn, rl);
>>>> ARRAY rna = new ARRAY(str_descriptor, conn, rn);
>>>> ARRAY cna = new ARRAY(num_descriptor, conn, cn);
>>>>
>>>> cs = conn.prepareCall( "{call myproc (?,?,?)}" );
>>>>
>>>> cs.setArray( 1, rla);
>>>> cs.setArray( 2, rna);
>>>> cs.setArray( 3, cna);
>>>>
>>>> cs.execute();
>>>>
>>>> if ( conn != null ) {
>>>> try { conn.close(); } catch ( Exception ex ) {}
>>>> conn = null;
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>> where the database has:
>>>>
>>>> ********TYPE**********
>>>> create or replace TYPE type_number AS table OF NUMBER(2,0);
>>>> create or replace TYPE type_string AS table OF VARCHAR2(150);
>>>>
>>>> and
>>>>
>>>> ********STORED PROCEDURE**********
>>>> create or replace procedure myproc (
>>>> in_rla IN type_string,
>>>> in_rna IN type_string,
>>>> in_cna IN type_number)
>>>> as
>>>> begin
>>>>
>>>> FOR ii IN 1.. 7
>>>> LOOP
>>>>
>>>> INSERT INTO mytable (col_cn, col_rn, col_rl)
>>>> VALUES (in_cna(ii), in_rna(ii), in_rla(ii));
>>>>
>>>> END LOOP;
>>>>
>>>> COMMIT;
>>>>
>>>> END myproc;
>>>>
>>>> It's my first attempt at passing in arrays from java to stored procedure. Any comments appreciated.
>>>>
>>>>
>>>>
>>>>

929 Guest
Offline
Joined: 2012-02-13
Points: 0

Hi, I've got a web application using Java SE 1.6 and GlassFish 3.1.2. Using regular Java POJOs, everything is working fine. I have JAVA_PATH, JAVA_HOME and JRE_HOME set correctly for jdk1.6.

Now I want to use a Java Servlet. Do I need to do anything special to setup GlassFish to work with Java servlets?

Currently I'm getting errors such as:

package javax.servlet.http does not exist

Is this error something I should solve by a GlassFish setting somewhere? Or, do I just need to figure out where the servlet files are located on my linux server then include them in the compile path when creating the class (that is, removing this error has nothing to do with GlassFish)?

929 Guest
Offline
Joined: 2012-02-13
Points: 0

I've got GlassFish 3.1.2 installed on Linux CentOS 6.2. Now I need to support some an HTTPS web page with a certificate purchased from a third party (not sure who yet).

If all of my web traffic is directed to GlassFish from Apache Web server (version 2.2.21) using mod_jk, do I need to install the SSL certificate's in GlassFish, or Apache Web server, or both?

If I need to do something on GlassFish, what is the easiest way, or which section of the documentation should I follow? I just need a basic certificate installed to enable browsers to visit website without giving warning, or blocking, etc. Thanks in advance for any comments.

929 Guest
Offline
Joined: 2012-02-13
Points: 0

I am observing the following:

asadmin> list-domains
domain1 not running
Command list-domains executed successfully.
asadmin> start-domain domain1 --port 4850
There is a process already using the admin port 4850 -- it probably is another instance of a GlassFish server.
Command start-domain failed.

Shouldn't the "list-domains" show running domains on port 4850? Or, more importantly, how do I stop whatever is running on port 4850, so I can start domain1 on that port?

tmueller
Offline
Joined: 2005-10-31
Points: 0

The list-domains command will only identify domains in the domain
directory that it is operating on. By default, this is the
"glassfish/domains" directory in the install directory for the asadmin
command. However, there is a --domaindir option for list-domains that
allows specifying something else.

The process that you have running on port 4850 could be a GlassFish
server process from another domain that is in a non-default domains
directory, or it could be from a domain from another install of
GlassFish on the same host, or the process could be some completely
different process that happens to be using port 4850.

On Linux, you can use "netstat -tulpn" to find out what process is
listening on a port, i.e.:

$ netstat -tulpn | grep 4850

Tom

On 7/3/2012 1:21 PM, modjklist@comcast.net wrote:
> I am observing the following:
>
> asadmin> list-domains
> domain1 not running
> Command list-domains executed successfully.
> asadmin> start-domain domain1 --port 4850
> There is a process already using the admin port 4850 -- it probably is another instance of a GlassFish server.
> Command start-domain failed.
>
> Shouldn't the "list-domains" show running domains on port 4850? Or, more importantly, how do I stop whatever is running on port 4850, so I can start domain1 on that port?

swchan2
Offline
Joined: 2005-03-29
Points: 0

In 3.1.2 env, you need the following jar in the classpath
glassfish3/glassfish/modules/javax.servlet-api.jar

narayana rallab...
Offline
Joined: 2011-04-04
Points: 0

I guess you are trying to compile your class. In that case you don't need to do anything with GF. All you need is your library in the CP for compiling your Servlet.

-----Original Message-----
From: modjklist@comcast.net [mailto:modjklist@comcast.net]
Sent: Wednesday, May 16, 2012 11:15 PM
To: users@glassfish.java.net
Subject: anything special needed for GlassFish to work with Java Servlet?

Hi, I've got a web application using Java SE 1.6 and GlassFish 3.1.2. Using regular Java POJOs, everything is working fine. I have JAVA_PATH, JAVA_HOME and JRE_HOME set correctly for jdk1.6.

Now I want to use a Java Servlet. Do I need to do anything special to setup GlassFish to work with Java servlets?

Currently I'm getting errors such as:

package javax.servlet.http does not exist

Is this error something I should solve by a GlassFish setting somewhere? Or, do I just need to figure out where the servlet files are located on my linux server then include them in the compile path when creating the class (that is, removing this error has nothing to do with GlassFish)?

shreedhar_ganapathy
Offline
Joined: 2007-01-17
Points: 0

Or you could use a nice IDE like NetBeans with GlassFish integrated :-)
and have fun developing Servlets and other Java EE component technologies.

Here's a nice set of YouTube videos by Arun Gupta, our community
Evangelist, on this topic that might help you very much. Although the
video uses NetBean 6.9, the examples should all work with the latest
versions of NetBeans and GlassFish 3.1.2
http://www.youtube.com/watch?v=pwBNmAhtqk8

Hope this is helpful you.
Shreedhar

On 5/16/12 10:48 AM, Narayana Rallabandi wrote:
> I guess you are trying to compile your class. In that case you don't need to do anything with GF. All you need is your library in the CP for compiling your Servlet.
>
>
> -----Original Message-----
> From: modjklist@comcast.net [mailto:modjklist@comcast.net]
> Sent: Wednesday, May 16, 2012 11:15 PM
> To: users@glassfish.java.net
> Subject: anything special needed for GlassFish to work with Java Servlet?
>
> Hi, I've got a web application using Java SE 1.6 and GlassFish 3.1.2. Using regular Java POJOs, everything is working fine. I have JAVA_PATH, JAVA_HOME and JRE_HOME set correctly for jdk1.6.
>
> Now I want to use a Java Servlet. Do I need to do anything special to setup GlassFish to work with Java servlets?
>
> Currently I'm getting errors such as:
>
> package javax.servlet.http does not exist
>
> Is this error something I should solve by a GlassFish setting somewhere? Or, do I just need to figure out where the servlet files are located on my linux server then include them in the compile path when creating the class (that is, removing this error has nothing to do with GlassFish)?

oleksiys
Offline
Joined: 2006-01-25
Points: 0

On 04/13/2012 09:04 PM, modjklist@comcast.net wrote:
> Let me restate this question (bringing into the conversation the client connection as well):
>
> I have an application server using a GlassFish 3.1.2 to connect a web application used by many clients over the internet to access a Java method. This Java method communicates with a stored procedure in a database server running Oracle 11.2 using a JNDI connection pool in GlassFish.
>
> The stored procedure polls the database to determine when a process completes and then returns results to the calling Java method. This process may take some time to complete (minutes to hours).
>
>
> I'm worried that some (perhaps default) setting within GlassFish will kill either the client-to-application-server connection, or the java-method-JDBC connection, before the stored procedure completes.
>
> What are the issues that could effect this and how to access their settings to change them to something appropriate for this scenario? Any downside to doing so?
I can't be sure, but try to disable request-timeout in http protocol like:
asadmin set
server-config.network-config.protocols.protocol.http-listener-1.http.request-timeout-seconds=-1

If long running servlets is what you expect - there is no downside.

WBR,
Alexey.

gholmer
Offline
Joined: 2003-06-11
Points: 0

On Thu, 2012-04-12 at 12:09 -0700, Amy Roh wrote:
> The same configuration should work to front GlassFish 3.1.2 with Apache.
>
> Are mappings working? Any errors in the mod_jk or server logs?

Thanks for responding, Amy. Apparently it was this:

http://java.net/jira/browse/GLASSFISH-18485

http://java.net/jira/browse/GLASSFISH-18446

Replaced two Grizzly jars with those attached to issue 18446 and now it
works.

--
____________________________________________________________
Glenn Holmer gholmer@weycogroup.com
Software Engineer phone: 414-908-1809
Weyco Group, Inc. fax: 414-908-1601