GetWarnings on Connection throws exception if rollback = true

I am trying to use hibernate within WLS 7SP4 and I get an exception everytime it
tries to close an exception.
inside
weblogic.jdbc.jts.Connection.getWarnings()
the first thing it does is call the method
checkIfRoleBack(). This essentially throws an exception if the Transaction is
currently in a roleback state
If you look at the java API for get warnings it says it should only throw an exception
if a database access error occurs. However a transaction being in a roleback state
is not exactly a database error it is a perfectly valid state.
THe problem I have is that when Hibernate tries to close a connection it also
tries to log all the warnings on the connection. This means that closing a rolledback
connection always throws an exception.
Is this a bug in the weblogic implementation of Connection or is this expected
beahviour.

In that case we will be fine and the change is not that important
Thanks
Carl
Joe Weinstein <[email protected]> wrote:
>
>
Carl wrote:
If the tx times out will I still be able to use sessionContext.getRollBackOnly()
or will this only work if manually set.That should certainly still work. It is only JDBC that is prevented after
the
tx is done.
Joe
Thanks
Carl
Joe Weinstein <[email protected]> wrote:
Carl Marais wrote:
Thanks Joe for the response.
My current solution is just to log and consume the exceptions if doinga close
when the SessionContext of the EJB is set to Rollback. Judging fromwhat you are
saying this should not have any impact on overall processing and theoriginal
business exception can still flow through to the clientCorrect. The exception from getWarnings() has no effect on any processing
and
can be ignored if it's meaning is understood. We will currently allow
no jdbc
to be done, as soon as the tx is done for any reason. This could occur
at any
time, if for instance the tx reached it's timeout limit in-flight.
Let me know how important the change I suggested is, or whether
you're
OK
as-is for now with the above explained.
thanks,
Joe
Joe Weinstein <[email protected]> wrote:
Carl Marais wrote:
I am trying to use hibernate within WLS 7SP4 and I get an exceptioneverytime it
tries to close an exception.
inside
weblogic.jdbc.jts.Connection.getWarnings()
the first thing it does is call the method
checkIfRoleBack(). This essentially throws an exception if the Transactionis
currently in a roleback state
If you look at the java API for get warnings it says it should onlythrow an exception
if a database access error occurs. However a transaction being in
a
roleback state
is not exactly a database error it is a perfectly valid state.
THe problem I have is that when Hibernate tries to close a connectionit also
tries to log all the warnings on the connection. This means that
closing
a rolledback
connection always throws an exception.
Is this a bug in the weblogic implementation of Connection or is
this
expected
beahviour.Hi. I can see it's being unexpected, but we must do all we can toensure
that
application code does no JDBC (which for the most part is intendedto
contribute
to the transaction) when the transaction is not in an accepting state.
For maximum
concurrency we actually reclaim the underlying pooled connection
as
soon
as the
fate of the transaction is sealed. This means that the warnings itmay
have accrued
are no longer accessible to the client. This is because we turn offthe
wrapper
object that the client has (generating that exception), and for pool
cleanliness
we always clear any warnings the connection may have collected during

