[Persistence, JBoss/CMP, Hibernate, Database] - Oracle prepared statement with cursors fails with Datasource
by jwinterf
>From a servlet in JBoss 4.05GA, we are trying to access an Oracle 10g database and execute a PreparedStatement that uses cursors for sub-results.
The point is to use this result to build an xml document through an OracleXMLQuery.
The libs are ojdbc14, xsu12, xmlparserv2, versions 10.2.0.2
The query goes like so (sanitized version, see full below):
| select
| field,
| cursor(
| select *
| from other
| where other.field = table.field
| ) sub
| from
| table
|
If the connection to the database is created with a DriverManager, all is fine, and we get the expected result, that is:
| <ROWSET>
| <ROW num="1">
| <field>data</field>
| <sub>
| <sub_row num="1">
| --sub fields--
| </sub_row>
| et caetera
|
However, using a DataSource does not: the result is (translated):
| <ERROR>oracle.xml.sql.OracleXMLSQLException: ORA-00604: error occurred at recursive SQL level 1
| ORA-01000: maximum open cursors exceeded
| </ERROR>
|
I have had a look around the net as to the use of cursors, oracle and datasources, but all i found was problems with unclosed statements &c. building up to cause the problem. In this case the problem is immediate and ever-present in the Datasource case and never in the DriverManager. I also found a case about using a prepared call that retuns a REF Cursor, but I don't think it applies since this is a prepared statement.
The source of the minimal servlet used to reproduce the problem follows:
| /*package & imports*/
|
| public class StatementServlet extends HttpServlet {
|
| String query = "select platform_code, cursor(select * from cycle_voyage where cycle_voyage.platform_code = platform.platform_code) cycles from platform where platform.description = 'Japan'";
|
| @Override
| protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
| boolean ds = Boolean.parseBoolean(req.getParameter("ds"));
| resp.setContentType("text/plain");
| try {
| String result = (ds? workDS(): workDM());
| resp.getOutputStream().print(result);
| } catch (Exception e) {
| e.printStackTrace(new PrintStream(resp.getOutputStream()));
| e.printStackTrace();
| }
| }
|
| protected String workDM() throws Exception {
| DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); // NOT oracle.jdbc.driver.OracleDriver
| Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@--host--:--port--:--service--","--user--","--pwd--");
|
| PreparedStatement ps = connection.prepareStatement(query);
| ResultSet resultSet = ps.executeQuery();
|
| //get XML result
| OracleXMLQuery oxq = new OracleXMLQuery(connection, resultSet);
| oxq.useNullAttributeIndicator(false);
|
| String result = oxq.getXMLString();
| resultSet.close(); ps.close(); connection.close();
| return result;
| }
|
| protected String workDS() throws Exception {
| Context envContext = (Context)new InitialContext().lookup("java:");
| DataSource ds = (DataSource) envContext.lookup("--ourDs--");
| Connection connection = ds.getConnection();
|
| PreparedStatement ps = connection.prepareStatement(query);
| ResultSet resultSet = ps.executeQuery();
|
| //get XML result
| OracleXMLQuery oxq = new OracleXMLQuery(connection, resultSet);
| oxq.useNullAttributeIndicator(false);
|
| String result = oxq.getXMLString();
|
| resultSet.close(); ps.close(); connection.close();
| return result;
| }
| }
|
The DataSource is defined in it's own -ds.xml file thus:
| <datasources>
| <local-tx-datasource>
| <jndi-name>ourDS</jndi-name>
| <connection-url>jdbc:oracle:thin:@--host--:--port--:--service--</connection-url>
| <driver-class>oracle.jdbc.OracleDriver</driver-class>
| <user-name>--user--</user-name>
| <password>--pwd--</password>
| <min-pool-size>5</min-pool-size>
| <max-pool-size>100</max-pool-size>
| <!-- Checks the Oracle error codes and messages for fatal errors -->
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
| </local-tx-datasource>
| </datasources>
|
I'm stuck on this one... I don't think I'm asking too much from the Datasource... more likely I'm missing some config parameter.
Thanks in advance for any pointers.
Jonathan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135452#4135452
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135452
18 years, 1 month
[Installation, Configuration & DEPLOYMENT] - JEMS installer 1.2.1GA headless install fails
by gjeudy
Hi,
I failed to run JEMS installer 1.2.1 headless install under solaris sparc 5.8
for jboss 4.2.2 installation.
The cmd:
java -jar jems-installer-1.2.1.CR4.jar -installGroup default -installPath=/export/home/jboss-4.2.2
The VM dump:
#
| # An unexpected error has been detected by HotSpot Virtual Machine:
| #
| # SIGSEGV (0xb) at pc=0xfe2221bc, pid=18301, tid=12
| #
| # Java VM: Java HotSpot(TM) Server VM (1.5.0_05-b05 mixed mode)
| # Problematic frame:
| # V [libjvm.so+0x6221bc]
| #
|
| --------------- T H R E A D ---------------
|
| Current thread (0x00147298): JavaThread "CompilerThread1" daemon [_thread_in_native, id=12]
|
| siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x00000000
|
| Registers:
| O0=0x00000000 O1=0x003628b0 O2=0x00362890 O3=0xfdd10a94
| O4=0x0019dea0 O5=0x00000003 O6=0xb3f803b8 O7=0xfe222190
| G1=0x0019e46c G2=0xfe3dbc30 G3=0x0019e4d0 G4=0x00000001
| G5=0xfdffe7dc G6=0xf8415d10 G7=0xb3f81d98 Y=0xffffffff
| PC=0xfe2221bc nPC=0xfe2221c0
|
|
| Top of Stack: (sp=0xb3f803b8)
| 0xb3f803b8: 0019e444 0019de78 fe39c000 b3f80418
| 0xb3f803c8: 00000001 00000000 0019debc 00000000
| 0xb3f803d8: fe3dc24c b3f80974 00000000 0019debc
| 0xb3f803e8: b3f80974 0019e4a8 b3f80428 fdcf6250
| 0xb3f803f8: 00178df0 0046d62c 001d18c2 0000000a
| 0xb3f80408: 001a4948 0019ffcc 00000014 b3f80974
| 0xb3f80418: 00000000 00000002 00178e10 00000000
| 0xb3f80428: 00001000 b3f8099c fdd0af7c fe3df678
|
| Instructions: (pc=0xfe2221bc)
| 0xfe2221ac: 12 40 00 08 90 10 20 00 d2 02 a0 04 d0 02 60 08
| 0xfe2221bc: ca 02 20 00 c8 01 60 30 9f c1 00 00 01 00 00 00
|
| Stack: [0xb3f02000,0xb3f81d98), sp=0xb3f803b8, free space=504k
| Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
| V [libjvm.so+0x6221bc]
| V [libjvm.so+0xf6258]
| V [libjvm.so+0x1e0d0c]
| V [libjvm.so+0x27cfa4]
| V [libjvm.so+0x27fcf8]
| V [libjvm.so+0x275c1c]
| V [libjvm.so+0x2768d8]
| V [libjvm.so+0x332140]
| V [libjvm.so+0x2da83c]
| V [libjvm.so+0x652d58]
|
|
| Current CompileTask:
| opto: 73 net.n3.nanoxml.StdXMLParser.processElement()V (785 bytes)
|
|
| --------------- P R O C E S S ---------------
|
| Java Threads: ( => current thread )
| 0x00148340 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=13]
| =>0x00147298 JavaThread "CompilerThread1" daemon [_thread_in_native, id=12]
| 0x00146430 JavaThread "CompilerThread0" daemon [_thread_in_native, id=11]
| 0x001455c8 JavaThread "AdapterThread" daemon [_thread_blocked, id=10]
| 0x001447a0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=9]
| 0x0013ae68 JavaThread "Finalizer" daemon [_thread_blocked, id=8]
| 0x00138f20 JavaThread "Reference Handler" daemon [_thread_blocked, id=7]
| 0x00036c98 JavaThread "main" [_thread_in_Java, id=1]
|
| Other Threads:
| 0x00136a70 VMThread [id=6]
| 0x00149fc8 WatcherThread [id=14]
|
| VM state:not at safepoint (normal execution)
|
| VM Mutex/Monitor currently owned by a thread: None
|
| Heap
| PSYoungGen total 76480K, used 21128K [0xe2ab0000, 0xe8000000, 0xf8000000)
| eden space 65600K, 32% used [0xe2ab0000,0xe3f52078,0xe6ac0000)
| from space 10880K, 0% used [0xe7560000,0xe7560000,0xe8000000)
| to space 10880K, 0% used [0xe6ac0000,0xe6ac0000,0xe7560000)
| PSOldGen total 174784K, used 0K [0xb8000000, 0xc2ab0000, 0xe2ab0000)
| object space 174784K, 0% used [0xb8000000,0xb8000000,0xc2ab0000)
| PSPermGen total 16384K, used 3921K [0xb4000000, 0xb5000000, 0xb8000000)
| object space 16384K, 23% used [0xb4000000,0xb43d4618,0xb5000000)
|
| Dynamic libraries:
| 0x00010000 /usr/jdk1.5.0_05/bin/java
| 0xff350000 /usr/lib/libthread.so.1
| 0xff340000 /usr/lib/libdl.so.1
| 0xff200000 /usr/lib/libc.so.1
| 0xff390000 /usr/platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1
| 0xfdc00000 /usr/jdk1.5.0_05/jre/lib/sparc/server/libjvm.so
| 0xff2e0000 /usr/lib/libsocket.so.1
| 0xff1e0000 /usr/lib/libsched.so.1
| 0xff1b0000 /usr/lib/libCrun.so.1
| 0xff180000 /usr/lib/libm.so.1
| 0xff080000 /usr/lib/libnsl.so.1
| 0xff160000 /usr/lib/libmp.so.2
| 0xff060000 /usr/jdk1.5.0_05/jre/lib/sparc/native_threads/libhpi.so
| 0xff040000 /usr/lib/nss_files.so.1
| 0xfe7d0000 /usr/jdk1.5.0_05/jre/lib/sparc/libverify.so
| 0xfe790000 /usr/jdk1.5.0_05/jre/lib/sparc/libjava.so
| 0xfe770000 /usr/jdk1.5.0_05/jre/lib/sparc/libzip.so
| 0xfe550000 /usr/jdk1.5.0_05/jre/lib/sparc/libnet.so
|
| VM Arguments:
| java_command: jems-installer-1.2.1.CR4.jar -installGroup default -installPath=/export/home/jboss-4.2
| .2
|
| Environment Variables:
| JAVA_HOME=/usr/java/
| PATH=/export/home/jboss/build/maven-2.0.4/bin:/export/home/oracle/product/10.2/bin:/usr/java//bin:/u
| sr/bin::/usr/local/bin:/usr/bin:/usr/platform/SUNW,Sun-Fire-V240/sbin:.:/usr/local/maven/bin:/export
| /home/jboss/bin:/export/home/jboss/work/maven-1.0.2/bin:/usr/local/ant/bin:/usr/local/ant/bin/:/expo
| rt/home/jboss/build/maven-1.0.2//bin/:/export/home/jboss/bin/
| LD_LIBRARY_PATH=/usr/jdk1.5.0_05/jre/lib/sparc/server:/usr/jdk1.5.0_05/jre/lib/sparc:/usr/jdk1.5.0_0
| 5/jre/../lib/sparc:/export/home/oracle/product/10.2/lib::/usr/local/djengine755:/opt/odbc/lib:/usr/l
| ocal/ssl/lib:/export/home/jboss/work/profiler/jboss-profiler-1.0.CR4/jvmpi-src/solaris/bin:/usr/loca
| l/lib:/export/home/jboss/work/profiler/jboss-profiler-1.0.CR4/jvmti-src/solaris
| SHELL=/bin/bash
| DISPLAY=172.27.160.167:0.0
| HOSTTYPE=sparc
| OSTYPE=solaris2.8
| MACHTYPE=sparc-sun-solaris2.8
|
| Signal Handlers:
| SIGSEGV: [libjvm.so+0x6d3178], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
| SIGBUS: [libjvm.so+0x6d3178], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
| SIGFPE: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
| SIGPIPE: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
| SIGILL: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
| SIGUSR1: [libjvm.so+0x655038], sa_mask[0]=0x00008000, sa_flags=0x00000008
| SIGUSR2: [libjvm.so+0x273260], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c
| SIGHUP: [libjvm.so+0x653eb8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
| SIGINT: [libjvm.so+0x653eb8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
| SIGQUIT: [libjvm.so+0x653eb8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
| SIGTERM: [libjvm.so+0x653eb8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004
|
|
| --------------- S Y S T E M ---------------
|
| OS: Solaris 8 HW 7/03 s28s_hw3wos_05a SPARC
| Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
| Assembled 12 June 2003
|
| uname:SunOS 5.8 Generic_117350-26 sun4u (T1 libthread)
| rlimit: STACK 8192k, CORE infinity, NOFILE 10000, AS infinity
| load average:0.16 0.07 0.06
|
| CPU:total 2 has_v8, has_v9, has_vis1, has_vis2, is_ultra3
|
| Memory: 8k page, physical 16777216k(13283440k free)
|
| vm_info: Java HotSpot(TM) Server VM (1.5.0_05-b05) for solaris-sparc, built on Aug 26 2005 16:11:55
| by unknown with unknown Workshop:0x550
Any ideas of what could be causing this ?
Thanks,
-Guillaume
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135450#4135450
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135450
18 years, 1 month
[JBossCache] - Re: locking & CacheSPI
by mircea.markus
anonymous wrote : When our application decides to write to the cache, it needs to check what's already at the node that's there, and then depending on what it finds, it may choose to put the new object in the cache in the same node, or it may decide not to. It's important that a different thread doesn't change the object at that key in that node in between the read and the write. Locking behavior is what we want - the other thread should wait until the first thread is done before writing.
|
you should open a transaction (REPETABLE_READ) which would only commit after the write. This will assure that the read data won't be modified by other thread until commit/rollback takes place.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135422#4135422
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135422
18 years, 1 month
[EJB/JBoss] - EJB cannot be Bound
by allanrj
Hi everyone
I deployed application and i got below log on my server, my doubt is the ejb SitesSB (a session bean) i can look up or not ?
I didnt understand this message:
SitesSB cannot be Bound, doesn't have local and local home interfaces
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.EjbModule] startService, starting container: SitesSB
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:jndiName=ejb/br/com/gcm/ejb/sb/SitesSB,service=EJB
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] Starting jboss.j2ee:jndiName=ejb/br/com/gcm/ejb/sb/SitesSB,service=EJB
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] Begin java:comp/env for EJB: SitesSB
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] TCL: org.jboss.util.loading.DelegatingClassLoader@26c7da
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] Unable to retrieve orbjavax.management.InstanceNotFoundException: jboss:service=CorbaORB is not registered.
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding resource manager: jdbc/MARLIN to JDNI ENC as: jdbc/MARLIN
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding resource manager: jdbc/APAESP to JDNI ENC as: jdbc/APAESP
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] Binding resource manager: jdbc/GCM2 to JDNI ENC as: jdbc/GCM2
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.StatelessSessionContainer] End java:comp/env for EJB: SitesSB
| 2008-03-10 14:25:10,860 DEBUG [org.jboss.ejb.plugins.local.BaseLocalProxyFactory] SitesSB cannot be Bound, doesn't have local and local home interfaces
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.proxy.ejb.ProxyFactory] (re-)Binding Home ejb/br/com/gcm/ejb/sb/SitesSB
| 2008-03-10 14:25:10,876 INFO [org.jboss.proxy.ejb.ProxyFactory] Bound EJB Home 'SitesSB' to jndi 'ejb/br/com/gcm/ejb/sb/SitesSB'
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:service=EJB,plugin=pool,jndiName=ejb/br/com/gcm/ejb/sb/SitesSB
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.ejb.plugins.StatelessSessionInstancePool] Starting jboss.j2ee:service=EJB,plugin=pool,jndiName=ejb/br/com/gcm/ejb/sb/SitesSB
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.ejb.plugins.StatelessSessionInstancePool] Started jboss.j2ee:service=EJB,plugin=pool,jndiName=ejb/br/com/gcm/ejb/sb/SitesSB
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.j2ee:service=EJB,plugin=pool,jndiName=ejb/br/com/gcm/ejb/sb/SitesSB dependent components: []
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.resource.connectionmanager.CachedConnectionInterceptor] start called in CachedConnectionInterceptor
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.ejb.StatelessSessionContainer] Started jboss.j2ee:jndiName=ejb/br/com/gcm/ejb/sb/SitesSB,service=EJB
| 2008-03-10 14:25:10,876 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.j2ee:jndiName=ejb/br/com/gcm/ejb/sb/SitesSB,service=EJB dependent components: []
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135421#4135421
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135421
18 years, 1 month