How to catch exception when have max connection pool
hi,
i have define in oracle user that i could have max 10 sessions at the same time.
I have jdbc datasource & connection pool defined at glassfish server(JSF application).
now, if in application is too many queries to the database then i have error: nullpointer exception - becouse when i try to do:
con = Database.createConnection(); - it generates nullpointer exception becouse there isn't free connection pool
i try to catch exception like this:
public List getrep_dws_wnioski_wstrzymane_graph() { int i = 0; try { con = Database.createConnection(); ps = (Statement) con.createStatement(); rs = ps.executeQuery("select data, klasa, ile_dni_wstrzymana, ile_wnioskow from stg1230.dwsww_wstrzymane_dws8 order by data, klasa, ile_dni_wstrzymana, ile_wnioskow"); while(rs.next()){ rep_dws_wnioski_wstrzymane_graph.add(i,new get_rep_dws_wnioski_wstrzymane_graph(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4))); i++; } } catch (NamingException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); throw new NoConnectionException(); // catch null 1 } finally { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); throw new NoConnectionException(); // catch null 2 } } return rep_dws_wnioski_wstrzymane_graph; }
but at line:
con.close();
i have nullpointerexception
and
at line
throw new NoConnectionException(); // catch null 2
i have: caused by exception.NoConnectionException
what's wrong with my exception class? how to resolve it?
public class NoConnectionException extends RuntimeException{ public NoConnectionException(String msg, Throwable cause){ super(msg, cause); } public NoConnectionException(){ super(); } }
at web.xml i have defined:
<error-page> <exception-type>exception.NoConnectionException</exception-type> <location>/NoConnectionExceptionPage.jsp</location> </error-page>
thanks,
i did it and i have error:
java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
at logic.Database.createConnection(Database.java:37): conn = ds.getConnection();
public class Database {
public static Connection createConnection() throws NamingException,
SQLException {
Connection conn = null;
try{
Context ctx = new InitialContext();
if (ctx == null) {
throw new NamingException("No initial context");
DataSource ds = (DataSource) ctx.lookup("jdbc/OracleReports");
if (ds == null) {
throw new NamingException("No data source");
conn = ds.getConnection(); // here's exception when max connections to database
if (conn == null) {
throw new SQLException("No database connection");
} catch (NamingException e) {
e.printStackTrace();
throw new NoConnectionException();
} catch (SQLException e) {
e.printStackTrace();
throw new NoConnectionException();
catch (NullPointerException e) {
e.printStackTrace();
throw new NoConnectionException(); // obsluga bledy na wypadek jesli braknie wolnych polaczen do bazy
return conn;
}and at my ealier code i have error:
at logic.GetDataOracle.getrep_dws_wnioski_wstrzymane_graph(GetDataOracle.java:192)
at line: con = Database.createConnection();
in code:
public List getrep_dws_wnioski_wstrzymane_graph() {
int i = 0;
try {
con = Database.createConnection();
ps = (Statement) con.createStatement();
rs = ps.executeQuery("select data, klasa, ile_dni_wstrzymana, ile_wnioskow from stg1230.dwsww_wstrzymane_dws8 order by data, klasa, ile_dni_wstrzymana, ile_wnioskow");
while(rs.next()){
rep_dws_wnioski_wstrzymane_graph.add(i,new get_rep_dws_wnioski_wstrzymane_graph(rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4)));
i++;
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
throw new NoConnectionException();
} finally {
try {
if(con != null)
con.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
throw new NoConnectionException();
return rep_dws_wnioski_wstrzymane_graph;
}so what's wrong?
i have limit max sessions 10 at oracle so i set at my connection pool 5 connections as max. But when i get max 5 sesssins and try to execute next query then i can't catch exception..
Similar Messages
-
How to catch exception in JSP????
how to catch exception in JSP?
I use JDeveloper 3.1
I use connection with database .
When I insert record in database
when have duplicate of primary key
how to catch this exception and
back to previous page?
I trying with folowing:
<jsp:useBean id="RowEditor" class="oracle.jbo.html.databeans.EditCurrentRecord" scope="request">
<% try {
RowEditor.setUseJS(true);
RowEditor.initialize(pageContext, "package2_Package2Module.Drzavi1View");
RowEditor.setSubmitText("Save");
RowEditor.setTargetUrl("Drzavi1View_SubmitInsertForm.jsp");
RowEditor.createNewRow();
RowEditor.setReleaseApplicationResources(true);
RowEditor.render();
catch(Exception e) {
%>
<script>
alert("primary key duplication");
history.back();
</script>
<% } %>
but i't not working
please help mei catch exceptions as you do, i don't have any problem...
are you throwing the exception from your bean?
actually i don't catch an Exception, but an SQLException...
but it works... here is my code...
try
myclass.addElement(); // this is an insert into Oracle
catch( DataBaseFailException e ) /// an exception that i throws inside after i receive an SQLException
session.setAttribute("gMessage","e.getMessage()); // error code -
We have upgraded to fro m 3.0.8 portal 3.0.9.8.2 9iAS 1.0.2.2 on database 8.1.7
the system is very fast and run for sometime but after a while we see the following errors in Jserv.log file.
this error causes the whole system to hang and we have to restart apache/jserv.
Any light on this issue will be helpful and very much appreciated.
thanks,
Sunil Bontha
25/07/2001 14:07:51:388 CEST] Viewer/oracle.discoiv.Disco4iv: init
[25/07/2001 14:07:51:388 CEST] Viewer/oracle.discoiv.Disco4iv: Initializing Discoverer 4i Viewer (4.1.37.82)
[25/07/2001 14:09:15:219 CEST] page/oracle.webdb.page.ParallelServlet: init
[25/07/2001 14:09:15:249 CEST] page/JNI: Cache is enabled.
[25/07/2001 14:09:15:299 CEST] page/Starting a pool of 25 handlers.
[25/07/2001 14:09:43:820 CEST] page/JNI: Exception when trying to connect in 1.
[25/07/2001 14:09:43:830 CEST] page/Timeout occurred, label=145 url=http://www.myserver.com/pls/pmsportal30/!PMSPORTAL30.wwpro_app_provider.execute_portlet [25/07/2001 14:09:43:830 CEST] page/ContentFetcher InterruptedIOException Caught, Fetcher Timedout name=content-fetcher23
[25/07/2001 14:09:43:840 CEST] page/JNI: Exception when trying to connect in 1.
[25/07/2001 14:09:43:840 CEST] page/Timeout occurred, label=293 url=http://www.myserver.com/pls/pmsportal30/!PMSPORTAL30.wwpro_app_provider.execute_portlet [25/07/2001 14:09:43:840 CEST] page/ContentFetcher InterruptedIOException Caught, Fetcher Timedout name=content-fetcher22
[25/07/2001 14:09:53:864 CEST] page/JNI: Exception when trying to connect in 1.Hi Avi,
My application is a standalone application trying to access MBeans present in oc4j.
I tried
using the code
props.put(Context.INITIAL_CONTEXT_FACTORY ,"oracle.j2ee.rmi.RMIInitialContextFactory");
obj = (ManagementHome) ctx.lookup("ejb/mgmt/MEJB");
but i am getting the following error.
javax.naming.NameNotFoundException: ejb/mgmt/MEJB not found
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java
:45)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at TestMBean.doSomething(TestMBean.java:90)
at TestMBean.main(TestMBean.java:237)
java.lang.NullPointerException
at TestMBean.doSomething(TestMBean.java:107)
at TestMBean.main(TestMBean.java:237)
Regards
Siva -
Caught Exception when trying to create pool Object
Hi All,
When a stateless session bean is looking up the entity bean following 'could not create pool object' exception is throwing.
[14/Jan/2003:09:12:50] SEVERE ( 1048): EJB5070: Exception creating stateless session bean : [java.lang.reflect.InvocationTargetException]
[14/Jan/2003:09:12:50] SEVERE ( 1048): EJB5017: Exception while running preinvoke : ejbName = [ConfigSessionBean]
[14/Jan/2003:09:12:50] SEVERE ( 1048):
javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: c
java.lang.RuntimeException: Caught Exception when trying to create pool Object
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(Unknown Source)
at com.sun.ejb.containers.StatelessSessionContainer.getContext(Unknown Source)
at com.sun.ejb.containers.BaseContainer.preInvoke(Unknown Source)
at com.siptech.pdf.ejb.config.session.ConfigSessionBean_EJBObjectImpl.getAllModules(ConfigSessionBean_EJBObjectImpl.java:255)
at com.siptech.pdf.ejb.config.session._ConfigSessionBean_EJBObjectImpl_Tie._invoke(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(Unknown Source)
at com.sun.corba.ee.internal.iiop.ORB.process(Unknown Source)
at com.sun.corba.ee.internal.iiop.RequestProcessor.process(Unknown Source)
at com.iplanet.ias.corba.ee.internal.iiop.ServicableWrapper.service(Unknown Source)
at com.iplanet.ias.util.threadpool.FastThreadPool$ThreadPoolThread.run(Unknown Source)
at java.lang.Thread.run(Thread.java:536)
Caused by: javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB:
java.lang.reflect.InvocationTargetException
at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(Unknown Source)
... 13 more
javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: Caught Exception when trying to create pool Object
at com.sun.ejb.containers.StatelessSessionContainer.getContext(Unknown Source)
at com.sun.ejb.containers.BaseContainer.preInvoke(Unknown Source)
at com.siptech.pdf.ejb.config.session.ConfigSessionBean_EJBObjectImpl.getAllModules(ConfigSessionBean_EJBObjectImpl.java:255)
at com.siptech.pdf.ejb.config.session._ConfigSessionBean_EJBObjectImpl_Tie._invoke(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(Unknown Source)
at com.sun.corba.ee.internal.iiop.ORB.process(Unknown Source)
at com.sun.corba.ee.internal.iiop.RequestProcessor.process(Unknown Source)
at com.iplanet.ias.corba.ee.internal.iiop.ServicableWrapper.service(Unknown Source)
at com.iplanet.ias.util.threadpool.FastThreadPool$ThreadPoolThread.run(Unknown Source)
at java.lang.Thread.run(Thread.java:536)
I have also specified the following properties in the sunejbjar.xml for the session bean.
<ejb>
<bean-pool>
<steady-pool-size>2</steady-pool-size>
<resize-quantity>5</resize-quantity>
<max-pool-size>200</max-pool-size>
<pool-idle-timeout-in-seconds>3600</pool-idle-timeout-in-seconds>
</bean-pool>
</ejb>
--Muthu.Muthu,
To find out whether the problem is with container setting or with your application, can you create a simple stateless session bean and check if it works fine. If it works fine send me ejb-jar.xml and sun-ejb-jar.xml for your application.
Deepak -
Exception when trying to create pool Object
I've been trying to get the forte 4.0ee ProductRichClient example for container managed beans to work.
After the deployment to Sun One I got following exception when I'm using the client:
18.10.2002 10:56:20 com.iplanet.ias.appclient.Main <init>
INFO:
---------AppClient Container--------
18.10.2002 10:56:20 com.iplanet.ias.appclient.Main setTagetServerProperties
INFO: ACC001:Using ClientContainer file: [C:\Sun\AppServer7\appserv\domains\domain1\server1\config\sun-acc.xml].
18.10.2002 10:56:20 com.iplanet.ias.appclient.Main <init>
INFO: ACC014: ORB host name: [NOD]
18.10.2002 10:56:20 com.iplanet.ias.appclient.Main <init>
INFO: ACC013: ORB port number: [3700]
18.10.2002 10:56:21 com.sun.enterprise.appclient.AppContainer preInvoke
INFO: ACC007: Initiating Login ...
18.10.2002 10:56:21 com.iplanet.ias.appclient.Main <init>
INFO: ACC009: Load Application Class: [CMPClient.SwingClient]
18.10.2002 10:56:23 com.iplanet.ias.appclient.Main <init>
INFO: Application main() finished normally
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: nested exception is: java.lang.RuntimeException: Caught Exception when trying to create pool Object ; nested exception is:
java.lang.RuntimeException: Caught Exception when trying to create pool Object
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemException(Unknown Source)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
at CMPServer._ProductHome_Stub.create(Unknown Source)
at CMPClient.SwingClient.AddRow_ButtonActionPerformed(SwingClient.java:127)
at CMPClient.SwingClient.access$100(SwingClient.java:24)
at CMPClient.SwingClient$2.actionPerformed(SwingClient.java:89)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:258)
at java.awt.Component.processMouseEvent(Component.java:5021)
at java.awt.Component.processEvent(Component.java:4818)
at java.awt.Container.processEvent(Container.java:1525)
at java.awt.Component.dispatchEventImpl(Component.java:3526)
at java.awt.Container.dispatchEventImpl(Container.java:1582)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3359)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3074)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3004)
at java.awt.Container.dispatchEventImpl(Container.java:1568)
at java.awt.Window.dispatchEventImpl(Window.java:1581)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:191)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
Caused by: java.rmi.RemoteException: nested exception is: java.lang.RuntimeException: Caught Exception when trying to create pool Object ; nested exception is:
java.lang.RuntimeException: Caught Exception when trying to create pool Object
at com.sun.enterprise.iiop.POAProtocolMgr.mapException(Unknown Source)
at com.sun.ejb.containers.BaseContainer.postInvoke(Unknown Source)
at CMPServer.ProductEJB2024414397_ConcreteImpl_RemoteHomeImpl.create(ProductEJB2024414397_ConcreteImpl_RemoteHomeImpl.java:33)
at CMPServer._ProductEJB2024414397_ConcreteImpl_RemoteHomeImpl_Tie._invoke(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Unknown Source)
at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(Unknown Source)
at com.sun.corba.ee.internal.iiop.ORB.process(Unknown Source)
at com.sun.corba.ee.internal.iiop.RequestProcessor.process(Unknown Source)
at com.iplanet.ias.corba.ee.internal.iiop.ServicableWrapper.service(Unknown Source)
at com.iplanet.ias.util.threadpool.FastThreadPool$ThreadPoolThread.run(Unknown Source)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.RuntimeException: Caught Exception when trying to create pool Object
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(Unknown Source)
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(Unknown Source)
at com.sun.ejb.containers.EntityContainer.getPooledEJB(Unknown Source)
at com.sun.ejb.containers.EntityContainer.getContext(Unknown Source)
at com.sun.ejb.containers.BaseContainer.preInvoke(Unknown Source)
at CMPServer.ProductEJB2024414397_ConcreteImpl_RemoteHomeImpl.create(ProductEJB2024414397_ConcreteImpl_RemoteHomeImpl.java:25)
... 9 more
Caused by: javax.ejb.EJBException: nested exception is: java.lang.NullPointerException
at com.sun.ejb.containers.EntityContainer$EntityContextFactory.create(Unknown Source)
... 15 more
Any thoughts on why this exception is being thrown?
Thanks for any help!
Richardthis sample has been tested by the SunONE TOOLs QA
and is working. Please check your deployment descriptors
and use the cmp samples which come with S1AS to see if your
descriptors are correct. -
How to catch exception of JMS when call onMessage()?
I write a consumer client implement onMessage(),
in my main() method ...
try {
_adapter = new Adapter(checkConsumer,env);
_adapter.setSelector("client = 'Receive1'");
_adapter.start();
System.out.println("Hello...");
} catch(Exception e) {
_adapter = null;
System.out.println("Unable to start adapter: " + e.getMessage());
_adapter.start() will call onMessage() my onMessage like this
public void onMessage(Adapter adpt, Message message) {
try {
if(message instanceof TextMessage) {
// Write the text out as read String text = ((TextMessage)message).getText();
// Do CHECK Process adpt.demoOut("Receive CHECK Text is :" + text);
//System.out.println("class name is " + consumerName);
} else {
// This is just a message (no particular type) } } catch (Exception e) {
try {
adpt.warn("Error outputing data: " + message.getJMSMessageID());
} catch(Exception ignore) {
} adpt.warn("\tError: " + e.getMessage());
// Do some exception process }
If the JMS Server shutdown, how can I catch the exception?You might want to try with exception listener that JMS specification provides.
-
How to catch exception into a String variable ?
I have a code
catch(Exception e)
e.printStackTrace();
logger.error("\n Exception in method Process"+e.getMessage());
}when i open log i find
Exception in method Process null.
But i get a long error message in the server console !! I think thats coming from e.printStackTrace().
can i get the error message from e.printStackTrace() into a String variable ?
I want the first line of that big stacktrace in a String variable.
How ?A trick is to issue e.printStackTrace() against a memory-based output object.
void printStackTrace(PrintStream s)
// Prints this throwable and its backtrace to the specified print stream.
void printStackTrace(PrintWriter s)
// Prints this throwable and its backtrace to the specified print writer.Edited by: BIJ001 on Oct 5, 2007 8:54 AM -
How to catch exception thrown by ActionBinding "Commit"
I need a programmatic branch after the following line if an exception is thrown:
((JUCtrlActionBinding) panelBinding.findCtrlBinding("Commit")).invoke();
I am building an ADFSwing application using JDev 10.1.3.
I have a ViewObject derived from an EntityObject that I am trying to use for an insert.
I have placed the line above in a try block with a "catch (JboException je)" block which includes the code I need to execute upon exception. A default error dialog appears when an exception is thrown "(oracle.jbo.AttrValException) JBO-27014: ...", but the catch block I have created is not executed.
The effect is that a commit is not fulfilled, the default error dialog appears, but the program continues undaunted.
I have included "setBundledExceptionMode(false)" just before the try block, but that doesn't make any difference.
The commit statement above, and the try/catch block I've described are in a JUPanel.
Any help on how and where I can catch an exception from the action binding is really appreciated!!You can use code like this:
JUCtrlActionBinding commit = (JUCtrlActionBinding)panelBinding.findCtrlBinding("Commit");
commit.invoke();
if (!commit.getErrors().isEmpty()) {
/* Error list not empty. Something went wrong. */
} -
How to catch exception for class CL_HR_RE512W for method CHECK_CUMULATION
Hi,
How do I catch an exception when using method CHECK_CUMULATION in class CL_HR_RE512W.
This method calls an instance method READ which raises NO_ENTRY if a wage type is missing on T512W.
There is no obvious catch class to use?
My code:
data: r_512w type ref to cl_hr_re512w.
start-of-selection.
create OBJECT r_512w.
call method r_512w->check_cumulation
exporting
p_molga = molga
p_lgart = lgart
p_cumul = cumul
p_date = date
receiving
p_has_cumulation = p_flg.
If lgart = '9999', for example, then we get an error message:
'No entry in table T512W for key 08 9999 25.08.2009'Hi Gemini Twin,
Check this link:
https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP+Objects+-+Defining+a+Class-based+exceptions
Hope this information is help to you.
Regards,
José -
How to catch exception while validating the username and password in hbm
Hi,
I do want to set the username and password dynamically in hibernate.cfg.xml
Here below is my configuration file.
{code<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>{code}
Also im getting that session factory object like the below code.
public class Sessions { private static SessionFactory sessionFactory; private static Configuration configuration = new Configuration(); static { try { String userName = GuigenserviceImpl.userName; String password = GuigenserviceImpl.password; String hostName = GuigenserviceImpl.hostName; String portNo = GuigenserviceImpl.portNo; String sId = GuigenserviceImpl.sId; configuration .setProperty("hibernate.connection.username", userName); configuration .setProperty("hibernate.connection.password", password); configuration.setProperty("hibernate.connection.url", "jdbc:oracle:thin:@" + hostName + ":" + portNo + ":" + sId); try { configuration.configure("/hibernate.cfg.xml"); sessionFactory = configuration.buildSessionFactory(); GuigenserviceImpl.strAccpted = "true"; } catch (Exception e) { e.printStackTrace(); GuigenserviceImpl.strAccpted = "false"; } } catch (HibernateException hibernateException) { GuigenserviceImpl.strAccpted = "false"; hibernateException.printStackTrace(); } catch (Throwable ex) { GuigenserviceImpl.strAccpted = "false"; ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; }
So, in this above scenario, suppose if im giving the wrong password means exception should be caught and the string variable "GuigenserviceImpl.strAccpted" should be assigned to false.
But im getting the SQL Exception only in console like wrong username and password. And finally i couldn't able to catch the exception in Sessions class, static block.
Anyone can help me in catching that SQL Exception in my Sessions class and i need to handle that SQL Exception in my class.
Im getting this following exception message in my console.
INFO: configuring from resource: /hibernate.cfg.xml Apr 6, 2009 2:47:00 PM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml Apr 6, 2009 2:47:00 PM org.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 10 Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: autocommit mode: false Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@192.168.1.12:1521:orcl Apr 6, 2009 2:47:00 PM org.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {user=scott, password=****} Apr 6, 2009 2:47:01 PM org.hibernate.cfg.SettingsFactory buildSettings WARNING: Could not obtain connection metadata java.sql.SQLException: ORA-01017: invalid username/password; logon denied at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:406) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:799) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:368) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:140) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298) at com.beyon.ezygui.server.Sessions.<clinit>(Sessions.java:39) at com.beyon.ezygui.server.GuigenserviceImpl.testRPC(GuigenserviceImpl.java:322) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Thanks in advance.
Thanks & Regards,
Kothandaraman N.Hi,
Myself hardcoded that username and password checking like the below code.
String name = loginData.get("userName").toString();
String pswd = loginData.get("pswd").toString();
String hstName = loginData.get("hName").toString();
String prtNo = loginData.get("portNo").toString();
String sid = loginData.get("sId").toString();
SessionFactory sessionFactory = null;
try {
if (name.trim().equals(userName) && pswd.trim().equals(password)
&& hstName.trim().equals(hostName)
&& prtNo.trim().equals(portNo) && sid.trim().equals(sId)) {
sessionFactory = Sessions.getSessionFactory();
strAccpted = "true";
} else {
strAccpted = "false";
} catch (Exception e) {
e.printStackTrace();
strAccpted = "false";
}I have my own values in string objects, then comparing that values with the values from login form. If both values are matching, then i will do configurations in hibernate.
ResourceBundle resourceBundle = ResourceBundle
.getBundle("com.beyon.ezygui.server.Queries");
public static final String connection_url = resourceBundle
.getString("connection.url");
public static final String userName = resourceBundle.getString("userName");
public static final String password = resourceBundle.getString("password");
public static final String hostName = resourceBundle.getString("hostName");
public static final String portNo = resourceBundle.getString("portNo");
public static final String sId = resourceBundle.getString("sId");The above are the String objects i'm checking for the match with values from login form.
Thanks & Regards,
Kothandaraman N. -
How to catch exception thrown from a function module?
Hi all,
When we are calling a function module from JSPDynpage setting some import parameters, If in some case an exception is thrown in the function module. How can we catch the same exception in the JSPDynpage program?
Thanks & Regards,
RaviHi Ravi
Try this
try
Object retMsgs = output.get(bapiretrunmsgobject);
if(result != null )
IrecordSet rmsg = (IrecordSet) result
catch(Exception ex)
printException(ex, "Error getting function result");
Lemme know for any further questions.
Regards
Praveen -
How to catch filenotfoundexception when user enters a bogus page
How to catch when user enters a bogus jsp page. I have login.jsp. If someon enter log.jsp i get javax.servlet.ServletException: java.io.FileNotFoundException and then the whole path is shown. This onlyhappens with 9ias. When i was using http server that came with 9i database, i was able to catch this with send_error=true in zone.properties. It doesnt work with 9ias. How is everyone catching these errors? I cant seem to find out how to do it.
ThanksHi Adam,
I am also facing the same problem of the java.io.FIleNotFOundException in the browser display when i am giving a wrong file path in the Url. you have mentioned that you have solved it when you were using Orcale 8i Http Server, can you please guide me for that( as we are also using Oracle 8i) I checked with putting send_error=true in zone.properties file but that is not working. What exctly you have done to get rid of that error message. I am using Windows Nt platform.
Thanks and Regards.
Arnab -
How to catching exceptions from another thread
hi,guys,i have some code like this:
public static void main(String[] args) {
TimeoutThread time = new TimeoutThread(100,new TimeOutException("超时"));
try{
t.start();
}catch(Exception e){
System.out.println("eeeeeeeeeee");
TimeoutThread will throws an exception when it runs ,but now i can't get "eeeeeeeeeee" from my console when i runs the main bolck code.so ,somebody help me ,thk.hi,ejp,this is my scene:
getHttpParty(String name) is a method get some information from a web site,this maybe cause many times.now this method is called in my main(String args[]) method.
i want to terminate getHttpParty if it runs 2s, can you give some simple code to do this.
thank you very much.
Edited by: user5449747 on 2010-11-17 上午12:03 -
How to catch exception throw bc4j
Dear Forum
I am user of JDeveloper Swing application.
while exception throw from bc4j some particular
type error such as (oracle.jbo.DMLException) JBO-26041
message display.
i want to catch error no 26041 inorder to display own
messageBox.
There is two methods
1-:
i used messageBundle class i overite message string but unable to change dialogBox,i want to use own dialog.
2-:
And i fund ,DML exception message return from JUErrorHandlerDlg class.So using this subclass how
to catch and throw own message.
Plase send me some code to write sub class of JUErrorHandlerDlg.You want this method System to throw an exception if the String[] is empty?
public void system( ObjectOutputStream output, String cmd [] ) {
if (cmd.length == 0)
throw new IllegalArgumentException("Hey! This is an empty array!");
//...rest of your method
}You can choose for yourself which exception type is most appropriate. You can in theory always use the base Exception but is not very specific nor recommended. In this case, I think an existing unchecked exception such as IllegalArgumentException would be the most appropriate. -
Help Me, How to catch exception thrown from ejbStore
Hi,
I am working on application running on Iplanet Application Server 4.0. Problem is the application exception thrown from the ejbStore don't reach the calling servlet, calling servlet receive TransactionRollback exception which is system exception. But there is no sign of my application exception thrown from ejbStore. Can anybody tell me how I can get my ApplicationException thrown from ejbStore in my calling servlet.
I am calling entity beans set method in servlet and in entity bean ejbStore method I am throwing Application exception.
in entity bean
public void ejbStore() throws MyException
if(true) throw new MyException();
in servlet
try {
MyEntityHome home = .......
MyEntityRemote remote = home.findBy.....
remote.setMyValue(MyValue value); //Transaction required Container managed
}catch(MyException e) {
e.printStackTrace(); // Not cahcing My Exception
}catch(Exception e) {
e.printStackTrace(); //catching TransactionRolledBackException
Thanks
ShaktiHi Ravi
Try this
try
Object retMsgs = output.get(bapiretrunmsgobject);
if(result != null )
IrecordSet rmsg = (IrecordSet) result
catch(Exception ex)
printException(ex, "Error getting function result");
Lemme know for any further questions.
Regards
Praveen
Maybe you are looking for
-
Can I post an Iweb blog on a non-.mac server. I.e. Goddady?
When I try to post an I web blog to my Godaddy account the blog does not display. I know the apple materials state that comments and searching options will not work but as far as I can see there is nothing about it not working at all. Any help would
-
Cannot open multiple PDFs in Acrobat Reader X
Ever since upgrading to Acrobat X, I cannot open multiple PDFs. With all previous versions over recent years, up to version 9, I could select multiple PDF files in Windows Explorer, hit Enter, and it loaded them all. Then I could Ctrl+F6 to switch be
-
Saving and sending Adobe Form pdf from WebDynpro
Hi, I'm developing an application which receives data from a RFC to a R/3. The datas are displayed on a pdf-Document in a Webdynpro. This works fine. Now I want to send this form as attachment in an email. Do I have to save it first as pdf or can I s
-
How Respond() function knows what NID to use
Hi, I need to respond a notification from my application, I read a lot of message about it, but I can't see how to get the notification ID (NID) to call respond() function, I saw the following example about it: CREATE OR REPLACE PROCEDURE "RESPOND" (
-
Can i use an airport express as both a bridge and for airtunes?
I have an Airport Extreme Base Station (5th gen) and an Airport Express. The Airport Express is currently set up only for Airtunes. I would like to use it to extend my existing wifi signal to the backyard. Do I have to use the Airport Express EITHER