Similar Messages

  • Connection pool not re-establishing connections, throwing exception instead

    Hello,
    I've just set up a connection pool on the sun java system application server 8 for a MySQL database using the official mysql-connector/j 5.0. Everything is working great, except when the connections timeout (or i kill them all manually from the database server) and then request a page that needs to use the DataSource object, the following exception is thrown:
    Exception thrown: com.mysql.jdbc.CommunicationsException -- Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    java.io.EOFException
         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1913)
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2304)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2803)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3118)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3047)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:1166)
         at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeQuery(StatementWrapper.java:705)
         at beans.MySessionBean.businessMethod(MySessionBean.java:73)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:70)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.What could be wrong?
    Thank you.

    The code is here:
        public String businessMethod() {
            //TODO implement businessMethod
            try
                InitialContext ic = new InitialContext();
                Object obj = ic.lookup("jdbc/MyDS");
                System.out.println("Object is: " + obj + " | Class is: " + obj.getClass().getName());
                DataSource ds = (DataSource)obj;
                Connection conn = ds.getConnection();
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery("SELECT a,b FROM test");
                String ret = "";
                while(rs.next())
                    ret += rs.getString(1) + " - " + rs.getString(2) + "<br/>";
                conn.close();
                return ret;
            catch(Exception e)
                return "Exception thrown: " + e.getClass().getName() + " -- " + e.getMessage();
        }On the server, it is set up as XADataSource. I don't really have a big need for distributed transactions, but does it hurt badly to use it anyways? Could it be causing this problem?

  • B1DiEventService:  ERROR :Connect throw an exception: Host is unknown

    Hi,
    I tried to create an event service. I followed the example of VB code. When I try to connect to the service using following code:
    Function Connect() As Boolean
            Try
                ' Create an instance of B1DIEventsService, Company object as parameter
                evtService = New B1DIEventsService.B1DIEventsService(oCompany)
                'Connect to the service
                evtService.Connect(New B1DIEventsService.B1DIEventsConnectionLostDelegate(AddressOf OnServerShutdown))
                Return True
            Catch ex As B1DIEventsService.B1DIEventsException
                SBO_Application.MessageBox("EVENT_ERROR :" + ex.Message)
            Catch ex As Exception
                SBO_Application.MessageBox("ALG_ERROR :" + ex.Message)
            End Try
            Return False
        End Function
    I get the message EVENT_ERROR :Connect throw an exception. Host is unknown
    I'm using the examples for 2005 SP01 private connections.
    Logfile shows following info:
    TIME;LEVEL;INFO;
    31-5-2007 15:22:26;INFOPLUS;TraceLevel: Warning
    31-5-2007 15:22:26;INFOPLUS;PortNumber: 4334
    31-5-2007 15:22:26;INFOPLUS;KeepAlivePeriod: 2000000
    31-5-2007 15:22:26;INFOPLUS;KeepAliveMax: 12000000
    31-5-2007 15:22:26;INFOPLUS;MaxSizeAction: Replace
    31-5-2007 15:22:26;INFOPLUS;MaxFileSize: 6000000
    31-5-2007 15:22:28;INFOPLUS;Connect to server.
    31-5-2007 15:22:29;INFOPLUS;Client: Reference to server acquired
    31-5-2007 15:22:34;ERROR;Connect throw an exception: <u>Host is onbekend</u>
    The last part (underlined) is dutch and means "Host is unknown."
    Can anyone help please?
    Thanks and Regards,
    Sander

    Hi Sander,
    It seems like the name or adress of the server is unknown for the machine, it cannot connect to it or the server is not running.
    Is your oCompany object initialized and connected to the DI API before creating the B1DIEventsService?
    Have you tried to run client and server side in the same machine to do a small test?
    The problem is at the .NET Remoting interface, it cannot connect to it.
    Regards
    Trinidad.

  • Throws Exception when jdbc connect to Oracle

    Hi! I'm waiting for your answers.
    When i use jdbc to connect Oracle,system throws exceptions as follows:
    java.lang.ClassCastException: oracle.sql.converter.CharacterConverter12Byte
    oracle.sql.CharacterSet1Byte oracle.sql.CharacterSet1Byte.getInstance (int,racle.sql.converter.CharacterConverter)
              CharacterSet1Byte.java:82
         oracle.sql.CharacterSet oracle.sql.CharacterSetWithConverter.getInstance(int)     CharacterSetWithConverter.java:85
    I code in Oracle9i Jdeveloper 9.0.2. The Oracle version is 9.0.2.
    My code example is as follows:
    package mypackage2;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public class Class1
    public Class1()
    public static void main(String[] args)
    Class1 class1 = new Class1();
    Connection conn = null;
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    //exception throws in getConnection()
    conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@localhost:1521:CR","system","CR2001");
    catch (Exception e)
    e.printStackTrace();

    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import oracle.jdbc.driver.*;
    public class viewtable
         Connection con;
         Statement st;
         public viewtable (String args[]) throws ClassNotFoundException,FileNotFoundException,IOException,SQLException
         url="jdbc:oracle:thin:system/manager@IP:1521:SID";
         Class.forName ("oracle.jdbc.driver.OracleDriver");
         try
         con=DriverManager.getConnection(url);
              st = con.createStatement ();
              doexample ();
              st.close ();
              con.close ();
         }catch(SQLException e)
              System.err.println(e.getMessage());
         public void doexample () throws SQLException
         ResultSet rs = st.executeQuery("select * from sales");
              if(rs!=null) {
              while(rs.next())
                   int a = rs.getInt("no");                    System.out.println("NO = "+a);
              rs.close();
         public static void main (String args[])
              System.out.println ("Oracle Exercise 1 \n");
              try
                   viewtable test = new viewtable(args);
              } catch (Exception ex)
                   System.err.println ("Exception caught.\n"+ex);
                   ex.printStackTrace ();
    the above is the full code, please check the problem....many thanks

  • Rmi client throws Connection Refused exception

    My Rmi client throws a Connection Refused exception when i try to run it on remote machine (in this case i run it on my virtualbox macine).
    The virtualbox machine network is in NAT mode (host machine ip should be 10.0.2.2).
    When rmi client starts get registry instance and print in standar output:
    RegistryImpl_Stub[UnicastRef2 [liveRef: [endpoint:[//10.0.2.2/:1099,util,RmiInstances$1@1275d39](remote),objId:[0:0:0, 0]]]]But when rmi client trys to use any of remote methods it throws Connection Refused, but it's to strange because the Connection Refused has 127.0.1.1 as ip.
    java.rmi.ConnectException: Connection refused to host: 127.0.1.1; ....In client RmiInstances code (this class contains all remote implementations) is:
    public class RmiInstances {
        private static RmiInstances instance;
        private IUserManage userManage;
        private IAnalysis analysis;
        private IPacientManage pacientManage;
        private IInsuranceManage insuranceManage;
        private Config config;
        private RmiInstances()
                throws RemoteException, NotBoundException, IOException {
            this.config = Config.getInstance();
            Registry registry = LocateRegistry.getRegistry(config.getServerUrl()+"/",
                    1099, new RMIClientSocketFactory() {
                @Override
                public Socket createSocket(String host, int port) throws IOException {
                    try {
                        URI uri = new URI(config.getServerUrl()+
                                ":"+config.getServerPort());
                        return new Socket(uri.getHost(), uri.getPort());
                    } catch (URISyntaxException ex) {
                        ex.printStackTrace();
                        return null;
            System.out.println(registry);
            userManage = (IUserManage)registry.lookup("RUserManage");
            analysis = (IAnalysis)registry.lookup("RAnalysis");
            pacientManage = (IPacientManage)registry.lookup("RPacientManage");
            insuranceManage = (IInsuranceManage)registry.lookup("RInsuranceManage");
    ...And server code is the next:
    public static void main(String[] args) {
         System.out.println("GNULab Server " + VERSION + " starting...");
         System.setProperty("java.rmi.server.codebase",
              "file:/home/zarovich/workspace/labserver/bin");
         try {
             // Loading config
             System.out.println("Loading config...");
             Config config = Config.getInstance();
             // inicializando rmi registry
             Registry registry;
             if (config.isSsl()) {
              registry = LocateRegistry.createRegistry(
                   config.getServerPort(), new RmiSSLClient(),
                   new RmiSSLServer());
             } else
              registry = LocateRegistry
                   .createRegistry(config.getServerPort());
             // instanciando implementaciones
             RAnalysis rAnalysis = new RAnalysis();
             RInsuranceManage rInsuranceManage = new RInsuranceManage();
             RPacientManage rPacientManage = new RPacientManage();
             RUserManage rUserManage = new RUserManage();
             // registrando interfaz rmi
             registry.rebind("RAnalysis", (IAnalysis) UnicastRemoteObject.exportObject(rAnalysis, 0));
             registry.rebind("RInsuranceManage", (IInsuranceManage) UnicastRemoteObject.exportObject(rInsuranceManage, 0));
             registry.rebind("RPacientManage", (IPacientManage) UnicastRemoteObject.exportObject(rPacientManage, 0));
             registry.rebind("RUserManage", (IUserManage) UnicastRemoteObject.exportObject(rUserManage, 0));
             System.out.println("GNULab Server " + VERSION + " listening ...");
             System.out.println("Registry instance: " + registry.toString());
         } catch (RemoteException e) {
             e.printStackTrace();
            * catch (MalformedURLException e) { e.printStackTrace(); }
            */catch (IOException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         } catch (JDOMException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
    ...

    I'm solved my problem.
    I just need run my server with -Djava.rmi.serverhost=10.0.2.2 and my client running on my virtualbox machine works!

  • Connection Refused Exception.

    Hi! I have made a java server as an NT Service. This server and my client works fine when I run them from command prompt. But when I make the server as an NT service and then try to connect to it using this client, I get an exception saying connection refused. Can anyone help me with this, its urgent.
    thanks
    rahul

    This is the client program
    import java.net.*;
    public class Client {
    public static void main(String[] args)
    try
    Socket mySocket = new Socket("localhost", 4000);
    System.out.println("Connected");
    catch (Exception e)
    System.err.println("Exception: " + e);
    This is the Server Program
    import java.io.*;
    import java.util.Date;
    class MyServer {
    int m_port;
    ServerSocket m_serverSocket;
    public static void main(String[] args)
    new MyServer(4000);
    public MyServer(int port)
    m_port=port;
    try {
    init();
    catch (Exception e)
    System.out.println("Caught : "+e);
    public void init() throws Exception
    m_serverSocket = new ServerSocket(m_port);
    while(true)
    Socket client = m_serverSocket.accept();
    Thread clientThread = new Thread(new ClientHandler(client));
    clientThread.start();
    public void close() throws Exception { m_serverSocket.close(); } }
    and this is the ClientHandler PRogram.
    import java.io.*;
    import java.net.*;
    import java.util.Date;
    class ClientHandler implements Runnable {
    Socket m_socket;
    public ClientHandler(Socket clientSocket) {
    m_socket=clientSocket; }
    public void run() {
    try {
    processRequests();
    m_socket.close();
    catch (Exception e) { System.out.println("Caught "+e); }
    public void processRequests() throws IOException {
    DataOutputStream dout= new DataOutputStream(m_socket.getOutputStream());
    dout.writeChars((new Date()).toString()+"\n"); } }
    ...The point is that they run perfectly on command prompt but not when i make this server as nt service.
    What could go Wrong ??
    thanks
    rahul

  • "Properly" throw exception...

    I'm trying to verify an application written in j2ee, and one some of our EJBs, we get verification failures with messages like
    In remote interface DeviceController, method [ connect ] does not properly throw exception java.rmi.RemoteException
    What does "properly" mean? I checked in both the remote interface (DeviceController.java) and in the bean itself (DeviceControllerBean.java), and in both files, method [ connect ] is declared to throw RemoteException.

    Methods defined in the remote interface must include in their throws clause the java.rmi.RemoteException. However, in the bean class, the business method should not throw the RemoteException and cmp-version 2.x beans must not throw the RemoteException. Another thing to check is that the method arguments and return type values should be the same between the interface and bean class. If this is also true, make sure the deployment descriptors agree as well.

  • Throws Exception - a newcomer...

    I have written a small amount of code that takes information from a text file and displays it in a GUI (swing) - this is called my RasterDisplay class. However, I am now creating another part of the GUI which will have a button that makes a new RasterDisplay. However, when I try and call my RasterDisplay constructor from within my actionPerformed method (see below) It tells me I have an "unhandled Exception type Exception". I can't throw Exception in the actionPerformed method so how do I get this method to work? Any help would be greatly appreciated - I am a total newcomer to Java and can't make head nor tail of related topics in all the forums...
    Cheers!
    import javax.swing.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    public class RasterToolbar extends JFrame implements ActionListener{
         JButton open;
         public static void main(String[] args) throws Exception{
              new RasterToolbar();
         //method to make display panel with buttons
         public RasterToolbar()throws Exception{
                   super("Raster Viewer 1.0 beta");
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                   Container contentPane = getContentPane();
                   JPanel p1 = new JPanel();
                   p1.setLayout(new FlowLayout());
                   p1.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
                   open = new JButton("Open Viewer");
                   p1.add(open);
                   contentPane.add(p1,BorderLayout.WEST);
                   open.addActionListener(this);
                   pack();
                   setVisible(true);
         public void actionPerformed(ActionEvent ev){
         if(ev.getSource()== open){
              System.out.println("Open pressed");
              RasterDisplay viewer = new RasterDisplay(); // HERE IS THE PROBLEM LINE!
    }

    public void actionPerformed(ActionEvent ev){
         if(ev.getSource()== open){
              System.out.println("Open pressed");
              try {
                   RasterDisplay viewer = new RasterDisplay(); // HERE IS THE PROBLEM LINE!
              } catch(Exception e) {
                   // do what ever you want here!
                   e.printStackTrace();
    }

  • Dispatching GridSelectionEvent throw exception at runtime - A build issue with FB 4.5

    This is a strang probelm I am facing with.
    My code dispatches GridSelectionEvent after setting girds' selected item in one logic path. Following is code lines -
    myDataGrid.selectedItem = instanceTag;
    myDataGrid.dispatchEvent(new GridSelectionEvent(GridSelectionEvent.SELECTION_CHANGE));
    Flash player throws following error on above statements encounter -
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at spark.accessibility::DataGridAccImpl/eventHandler()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.core::UIComponent/dispatchEvent()
    I am saying it is a strang for me because when I use swf file generated by Flex Builder (4.5)'s export to release build, it does not throw error and code works fine as expected.
    But, when I user swf file generated by Ant script, I face the above issue.
    The Flex builder settings is as shown in following image -
    Ant  mxmlc script is as follow -
    <mxmlc      
               file="${basedir}/src/AppMonConfigWizard.mxml"
                static-rsls="false"
               keep-generated-actionscript="false"
               output="${basedir}/bin-release/AppMonConfigWizard.swf" >
         <locale>en_US</locale>
          <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
          <source-path path-element="${FLEX_HOME}/frameworks"/>
          <source-path path-element="${basedir}/src/locale/{locale}"></source-path>
          <compiler.library-path file="${basedir}/../wizard_framework/bin/wizard_framework.swc" append="true"/>
         <compiler.library-path file="${basedir}/../../utils/bin/utils.swc" append="true"/>
          <include-resource-bundles>ErrorMessages</include-resource-bundles>
          <include-resource-bundles>Strings</include-resource-bundles>
    </mxmlc>
    As mentioned earlier that following statements cause exception -
         myDataGrid.selectedItem = instanceTag;
         myDataGrid.dispatchEvent(new GridSelectionEvent(GridSelectionEvent.SELECTION_CHANGE));
    If I change it to
         myDataGrid.setSelectedIndex(<some index value>)   /*selectedItem replaced with setSelectedIndex*/
         myDataGrid.dispatchEvent(new GridSelectionEvent(GridSelectionEvent.SELECTION_CHANGE));
    it does not throw exception.  I would like to mention that myDataGrid.selectedItem = instanceTag; does sets the selected item but then in that case issue arises when dispatching event.
    I my application, similar statemetns were lot at many places (as there were no such issue with SDK 3.1 which was using earlier) so instead of making changes there, it would be better to imitate the build that Flex builder uses when exported the release build.
    Thanks in advance,
    Prithveesingh Zankat.

    Solved it: had set the only public surface contracts checkbox by mistake and the cosntructor was protected...
    Luis Abreu

  • Web part throwing exception at run time but not in debug mode

    The below code is throwing exception at run time but does not throw exception while debugging in Visual Studio. This is really causing difficulty for me to detect the cause of exception. Below I have also placed the exception image for reference.
    namespace CheckforContractorLogin.VisualWebPart1
    public partial class VisualWebPart1UserControl : UserControl
    protected void Page_Load(object sender, EventArgs e)
    if (!IsPostBack)
    string loginName = string.Empty;
    string coc_url = string.Empty;
    SPQuery spQuery = new SPQuery();
    spQuery.Query = "<Where><Eq><FieldRef Name='LoginName' /><Value Type='Text'>" + currentUser + "</Value></Eq></Where>";
    Guid _spSiteID = SPContext.Current.Site.ID;
    Guid _spWebID = SPContext.Current.Site.OpenWeb().ID;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite _spSite = new SPSite(_spSiteID))
    using (SPWeb _spWeb = _spSite.OpenWeb(_spWebID))
    //if user has already accepted the COC
    SPList getSPList = _spWeb.Lists["RedirectUrl"];
    SPListItemCollection getspItemColl = getSPList.Items;
    foreach (SPListItem item in getspItemColl)
    if (Convert.ToString(item["Title"]) == "Policy Acceptance")
    coc_url = Convert.ToString(item["Url"]);
    SPList spList = _spWeb.Lists["Policy Acceptance Status"];
    SPListItemCollection spItemColl = spList.GetItems(spQuery);
    bool result = getADUserInfo();
    if ((spItemColl.Count == 0) && (result))
    Response.Redirect(coc_url);
    protected string currentUser
    get
    string currentUser1 = HttpContext.Current.User.Identity.ToString();
    int index = currentUser1.IndexOf("\\") + 1;
    string currentLoginUser = currentUser1.Substring(index);
    return currentLoginUser;
    protected bool getADUserInfo()
    DirectoryEntry dentry = null;
    DirectorySearcher dsearcher = null;
    string ldap = string.Empty;
    string empID = string.Empty;
    string _empID = string.Empty;
    try
    Guid spSiteGUID = SPContext.Current.Site.ID;
    Guid spWebGUID = SPContext.Current.Site.OpenWeb().ID;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite elevatedSiteColl = new SPSite(spSiteGUID))
    using (SPWeb elevatedWeb = elevatedSiteColl.OpenWeb(spWebGUID))
    SPList spList = elevatedWeb.Lists["LDAP_Paths"];
    SPQuery spQuery = new SPQuery();
    spQuery.Query = "<Where><Eq><FieldRef Name='OU'/>"
    + "<Value Type='Text'>QD</Value></Eq></Where>";
    SPListItem spItem = spList.GetItemById(1);
    ldap = spItem["Path"].ToString();
    dentry = new DirectoryEntry();
    dentry.Path = ldap;
    dentry.Username = "******\\sp_admin";
    dentry.Password = "******";
    dsearcher = new DirectorySearcher(dentry);
    dsearcher.Filter = String.Format("(&(ObjectCategory=Person)(sAMAccountName=" + currentUser + "))");
    SearchResult searchResult = dsearcher.FindOne();
    dentry = searchResult.GetDirectoryEntry();
    if (searchResult != null)
    if (dentry.Properties.Contains("physicalDeliveryOfficeName"))
    empID = dentry.Properties["physicalDeliveryOfficeName"][0].ToString();
    if (empID.Contains("QA-"))
    return true;
    else
    return false;
    catch (Exception e)
    throw e;
    finally
    dentry.Close();
    dentry.Dispose();
    dsearcher.Dispose();

    Hi Zakir,
    I am not sure but it would be nice if you can do following
    Try search ULS log with correlation id and find exact error and share here. If not able to find do following
    Or in catch block write
    Response.Write(ex.ToString());
    and check what exception its giving.

  • Connection Leak Exception in farm runs

    Hi
    I am trying to use the ADFBC to get a list of values for my backend data which will be displayed in the UI later. In the view, it works fine. There have been no errors. But during the farm runs there is an intermittent issue of the Connection Leak Exception.
    Array has 121
    ######################################### START
    2010-11-06 21:37:38,194 [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG jdbc.leak checkLeakedConnections.267 -
    java.lang.Exception: Connection Leak Exception
         at oracle.sysman.util.jdbc.DefaultConnectionListener.connectionOpened(DefaultConnectionListener.java:168)
         at oracle.sysman.util.jdbc.ConnectionListenerManagerImpl.processConnectionEvent(ConnectionListenerManagerImpl.java:112)
         at oracle.sysman.util.jdbc.ConnectionCache.processConnectionEvent(ConnectionCache.java:471)
         at oracle.sysman.util.jdbc.ConnectionWrapper._fireOpenedEvent(ConnectionWrapper.java:1805)
         at oracle.sysman.util.jdbc.ConnectionWrapper.<init>(ConnectionWrapper.java:219)
         at oracle.sysman.emSDK.svc.conn.FGAConnection.<init>(FGAConnection.java:151)
         at oracle.sysman.emSDK.svc.conn.FGAConnectionCache.getFGAConnection(FGAConnectionCache.java:330)
         at oracle.sysman.emSDK.svc.conn.ConnectionService.getPrivateConnection(ConnectionService.java:1798)
         at oracle.sysman.emSDK.svc.conn.EMReposConnectionDataSource.getConnection(EMReposConnectionDataSource.java:63)
         at oracle.jbo.server.DBTransactionImpl.establishNewConnection(DBTransactionImpl.java:939)
         at oracle.jbo.server.DBTransactionImpl.initTransaction(DBTransactionImpl.java:1112)
         at oracle.jbo.server.DBTransactionImpl.initTxn(DBTransactionImpl.java:6372)
         at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:286)
         at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:309)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
         at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:562)
         at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:410)
         at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8651)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4405)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2391)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2203)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3101)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:460)
         at oracle.jbo.http.HttpSessionCookieImpl.useApplicationModule(HttpSessionCookieImpl.java:234)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:431)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:426)
         at oracle.adf.model.bc4j.DCJboDataControl.initializeApplicationModule(DCJboDataControl.java:512)
         at oracle.adf.model.bc4j.DCJboDataControl.getApplicationModule(DCJboDataControl.java:855)
         at oracle.adf.model.binding.DCDataControl.setErrorHandler(DCDataControl.java:476)
         at oracle.jbo.uicli.binding.JUApplication.setErrorHandler(JUApplication.java:261)
         at oracle.adf.model.BindingContext.put(BindingContext.java:1271)
         at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:173)
         at oracle.adf.model.BindingContext.instantiateDataControl(BindingContext.java:1005)
         at oracle.adf.model.dcframe.DataControlFrameImpl.doFindDataControl(DataControlFrameImpl.java:1219)
         at oracle.adf.model.dcframe.DataControlFrameImpl.internalFindDataControl(DataControlFrameImpl.java:1122)
         at oracle.adf.model.dcframe.DataControlFrameImpl.findDataControl(DataControlFrameImpl.java:1082)
         at oracle.adf.model.BindingContext.internalFindDataControl(BindingContext.java:1126)
         at oracle.adf.model.BindingContext.get(BindingContext.java:1083)
         at oracle.adf.model.binding.DCParameter.evaluateValue(DCParameter.java:82)
         at oracle.adf.model.binding.DCParameter.getValue(DCParameter.java:111)
         at oracle.adf.model.binding.DCBindingContainer.getChildByName(DCBindingContainer.java:2682)
         at oracle.adf.model.binding.DCBindingContainer.internalGet(DCBindingContainer.java:2730)
         at oracle.adf.model.binding.DCExecutableBinding.get(DCExecutableBinding.java:115)
         at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:305)
         at oracle.adf.model.binding.DCBindingContainer.evaluateParameterWithElCheck(DCBindingContainer.java:1456)
         at oracle.adf.model.binding.DCBindingContainer.findDataControl(DCBindingContainer.java:1564)
         at oracle.adf.model.binding.DCIteratorBinding.initDataControl(DCIteratorBinding.java:2433)
         at oracle.adf.model.binding.DCIteratorBinding.getDataControl(DCIteratorBinding.java:2378)
         at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4270)
         at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:341)
         at oracle.adf.model.binding.DCIteratorBinding.getAllRowsInRange(DCIteratorBinding.java:2306)
         at oracle.adf.model.binding.DCControlBinding.getAllRowsInRange(DCControlBinding.java:447)
         at oracle.sysman.db.provisioning.ui.pagemodel.common.tgtsel.DbProvisioningTgtSelPageModel.updateCollectionMap(DbProvisioningTgtSelPageModel.java:214)
    Any inputs on this.
    Thanks in advance
    Regards
    Rama

    A Few more updates to this issue
    public static Object resolveExpression(String expression) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp =
    elFactory.createValueExpression(elContext, expression,
    Object.class);
    return valueExp.getValue(elContext);
    CollectionModel model= (CollectionModel) resolveExpression("#{bindings.DbProvCurrentSnapshotVOInst.collectionModel}");
    if(null!=model) {
    JUCtrlHierBinding treeBinding = (JUCtrlHierBinding) model.getWrappedData();
    if(null!=treeBinding) {
    Row[] r = treeBinding.getAllRowsInRange();
    if(null!=r) {
    for(Row r1:r) {
    collectionTimeMap.put((String)r1.getAttribute(TARGET_NAME_ATTR),.....)));
    The region's pagedef has the following entry
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="11.1.1.55.49" id="targetselectionPageDef"
    Package="db.provisioning.common.tgtsel">
    <parameters/>
    <executables>
    <variableIterator id="variables"/>
    <iterator id="DbProvCurrentSnapshotVOInstIterator"
    Binds="DbProvCurrentSnapshotVOInst"
    DataControl="DbProvAMDataControl" RangeSize="25"/>
    </executables>
    <bindings>
    <tree IterBinding="DbProvCurrentSnapshotVOInstIterator"
    id="DbProvCurrentSnapshotVOInst">
    <nodeDefinition DefName="oracle.sysman.db.provisioning.model.view.DbProvCurrentSnapshotVO"
    Name="DbProvCurrentSnapshotVOInst0">
    <AttrNames>
    <Item Value="TargetName"/>
    <Item Value="StartTimestamp"/>
    </AttrNames>
    </nodeDefinition>
    </tree>
    </bindings>
    </pageDefinition>
    Application Module
    <AppModule
    xmlns="http://xmlns.oracle.com/bc4j"
    Name="DbProvAM"
    Version="11.1.1.56.77"
    ComponentClass="oracle.sysman.db.provisioning.model.applicationModule.DbProvAMImpl"
    DefClass="oracle.sysman.db.provisioning.model.applicationModule.DbProvAMDefImpl"
    ClearCacheOnRollback="true">
    <DesignTime>
    <Attr Name="_deployType" Value="0"/>
    <Attr Name="_isDefCodegen" Value="true"/>
    <Attr Name="_isCodegen" Value="true"/>
    </DesignTime>
    <ViewUsage
    Name="DbProvCurrentSnapshotVOInst"
    ViewObjectName="oracle.sysman.db.provisioning.model.view.DbProvCurrentSnapshotVO"/>
    </AppModule>
    bc4j entry
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <BC4JConfig version="11.1" xmlns="http://xmlns.oracle.com/bc4j/configuration">
    <AppModuleConfigBag ApplicationName="oracle.sysman.db.provisioning.model.applicationModule.DbProvAM">
    <AppModuleConfig DeployPlatform="LOCAL" jbo.project="oracle.sysman.db.provisioning.model.DbProvisioningModel" name="DbProvAMLocal" ApplicationName="oracle.sysman.db.provisioning.model.applicationModule.DbProvAM">
    <Database jbo.TypeMapEntries="Java" jbo.locking.mode="optimistic"/>
    <Security AppModuleJndiName="oracle.sysman.db.provisioning.model.applicationModule.DbProvAM"/>
    <Custom JDBCDataSource="java:comp/env/jdbc/EMReposDS"/>
    </AppModuleConfig>
    <AppModuleConfig DeployPlatform="LOCAL" jbo.project="oracle.sysman.db.provisioning.model.DbProvisioningModel" name="DbProvAMShared" ApplicationName="oracle.sysman.db.provisioning.model.applicationModule.DbProvAM">
    <AM-Pooling jbo.ampool.dynamicjdbccredentials="false" jbo.ampool.isuseexclusive="false" jbo.ampool.maxpoolsize="1" jbo.ampool.resetnontransactionalstate="false"/>
    <Database jbo.TypeMapEntries="Java" jbo.locking.mode="optimistic"/>
    <Security AppModuleJndiName="oracle.sysman.db.provisioning.model.applicationModule.DbProvAM"/>
    <Custom JDBCDataSource="java:comp/env/jdbc/EMReposDS"/>
    </AppModuleConfig>
    </AppModuleConfigBag>
    </BC4JConfig>
    The scenario is that I launch a page which has a region. This region needs to get a list of values from the backend. These values are coming from a VO.
    This issue happens only in the farms and I guess at times from the view, but doing a bounce of the server resolves the issue.
    Is there any setting that needs to be done ?
    Thanks
    Regards
    Rama

  • Task.cancel() throw exception

    Hi,
    I'm new to JavaFx and recently try out example on javafx.concurrent.Task:
    Example is from a book:
    The following is the model class
    private static class Model {
            public Worker<String> worker;
            public AtomicBoolean shouldThrow = new AtomicBoolean(false);
            private Model() {
                worker = new Task<String>() {
                    @Override
                    protected String call() throws Exception {                   
                        updateTitle("Example Task");
                        updateMessage("Starting...");
                        final int total = 250;
                        updateProgress(0, total);
                        for (int i = 1; i <= total; i++) {
                            try {
                                Thread.sleep(20);
                            } catch (InterruptedException e) {
                                if (isCancelled()) //I modified this part to check for isCancelled()
                                    return "Cancelled at " + System.currentTimeMillis();
                            if (shouldThrow.get()) {
                                throw new RuntimeException("Exception thrown at " + System.currentTimeMillis());
                            updateTitle("Example Task (" + i + ")");
                            updateMessage("Processed " + i + " of " + total + " items.");
                            updateProgress(i, total);
                        return "Completed at " + System.currentTimeMillis();
        }On JavaFx, it has 2 Label that are bind to Worker.value and Worker.exception as shown below:
    value.textProperty().bind(
                    model.worker.valueProperty());
                exception.textProperty().bind(new StringBinding() {
                        super.bind(model.worker.exceptionProperty());
                    @Override
                    protected String computeValue() {
                        final Throwable exception = model.worker.getException();
                        if (exception == null) return "";
                        return exception.getMessage();
                });Next: There are 3 buttons "Start", "Cancel" and "Exception". Following is the method to hook up events to all three buttons:
    private void hookupEvents() {
            view.startButton.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    new Thread((Runnable) model.worker).start();
            view.cancelButton.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    model.worker.cancel();
            view.exceptionButton.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    model.shouldThrow.getAndSet(true);
        }Now, first test is when Task is successfully executed. Value label will be filled with the return value i.e: Completed at ......................
    Second is throw exception and the result is as what in the book, the exception label is filled with the exception property. i.e. Exception thrown at ..................
    But when I test the Cancel button, it throws and exception instead of return a String value.
    The exception label is filled with:
    "Task must only be used from the FX Application Thread"
    Instead of having Value label filled with: "Cancelled at .................."
    Can anybody help me please?
    Regards,
    Henri

    i got the same problem and I'm interested in an answer too.
    My Workaround was to have a secon AtomicBoolean-Var
    public AtomicBoolean cancel = new AtomicBoolean(false);
    if (cancel.get()) {
        return "Cancelled at " + System.currentTimeMillis();
    }this code works but it cannot be the answer.

  • How close server socket without throwing exception to accepted socket

    Hi,
    In my project, we are closing the server by running a program which connects to server through socket.
    Through socket, it asks server to destroy all the process and atlast server exist it connection by
    System.exit(0);
    Because of this, accepted socket throws a socket exception which clients don't want to see in their log file.
    Is there any way to close the server in the accepted socket or to close without throwing exception.
    Thanks & Regards,
    Nasrin.N

    All you have to do is close the ServerSocket then wait for all currently executing accepted-socket threads to exit. Closing the ServerSocket won't do anything to accepted sockets, but terminating the process early via System.exit() will, and this is what you want to avoid.

  • OracleConnection.ClearAllPools() throws exception Operation not valid due t

    My app allows new logons so during the app startup I call my general "new logon" procedure that among other things does a ClearAllPools.
    OracleConnection.ClearAllPools() throws exception "Operation not valid due to current state of the object".
    I have converted from
    System.Data.OracleClient.OracleConnection
    to
    Oracle.DataAccess.Client.OracleConnection
    Did not have any problem when using the former.

    According to the documentation, ClearAllPools() throws an exception if there's no connection pool to clear. Most likely in that case the System.Data.OracleClient version is just not doing anything instead.
    You should just be able to catch InvalidOperationException() at that point and ignore it.

  • I can throw exception from a catch

    Hello,
    I have created a new Exception : myException (for example).
    and, i can't throw it under a catch bloc !!
    My code :
    public myMethod( ... ) throw myException {
         try {
              if(true) thorw new NullPointerException("test nll pt");
         } catch(NullPointerException nullPt) {
              if(true) throw new myException("toto",nullPt.getMessage());
    this code doesn't want to throw "myException" from the "catch" !
    Why ?
    myException extends the class Exception.
    Thanks.
    maxx.

    First, I assume you didn't cut and paste the code, as what you have there won't compile. Can you 1) paste the actual code and 2) be a bit more specific about what's happening?
    Aside from a couple of misspellings, I don't see why it wouldn't throw myException. Is it not compiling? Running but not throwing any exception? Throwing a different exception?

Maybe you are looking for

  • Importing from hard drive

    mac os x version 10 desktop Mac OS X (10.4.8) I transfered projects and folders from my laptop into lacie fire wire 250 GB drive and am trying to import to my desktop apple mac. After I hit import and proceed onto lacie drive and contents, the sectio

  • Add "make unique symbol" button and context menu option

    I often want to make a variation of an existing symbol that is already positioned on the page. Unless I'm missing something, the steps are to duplicate existing symbol in the symbols palette, then replace the selected symbol instance, using the "repl

  • Cannot connect to the Internet, help?

    All of a sudden my connectivity to the Internet has dropped, when I try to connect to any source (ie. WiFi, ethernet, or Bluetooth via my phone) I get the same message: Wi-Fi has the self-assigned IP address xxx.xxx.xxx.xxx and will not be able to co

  • Sharing multiple movies to existing Mobile Me Gallery

    I have used the Share menu to put lot of movies in MMe Gallery. In that process, is there any way to put a movie that I'm Sharing into an existing album on MMe?

  • Startup Error Message

    Ive had my Ibook G4 for awhile now, and never had a problem like this. This happened out of the blue. I started it up today and I get a big error message in the middle of the screen. It has a power button in the middle of it and says "You need to res