[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
Tidying up your connections before exiting the bean is normally the thing to do, but what do you do if the bean is a SFSB and a database connection is part of the state to be kept between successive calls to the bean? Tim View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3865005#3865005 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3865005 --- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
"ter_d" wrote : Hi darranl, | so... where's my reply with my problem? | Esther Somewhere else within the forums, they are currently trying to fix the problems. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861731#3861731 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3861731 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
Hi darranl, so... where's my reply with my problem? Esther View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861639#3861639 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3861639 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
anonymous wrote : And who wrote in my name with no permission! There is currently an issue with the forum database where a number of posts have had their original author changed, I think the database is due to be rebuilt soon to correct this. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861432#3861432 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3861432 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
The reply at the beginning of this page is not the one I post one Friday. I would like to know where it is And who wrote in my name with no permission! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3861371#3861371 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3861371 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
I had the same error, but I don't want to close the connection in my ejb method, because if I do that, I can't work with my database. Is there any way to keep the connection open and close it manually outside the ejb method? Here's is my code: index.jsp | (...) | Connection conn=null; | String nombre_proceso=""; | try{ | InitialContext ctx = getInitialContext(); | paquetegestionDB.gestionDBHome home = paquetegestionDB.gestionDBHome)ctx.lookup("gestionDB"); | paquetegestionDB.gestionDB the_ejb = home.create(); | conn=the_ejb.conectar(); | (...) | ctx.close(); | the_ejb.remove(); | } | catch(RemoteException e){ | (...) | } | | finally | { | try | { | if (conn!=null) | if (!conn.isClosed()) | conn.close(); | }catch(Exception ignore){ System.out.println("error..."); } | } | This is my ejb method conectar: | public static Connection conectar() | throws SQLException, RemoteException | { | System.out.println("Intentamos hacer la conexiÃn"); | Context ctx = null; | Hashtable ht = new Hashtable(); | Connection conn = null; | ht.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); | ht.put(Context.PROVIDER_URL,"localhost"); | //ht.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); | try | { | ctx = new InitialContext(ht); | //ctx = new InitialContext(); | DataSource ds = (DataSource)ctx.lookup("java:/OracleDS"); | conn = ds.getConnection(); | System.out.println("Se ha realizado la conexi\363n con \351xito"); | return conn; | } | catch(Exception e) | { | System.out.println("Error:" + e); | e.printStackTrace(); | return null; | } | } | This is my oracle-ds.xml | | | OracleDS | jdbc:oracle:thin:@ip:1521:schema | oracle.jdbc.driver.OracleDriver | ... | ... | | Oracle9i | | | | And my ejb-jar.xml | | | | gestionDBEJB | gestionDB | paquetegestionDB.gestionDBHome | paquetegestionDB.gestionDB | paquetegestionDB.gestionDBEJB | Stateless | Container | | | OracleDS | javax.sql.DataSource | Application | | | | | | | | | gestionDB | * | | Required | | | | Users | users | | | | And finally, my jboss.xml: | | | | gestionDB | gestionDB | | OracleDS | java:/OracleDS | | | | | And that's the error I get: 14:51:04,327 INFO [CachedConnectionManager] Closing a connection for you. Plea se close them yourself: [EMAIL PROTECTED] 0 java.lang.Exception: STACKTRACE at org.jboss.resource.connectionmanager.CachedConnectionManager.register Connection(CachedConnectionManager.java:319) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateC onnection(BaseConnectionManager2.java:477) at org.jboss.resource.connectionmanager.BaseConnectionManager2$Connectio nManagerProxy.allocateConnection(BaseConnectionManager2.java:838) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrapp erDataSource.java:102) at paquetegestionDB.gestionDBEJB.conectar(gestionDBEJB.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) (..) 14:51:04,549 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for ser vlet jsp threw exception java.lang.NullPointerException at org.apache.jsp.index_jsp._jspService(index_jsp.java:232) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2 92) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.ja
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
PS also close statements and resultsets in the finally block View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3839714#3839714 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3839714 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
You should get the connection from the pool when you need it and not hang onto it. Make sure you close it before returning from a session bean method. void mymethod() | { | Object obj = (DataSource)ctx.lookup(jndiName); | Connection conn = (Connection) ds.getConnection(); |try |{ |//Use conn |} |catch(Exception e) |{ |} |finally |{ |conn.close(); |} | } View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3839713#3839713 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3839713 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: Stateful Session bean and java.sql.Connection problem
Did you get an answer to this problem? If so, could you share it with me? Thanks, Bryan Cooper View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3839708#3839708 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3839708 --- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user