How to catch Jbo-DML exception
Dear Forum
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 customize size of dialogbox.
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.
Hello
I also want to catch Exception if u r now able then plz send me the procedure
[email protected]
Thanks and Regards
Prashant
Similar Messages
-
How to catch error or exception for FM JOB_OPEN in code
Hi,
i am calling the FM 'JOB_OPEN' in my code to catch the error message when sy-subrc ne 0 but it is giving dump as there is nothing coming in sy-msgid, sy-msgtype. but when i just run this FM in SE37 then I am able to get the error for example when I pass blank for jobname then error comes is 'job missing' which is fine.
But this error I am not able to display from ABAP code which is as :
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_jobname
IMPORTING
jobcount = g_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Please suggest how to correct it ???
Thanks,
Mohantry this way
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_jobname
IMPORTING
jobcount = g_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3.
IF sy-subrc NE 0.
if sy-subrc = 1.
message 'cant_create_job ' type 'E'. "Exxception 1
elseif sy-subrc = 2.
message 'invalid_job_data ' type 'E'. "Exxception 2
else.
message ' jobname_missing ' type 'E'. "Exxception 3
endif.
ENDIF.
Regards,
Prabhudas -
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. -
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 -
How to catch up Exception message?
i have a question while using try{ ... }catch{ ... } clauses. for when update, delete, databse, there might be error occurred. all to often i do not deal with the message, only if to check log when serious problem i have to find it out; but i hope to learn how if i am able to display message of my own while erro occurrs. for instance, when falling into SQLException, originaly i might just utilize
}catch(SQLException e){
e.printStackTrace();
is it possible for me to catch up message inside the printStackTrace that may happen while errors appearing? (or only down to catch{} clause be the last deadline that i am able to use? because i hope i am able to capture error code like ora-1234 and tranlate it into messages that user, who doesn't know too much about pc, can understand easily while reporting bug; and not just saying "we have problem here!")
that is, if 'A' situation popping out, i hope to direct it to error page with special message shown. so does the same error page with different message specified while 'B' situation found out!
any suggestions would be appreciated~
thanks in advice,printStackTrace isn't obligatory. It's basically what you do with an exception when you don't have anything more specific to do with it.
You can certainly catch a specific exception at any level, including inside another try {} block.
Even having caught an exception you can decide that you don't want to handle it at this point in the code, and throw it again.
You might do:
try {
try {
... statment which migh cause a particular database exception
} catch(SQLException e) {
if(e.getMessage().startsWith("ORA-1232")) {
.. do somthing usefull
} else
throw e; // the particular SQL exception was unexpected so go on and crash
catch(Exception e) {
e.printStackTrace(); // unexpected program failure -
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 following error ---- JBO-25013: -----plz reply
can any one plz tell me how to catch and display this error.....
as an arror message box?
please reply as early as possible....
thanx
detail error page---
oracle.jbo.TooManyObjectsException: JBO-25013: Too many objects match the primary key oracle.jbo.Key[06927 ]. at oracle.jbo.server.OracleSQLBuilderImpl.doEntitySelect(OracleSQLBuilderImpl.java:796) at oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:5585) at oracle.jbo.server.EntityImpl.populate(EntityImpl.java:4712) at oracle.jbo.server.EntityImpl.merge(EntityImpl.java:5058) at oracle.jbo.server.EntityCache.add(EntityCache.java:565) at oracle.jbo.server.ViewRowStorage.entityCacheAdd(ViewRowStorage.java:1762) at oracle.jbo.server.ViewRowImpl.entityCacheAdd(ViewRowImpl.java:2151) at oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(ViewDefImpl.java:1070) at oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(ViewObjectImpl.java:2943) at oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(ViewObjectImpl.java:2842) at oracle.jbo.server.QueryCollection.populateRow(QueryCollection.java:2203) at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:2088) at oracle.jbo.server.QueryCollection.get(QueryCollection.java:1468) at oracle.jbo.server.ViewRowSetImpl.getRow(ViewRowSetImpl.java:3650) at oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(ViewRowSetIteratorImpl.java:2818) at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2687) at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2634) at oracle.jbo.server.ViewRowSetIteratorImpl.getRowAtRangeIndex(ViewRowSetIteratorImpl.java:722) at oracle.jbo.server.ViewRowSetImpl.getRowAtRangeIndex(ViewRowSetImpl.java:3672) at oracle.jbo.server.ViewObjectImpl.getRowAtRangeIndex(ViewObjectImpl.java:6263) at oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding$FacesModel._bringInToRange(FacesCtrlRangeBinding.java:541) at oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding$FacesModel.setRowIndex(FacesCtrlRangeBinding.java:504) at oracle.adf.view.faces.component.UIXCollection.setRowIndex(UIXCollection.java:378) at oracle.adf.view.faces.component.UIXTable._processStamps(UIXTable.java:496) at oracle.adf.view.faces.component.UIXTable.processFacetsAndChildren(UIXTable.java:377) at oracle.adf.view.faces.component.UIXCollection.decodeChildrenImpl(UIXCollection.java:141) at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803) at oracle.adf.view.faces.component.UIXCollection.processDecodes(UIXCollection.java:136) at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818) at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803) at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673) at javax.faces.component.UIForm.processDecodes(UIForm.java:144) at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818) at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803) at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673) at oracle.adf.view.faces.component.UIXComponentBase.decodeChildrenImpl(UIXComponentBase.java:818) at oracle.adf.view.faces.component.UIXComponentBase.decodeChildren(UIXComponentBase.java:803) at oracle.adf.view.faces.component.UIXComponentBase.processDecodes(UIXComponentBase.java:673) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:306) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336) at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196) at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230) at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)Hi,
have a look at SRDemo that you can download through JDeveloper (help--> check for updates) and see
SRDemoADFPhaseListener.java
and
SRDemoPageLifecycle.java
in the oracle.srdemo.view.frameworkExt package
Frank -
How to catch the user defined exception in application service
Hi All,
How to catch the user defined exception in application service when it is throwed by the external service..
Regards,
Thirumurugan.Hi,
Thanks for your reply,
Actually I am calling validate Login method of External service from the application service. When the login fails, my external service will throw user defined Exception.I want to catch the user defined Exception.
But in the application service , validate Login method can catch only Invocation Exception and Engine Exception.
These two exception are present in the Application service remote interface.
public com.sap.comptest.extsrv.accrjavawsvi__document.output.
Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException;
User defined exception is not present there. When i include the webservice as external service in CAF, it suppossed to generate the java file for the custom exception of validate Login method and this generated file should be included in the application service remote interface..
public com.sap.comptest.extsrv.accrjavawsvi__document.output.
Ns1_validateLoginResponse validateLogin(com.sap.comptest.extsrv.accrjavawsvi__document.input.Ns1_validateLogin input) throws com.sap.caf.mp.base.exception.InvocationException, com.sap.caf.mp.base.exception.EngineException,
(generated file name of user defined Excpetion.
Then only validate login method of application service can catch the user defined Exception which is thrown by the external service.
regards,
Thirumurugan.p -
How does JAVA catch Trigger's Exception?
I have a JAVA program which call a SQL (insert a record into table A). On the other hand, I have a trigger written in Oracle DB, which inserts a record to table B after a record has been added to table A.
Now, I find that when the trigger fails, both table A and table B doesn't have the new record. It seems to rollback the insertion into table A.
I want to catch the exception in the JAVA, but no exception is returned to the JAVA code. However, when i simulate the insert statement in the Oracle DB, there is some exception returned.
Do anyone know how to get the exception in JAVA?
--- java code reference ---
try
xxx.executeUpdate("insert into xxx (....) values ('"...."');
}catch(Exception e)
e.printStackTrace();Further information of the scripts
------------------- Script in Oracle ----------
create table a
(a1 varchar2(10));
create table b
(b1 varchar2(10));
create table c
(c1 varchar2(10));
create table d
(d1 varchar2(10));
insert into b values ('1');
insert into b values ('2');
insert into b values ('3');
insert into b values ('4');
insert into c values ('1');
insert into c values ('2');
insert into c values ('3');
CREATE OR REPLACE TRIGGER abc
AFTER INSERT ON a
FOR EACH ROW
DECLARE
temp_b1 varchar2(10);
BEGIN
SELECT b.b1 INTO temp_b1
FROM b, c
WHERE b.b1 = c.c1
and b.b1 = :New.a1;
INSERT INTO d(d1) VALUES(temp_b1);
END;
---------------- Run in SQLPLUS --------
SQL> insert into a values ('4');
insert into a values ('4')
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "BCA.ABC", line 6
ORA-04088: error during execution of trigger 'BCA.ABC'
---------------- Script in JAVA ----------
import java.io.*;
import java.sql.*;
import java.util.*;
import oracle.jdbc.OracleDriver;
import oracle.jdbc.driver.OracleSQLException;
public class langtest
public static void main(String args[])
throws Exception
DriverManager.registerDriver(new OracleDriver());
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:[user_name]/[password]@[ip_address]:[port]:[service]");
PreparedStatement pst = connection.prepareStatement("insert into a values ('4')");
try {
pst.execute();
} catch (OracleSQLException e)
System.out.println(e.getMessage());
System.out.println("done");
---------------- Run in JAVA Program -----
There is no error message in JAVA. No exception prompt out. Do you know how I can get the exception in JAVA, just like the Oracle SQLPLUS encountered?
Kelvin -
How should i know which exception should i catch?
hey all....
i am getting the following error msgs (everything is compiled just fine..)
I successfully translated the word car to αυτοκίνητο
15 Δεκ 2006 5:28:40 μμ com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 10.34.153.11; port: 1541"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._request(Unknown Source)
at WorkflowFramework._ServiceStub.translationService(_ServiceStub.java:18)
at wF.ServantEnglishToGreek.translationService(ServantEnglishToGreek.java:294)
at WorkflowFramework._ServiceImplBase._invoke(_ServiceImplBase.java:41)
at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleRequest(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleInput(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.handleRequest(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.dispatch(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.doWork(Unknown Source)
at com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(Unknown Source)
... 19 more
NEXT SERVER IS DOWN! org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No when i am running a function on a remote object reference
i have catched the exception and that is why the msg NEXT SERVER IS DOWN is printed..but how can i handle all the previous msgs?
i searched a lot on the internet and i cannot find how to catch this error...
all these msg seem to come from the java.net.ConnectException: Connection refused: connect but i dont have any statement that i can include in a catch try block so that i can do sth with that..(maybe print a msg..)
btw the line from my code that this msg is refering to is the following
try{
//call next server
nextServerRef.translationService(objRef, buffer);
// catch(java.net.ConnectException e){
catch(Exception e){
System.out.println("NEXT SERVER IS DOWN! "+e);
}and btw i cannot include this code to the ConnectException because it keeps complaining that this code cannot throw this exception....
any advice????
ps.i have posted a specific msg to the rmi subforum...but i am trying to undestand the general process ..to look the wood not the trees;-)If the runtime exception occurs in a method that doesn't either catch it or declare it as being thrown, and you can't change the method, then there's not much you can do except diverting the output to a non-visible location, or a null sink.
If you can change the method, you can either catch the exception and substitute your message, or you can change it to throw the method, and then catch the exception in a higher enclosing method, as I show:
public static void main(String[] args)
try
some_method();
catch (ConnectException ce)
System.out.println("NEXT SERVER IS DOWN");
static void some_method() throws ConnectException
throw new ConnectException(); // create the exception
} -
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. -
SOAP-XI-RFC sync without BPM scenario: How to catch timeout exception in PI
Hi all
I made a scenario where a Webservice request was placed via XI to RFC in CRM.
This is all done without BPM.
Now the request came up that I have to handle undhandled exceptions from RFC such as Fatal Error, Dump in CRM etc in PI so that customer can get the idea of what happend in the Backend rather PI failing in the monitoring. I did that in CRM by catching all the exception and sending a common error message to PI.
But another requirement is to handle Message Timeout of the RFC in PI for e.g. If the request goes to the RFC and due to the volume of the data, it gets Timed Out then neither PI nor CRM can handle this and it results in PI failing to catch this excpetion.
I tried Fault message type but that does not help either.
Can I get some expert advice.
Regards
NainaInclude your Send_to_RFC step inside a Block...have a deadline branch for this and an Exception Branch....in deadline branch have control step (thro Exception)....in Exception Branch have a Mapping and a Send Step....this mapping will produce a message (define separate DT for this) having constant values (like timeout occured message)
If you are fine with alert message...then instead of Mapping and Send step in Exception include a Control Step (thro alert)....alert message can be "timeout occured in receiving RFC response"
Regards,
Abhishek. -
How to catch SQLException from a session bean
Hello
I have a stateless session bean which has a method to persist an entity (User) in the database. In User there is a foreign key (addressId) from another entity (Address). While i was persisting User, i entered a value of addressId which was not present in the Address table. Since there was a foreign key constraint on this field in User i got the following exception:
8:49:49,421 ERROR [JDBCExceptionReporter] ORA-02291:
integrity constraint (FK_USER_ADD) violated - parent key not
found 18:49:49,421 ERROR [AbstractFlushingEventListener]
Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could
not insert: [com.User] at org.hibernate.exception.SQLStateConverter.convert(SQLState
Converter.java:71)So i placed the persist code inside a try block and was catching all the exceptions thrown by persist() method. But these exception are not caught. Instead the exception is sent to the Client end and printed on the client console.
Any clue on how to catch the ConstraintViolationException in the session bean?
ThanksThe problem is that the qry is not executed until you leave your method, so, the exception is catched by the Container. You should issue a entityManager.flush(); rigth "before" leaving the method and you are going to catch all the exceptions given
Cheers -
How to handle multiple save exceptions (Bulk Collect)
Hi
How to handle Multiple Save exceptions? Is it possible to rollback to first deletion(of child table) took place in the procedure.
There are 3 tables
txn_header_interface(Grand Parent)
orders(parent)
order_items (Child)
One transaction can have one or multiple orders in it.
and one orders can have one or multiple order_items in it.
We need to delete the data from child table first then its parent and then from the grand parent table.if some error occurs anywhere I need to rollback to child record deletion. Since there is flag in child table which tells us when to delete data from database.
Is it possible to give name to Save exceptions?
e.g.
FORALL i IN ABC.FIRST..ABC.LAST SAVE EXCEPTIONS A
FORALL i IN abc.FIRST..ABC.LAST SAVE EXCEPTIONS B
if some error occurs then
ROLLBACK A; OR ROLLBACK B;
Please find the procedure attached
How to handle the errors with Save exception and rollback upto child table deletion.
CREATE OR REPLACE
PROCEDURE DELETE_CONFIRMED_DATA IS
TYPE TXN_HDR_INFC_ID IS TABLE OF TXN_HEADER_INTERFACE.ID%TYPE;
TXN_HDR_INFC_ID_ARRAY TXN_HDR_INFC_ID;
ERROR_COUNT NUMBER;
BULK_ERRORS EXCEPTION;
PRAGMA exception_init(bulk_errors, -24381);
BEGIN
SELECT THI.ID BULK COLLECT
INTO TXN_HDR_INFC_ID_ARRAY
FROM TXN_HEADER_INTERFACE THI,ORDERS OS,ORDER_ITEMS OI
WHERE THI.ID = OS.TXN_HDR_INFC_ID
AND OS.ID = OI.ORDERS_ID
AND OI.POSTING_ITEM_ID = VPI.ID
OI.DW_STATUS_FLAG =4 --data is moved to Datawarehouse
MINUS
(SELECT THI.ID FROM TXN_HEADER_INTERFACE THI,ORDERS OS,ORDER_ITEMS OI
WHERE THI.ID = OS.TXN_HDR_INFC_ID
AND OS.ID = OI.ORDERS_ID
OI.DW_STATUS_FLAG !=4);
IF SQL%NOTFOUND
THEN
EXIT;
END IF;
FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
EXCEPTIONS
DELETE FROM ORDER_ITEMS OI
WHERE OI.ID IN (SELECT OI.ID FROM ORDER_ITEMS OI,ORDERS
OS,TXN_HEADER_INTERFACE THI
WHERE OS.ID = OI.ORDERS_ID
AND OS.TXN_HDR_INFC_ID = THI.ID
AND THI.ID = TXN_HDR_INFC_ID_ARRAY(i));
FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
EXCEPTIONS
DELETE FROM ORDERS OS
WHERE OS.ID IN (SELECT OS.ID FROM ORDERS OS,TXN_HEADER_INTERFACE THI
WHERE OS.TXN_HDR_INFC_ID = THI.ID
AND THI.ID = TXN_HDR_INFC_ID_ARRAY(i));
FORALL i IN TXN_HDR_INFC_ID_ARRAY.FIRST..TXN_HDR_INFC_ID_ARRAY.LAST SAVE
EXCEPTIONS
DELETE FROM TXN_HEADER_INTERFACE THI
WHERE THI.ID = TXN_HDR_INFC_ID_ARRAY(i);
COMMIT;
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YY HH:MIPM')||':
DELETE_CONFIRMED_DATA: INFO:DELETION SUCCESSFUL');
EXCEPTION
WHEN OTHERS THEN
ERROR_COUNT := SQL%BULK_EXCEPTIONS.COUNT;
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YY HH:MIPM')||':
DELETE_CONFIRMED_DATA: ERROR:Number of errors is ' ||ERROR_COUNT);
FOR indx IN 1..ERROR_COUNT LOOP
DBMS_OUTPUT.PUT_LINE('Error ' || indx || 'occurred during
'||'iteration'||SQL%BULK_EXCEPTIONS(indx).ERROR_INDEX);
DBMS_OUTPUT.PUT_LINE('Error is '
||SQLERRM(-SQL%BULK_EXCEPTIONS(indx).ERROR_CODE));
END LOOP;
END DELETE_CONFIRMED_DATA;
Any suggestion would be of great help.
Thanks in advance
AnuIf you have one or two places in your code that need multiple exceptions, just do it with multiple catch statements. Unless you are trying to write the most compact Programming 101 homework program, inventing tricks to remove two lines of code is not good use of your time.
If you have multiple catches all over your code it could be a code smell. You may have too much stuff happening inside one try statement. It becomes hard to know what method call throws one of those exceptions, and you end up handling an exception from some else piece of code than what you intended. E.g. you mention NumberFormatException -- only process one user input inside that try/catch so it is easy to see what error message is given if that particular input is gunk. The next step of processing goes inside its own try/catch.
In my case, the ArrayIndexOutOfBoundsException and
NumberFormatException should be handled by the same way.Why?
I don't think I have ever seen an ArrayIndexOutOfBoundsException that didn't indicate a bug in the code. Instead of an AIOOBE perhaps there should be an if statement somewhere that prevents it, or the algorithm logic should prevent it automatically. -
How to catch the error occurred in Integration Process, and then save it?
1. how to catch the error occurred in Integration Process, and then save the detailed error message to the file?
2. there are fault message type for inbound message interface, how to use the fault message type in IR?
Thanks,
Michael
Message was edited by: Spring Tang
inital
Message was edited by: Spring Tang
detailed message output
Message was edited by: Spring Tang
fault message typeHi Spring,
If u give an exception step along with your Transformation Step, whenever some error occurs in your message mapping, this exception block wil be triggered.
You can configure your exception block to do all exception processing that you want. This exception handling is like any other java Exceptio n Handler. You can do anything that you want in your exception handler block on the basis of your requirements.
<i>If an exception is triggered at runtime, the system first searches for the relevant exception handler in surrounding blocks. If it does not find the correct exception handler, it continues the search in the next block in the block hierarchy.
When the system finds the correct system handler, it stops all active steps in the block in which the exception handler is defined and then continues processing in the exception handler branch. Once the exception handler has finished processing, the process is continued after the block.
If the system fails to find an exception handler, it terminates the integration process with an error.</i>
Regards,
Bhavesh
Maybe you are looking for
-
How do I update to 3.6 or 4.0 to get on Powerschool?
They upgraded Power School at my daughters high school. Now I can't pull up her information from school. They told me Firefox must be at 3.6 or 4.0
-
How can you avoid the empty line?
hi all, i looked around quite a bit and didn't found an answer to this very common problem. i used this blog: Solution to the problem encountered using Variable Substitution with XI-SP12 for using a dynamic filename. the problem i get is the file ada
-
Hi. I have built a website in Dreamweaver, using Tables and Cells to position the elements where I wish: www.garethmunden.co.uk (yes the site looks too dark at the moment, I will be addressing that ASAP). The problem is, the site displays fine in IE/
-
What is the new 2.1.1 update?
I haven't even downloaded 2.0 yet b/c so many people where having problems with the calendar syncing and I use that ALL the time. 2.0.1 didn't seem to fix this either. So what's up with 2.1.1???
-
I've