LoginModule login() method being called multiple times

I have a J2EE application that is deployed in Oracle 10g 10.1.2.0.2 that implements a cutom login module. The custom class (MyClassLoginModule) implements the LoginModule interface. Everything works great if the username and password entered by an end user are correct. However, it appears that if a user enters an incorrect password after failing authentication the container executes the MyClassLoginModule.login() method again. In some cases, it calls it serveral time each failing authentication.
This wouldn't be a problem however, the username and password are also the end users workstation accounts. This behaviour is capable of locking their accounts in one failed attempt.
Any help or insight would be greatly appreciated.

We're using FORM based authentication. The problem is not with multiple requests, but appears to be an issue with the container. See the following for more info:
LoginModule login method called twice on unsuccessful logins

Similar Messages

  • Finalize() method being called multiple times for same object?

    I got a dilly of a pickle here.
    Looks like according to the Tomcat output log file that the finalize method of class User is being called MANY more times than is being constructed.
    Here is the User class:
    package com.db.multi;
    import java.io.*;
    import com.db.ui.*;
    import java.util.*;
    * @author DBriscoe
    public class User implements Serializable {
        private String userName = null;
        private int score = 0;
        private SocketImage img = null;
        private boolean gflag = false;
        private Calendar timeStamp = Calendar.getInstance();
        private static int counter = 0;
        /** Creates a new instance of User */
        public User() { counter++;     
        public User(String userName) {
            this.userName = userName;
            counter++;
        public void setGflag(boolean gflag) {
            this.gflag = gflag;
        public boolean getGflag() {
            return gflag;
        public void setScore(int score) {
            this.score = score;
        public int getScore() {
            return score;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getUserName() {
            return userName;
        public void setImage(SocketImage img) {
            this.img = img;
        public SocketImage getImage() {
            return img;
        public void setTimeStamp(Calendar c) {
            this.timeStamp = c;
        public Calendar getTimeStamp() {
            return this.timeStamp;
        public boolean equals(Object obj) {
            try {
                if (obj instanceof User) {
                    User comp = (User)obj;
                    return comp.getUserName().equals(userName);
                } else {
                    return false;
            } catch (NullPointerException npe) {
                return false;
        public void finalize() {
            if (userName != null && !userName.startsWith("OUTOFDATE"))
                System.out.println("User " + userName + " destroyed. " + counter);
        }As you can see...
    Every time a User object is created, a static counter variable is incremented and then when an object is destroyed it appends the current value of that static member to the Tomcat log file (via System.out.println being executed on server side).
    Below is the log file from an example run in my webapp.
    Dustin
    User Queue Empty, Adding User: com.db.multi.User@1a5af9f
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    Joe
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin pulled from Queue, Game created: Joe
    User Already Placed: Dustin with Joe
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    INSIDE METHOD: false
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    User Dustin destroyed. 9
    User Joe destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    INSIDE METHOD: true
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    INSIDE METHOD: true
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    It really does seem to me like finalize is being called multiple times for the same object.
    That number should incremement for every instantiated User, and finalize can only be called once for each User object.
    I thought this was impossible?
    Any help is appreciated!

    Thanks...
    I am already thinking of ideas to limit the number of threads.
    Unfortunately there are two threads of execution in the servlet handler, one handles requests and the other parses the collection of User objects to check for out of date timestamps, and then eliminates them if they are out of date.
    The collection parsing thread is currently a javax.swing.Timer thread (Bad design I know...) so I believe that I can routinely check for timestamps in another way and fix that problem.
    Just found out too that Tomcat was throwing me a ConcurrentModificationException as well, which may help explain the slew of mysterious behavior from my servlet!
    The Timer thread has to go. I got to think of a better way to routinely weed out User objects from the collection.
    Or perhaps, maybe I can attempt to make it thread safe???
    Eg. make my User collection volatile?
    Any opinions on the best approach are well appreciated.

  • On Execute operation, the bean getter is being called multiple times

    Hi,
    I have a JCR data control, i am trying to write a method that returns predicate, but this method is being called multiple times, when executing the advanced search operation.
      public List<Predicate> getPredicates() {
      ArrayList<Predicate> predicates = new ArrayList<Predicate>();
       // predicates.add(new Predicate("jcr:content/idc:metadata/idc:xScope",Operator.EQUALS,"GLOBAL"));
      DCBindingContainer bc=(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
      JUCtrlListBinding attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("StateId");
      Object stateId= attrBinding.getSelectedValue();
      if(stateId instanceof Row){
      predicates.add(new Predicate("jcr:content/idc:metadata/idc:xState"
      , Operator.EQUALS
      ,((Row)stateId).getAttribute("StateId").toString()));
      attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("DistrictId");
      Object districtId=attrBinding.getSelectedValue();
      if(districtId instanceof Row){
          predicates.add(new Predicate("jcr:content/idc:metadata/idc:xDistrict",Operator.EQUALS,((Row)districtId).getAttribute("DistrictId").toString()));
        attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("Scope");
        Object scopeId=attrBinding.getSelectedValue();
        if(scopeId instanceof Row){
            predicates.add(new Predicate("jcr:content/idc:metadata/idc:xScope",Operator.EQUALS,((Row)scopeId).getAttribute("ScopeType")));
        AttributeBinding tempAttrBinding=(AttributeBinding)bc.findCtrlBinding("CreatedDate");
        Object createdDate=tempAttrBinding.getInputValue();
        if(createdDate!=null){
            predicates.add(new Predicate("jcr:content/jcr:created",Operator.EQUALS,createdDate.toString()));
        if (predicates.size()>0){
          return predicates;
      return Collections.emptyList();
      } The problem is while it's being called multiple times different list's are being returned which is causing the method not to work . The bean is in pageFlowScope .

    That is bc ADF life cicle... Is always executing 2 times...

  • Listener method is called multiple times

    why is a listener method called multiple times when the user interacted
    with the component just once?

    Because you have a bug in your code.
    If you want further help post a Short, Self Contained, Compilable and Executable, Example Program ([url http://homepage1.nifty.com/algafield/sscce.html]SSCCE) that demonstrates the problem.
    And don't forget to use [url http://forum.java.sun.com/help.jspa?sec=formatting]code formatting when posting code.

  • CommandLink in dataTable rendered method is called multiple times

    I have a dataTable in which one of the columns contains a commandLink. The commandLink has the "rendered" option bound to a backing bean method. When the page is submitted, the backing bean method gets called 8 times for each row in the table if the value returned is "true" and 3 times per row if the value returned is "false". Since the page is designed to "navigate" back to itself, I can understand it getting called more than once, but 8 times??? What's up with that?

    Because you have a bug in your code.
    If you want further help post a Short, Self Contained, Compilable and Executable, Example Program ([url http://homepage1.nifty.com/algafield/sscce.html]SSCCE) that demonstrates the problem.
    And don't forget to use [url http://forum.java.sun.com/help.jspa?sec=formatting]code formatting when posting code.

  • Init method is called multiple times

    Hi,
    init method in my servlet is called more than 1 time.
    I think it is supposed to be called only 1 time,when the application is loaded.
    anything to do with web.xml ???
    or else what r the situations that init method is called more than 1 time
    thanks

    Hi,
    actually I figured out the problem.
    I am using logger staements for debugging.
    I am also using singlethread model for servlet.
    I came to know that it creates multiple instances of servlet...
    which inturn calls init method multiple times.
    i took out that singlethread model,now it is working perfect.
    Thanks

  • Function being called multiple times

    Hi,
    In my custom workflow, when the user approves a notification, it goes to the next function in the workflow. I have used insert command in that function to insert data into a custom table. I see that the data is inserted 2 times with different values.
    I was wondering how the insert statement is called 2 times when it was supposed to do only once?
    Any suggestions?
    Thanks in advance.

    2 Scenarios that can occur:
    1) Check if you have a post notification function which is also doing an insert into the custom table.
    2) Make sure that the procedure being called by your function activity have proper if conditions for funcmode. Pasting the extract from Workflow Developer Guide:
    Standard API for PL/SQL Procedures Called by Function Activities
    All PL/SQL stored procedures that are called by function or notification activities in an Oracle Workflow process should follow this standard API format so that the Workflow Engine can properly execute the activity.
    Important: The Workflow Engine traps errors produced by function activities by setting a savepoint before each function activity. If an activity produces an unhandled exception, the engine performs a rollback to the savepoint, and sets the activity to the ERROR status. For this reason, you should never commit within the PL/SQL procedure of a function activity. The Workflow Engine never issues a commit as it is the responsibility of the calling application to commit.
    For environments such as database triggers or distributed transactions that do not allow savepoints, the Workflow Engine automatically traps "Savepoint not allowed" errors and defers the execution of the activity to the background engine.
    Oracle Workflow components that continue workflow processing asynchronously, such as background engines and the Notification System, do issue commits when appropriate on behalf of the calling application.
    The example in this section is numbered with the notation (1) for easy referencing. The numbers themselves are not part of the procedure.
    (1) procedure <procedure name>
    (itemtype in varchar2,
    itemkey in varchar2,
    actid in number,
    funcmode in varchar2,
    resultout out varchar2) is
    (2) <local declarations>
    (3) begin
    if ( funcmode = 'RUN' ) then
    <your RUN executable statements>
    resultout := 'COMPLETE:<result>';
    return;
    end if;
    (4) if ( funcmode = 'CANCEL' ) then
    <your CANCEL executable statements>
    resultout := 'COMPLETE';
    return;
    end if;
    (5) if ( funcmode = 'SKIP' ) then
    <your SKIP executable statements>
    resultout := 'COMPLETE:<result>';
    return;
    end if;
    (6) if ( funcmode = 'RETRY' ) then
    <your RETRY executable statements>
    resultout := 'COMPLETE:<result>';
    return;
    end if;
    (7) if ( funcmode = 'VALIDATE' ) then
    <your VALIDATE executable statements>
    resultout := 'COMPLETE';
    return;
    end if;
    (8) if ( funcmode = 'RESPOND' ) then
    <your RESPOND executable statements>
    resultout := 'COMPLETE';
    return;
    end if;
    (9) if ( funcmode = 'FORWARD' ) then
    <your FORWARD executable statements>
    resultout := 'COMPLETE';
    return;
    end if;
    (10) if ( funcmode = 'TRANSFER' ) then
    <your TRANSFER executable statements>
    resultout := 'COMPLETE';
    return;
    end if;
    (11) if ( funcmode = 'QUESTION' ) then
    <your QUESTION executable statements>
    resultout := 'COMPLETE';
    return;
    end if;
    (12) if ( funcmode = 'ANSWER' ) then
    <your ANSWER executable statements>
    resultout := 'COMPLETE';
    return;
    end if;
    (13) if ( funcmode = 'TIMEOUT' ) then
    <your TIMEOUT executable statements>
    if (<condition_ok_to_proceed>) then
    resultout := 'COMPLETE';
    else
    resultout := wf_engine.eng_timedout;
    end if;
    return;
    end if;
    (14) if ( funcmode = '<other funcmode>' ) then
    resultout := ' ';
    return;
    end if;
    (15) exception
    when others then
    WF_CORE.CONTEXT ('<package name>', '<procedure name>',
    <itemtype>, <itemkey>,
    to_char(<actid>), <funcmode>);
    raise;
    (16) end <procedure name>;

  • Action method getting called multiple times.

    Hi All,
    The problem that I am facing is pretty weird.
    The issue is the i have an input field that takes date as input field.
    This field is inside a data taable
    FYI: I tried converter still same problem.
    So when ever I enter wrong data as "asda" inside this date field I get a validation error. which is good. So assume it took me 3 submit clicks to fix all my errors on the page.
    So now when I click the submit for the 4th time.
    The action method gets trigerred 4 times.
    Desperately waiting for a fix.
    Thank you in advance.
                                            <h:dataTable id="disbursementTable"
                                                 value="#{certTemplateBean.disbursements}" var="disbursement"
                                                 binding="#{certTemplateBean.disbursementTable}"
                                                 columnClasses="disburseDate,disburseAmt,disburseAction"
                                                 styleClass="disbursementTable" cellspacing="0" cellpadding="1">
                                                 <h:column >
                                                      <h:inputText id="disburseDate" styleClass="#{certTemplatesListBean.errorHolder.disburseDate} ms" size="10"
                                                                value="#{disbursement.date}">
                                                           <f:validator validatorId="RegExp" />
                                                           <f:attribute name="regexp" value="[0-9]{2}/[0-9]{2}/[0-9]{4}" />                                             
                                                           <f:attribute name="fieldRef" value="Disbursement Date :" />
                                                           <f:attribute name="message" value="Invalid Date" />
                                                           <f:attribute name="bean" value="certTemplatesListBean" />
                                                      </h:inputText>
                                                 </h:column>
                                            </h:dataTable>
                                            <h:commandLink id="addPro"
                                                 action="#{certTemplatesListBean.doAddUpdateCertTemplate}">
                                                 <h:outputText value="Add Profile direct"/>
                                            </h:commandLink>

    Probably got to do with the JSF jar files. I am not sure though. Can you check if the below link is useful?
    http://jira.jboss.com/jira/browse/AJSF-127

  • Webservice being called multiple times throws strange error

    This is something that just started occurring and doesn't make much sense to me.
    Using JDK 1.7 and doing the following:
    FlashlineRegistryTr registry = new FlashlineRegistryTrServiceLocator().getFlashlineRegistryTr(lUrl);
    ((Stub)registry).setMaintainSession(true);
    I can call registry.authTokenCreate(USERNAME, CREDENTIAL);  ONCE and it works fine.  When I immediately call it again, same command, it fails with the exception below.
    The issue has to do with setting the Maintain Session to true.  If I remove that line it works fine, however I need that in there.
    Any thoughts on where to even begin to look? 
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
    faultSubcode:
    faultString: Tried to invoke method public com.flashline.cmee.openapi.databeans.AuthTokenBean com.flashline.cmee.openapi.service.FlashlineRegistry.authTokenCreate(java.lang.String,java.lang.String) throws com.flashline.framework.exception.OpenAPIException with arguments java.lang.String,java.lang.String.  The arguments do not match the signature.; nested exception is:
      java.lang.IllegalArgumentException: object is not an instance of declaring class
    faultActor:
    faultNode:
    faultDetail:
      {http://xml.apache.org/axis/}hostname:slc03rii.us.oracle.com
    Tried to invoke method public com.flashline.cmee.openapi.databeans.AuthTokenBean com.flashline.cmee.openapi.service.FlashlineRegistry.authTokenCreate(java.lang.String,java.lang.String) throws com.flashline.framework.exception.OpenAPIException with arguments java.lang.String,java.lang.String.  The arguments do not match the signature.; nested exception is:
      java.lang.IllegalArgumentException: object is not an instance of declaring class
      at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
      at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
      at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
      at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
      at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
      at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
      at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
      at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
      at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
      at org.apache.axis.client.Call.invoke(Call.java:2748)
      at org.apache.axis.client.Call.invoke(Call.java:2424)
      at org.apache.axis.client.Call.invoke(Call.java:2347)
      at org.apache.axis.client.Call.invoke(Call.java:1804)
      at com.flashline.registry.openapi.service.v300.FlashlineRegistryTrSoapBindingStub.authTokenCreate(FlashlineRegistryTrSoapBindingStub.java:7676)
      at com.flashline.registry.openapi.MikeTest.setUp(MikeTest.java:131)
      at junit.framework.TestCase.runBare(TestCase.java:125)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    One possible solution is store the LOV values in some scope while retrieving it first time from the web service.
    Next time whenever LOV is called then return the LOV values from the scope instead of calling the web service.
    psedo code:
            if (ADFContext.getCurrent() != null &&
                ADFContext.getCurrent().getSessionScope().containsKey("LOV_LIST")) {
                LOVList =
                        (List<SelectItem>)ADFContext.getCurrent().getSessionScope().get("LOV_LIST");
            } else {
                LOVList = this.populateVendorListFromWS();
                ADFContext.getCurrent().getSessionScope().put("LOV_LIST",
                                                              LOVList );
            }Hope it helps.

  • Unwanted behavior: Action method being called several times

    Hello,
    I have a managed bean that calls a session ejb which itself does a search. The problem is that it is supposed to retrieve a resultset ONCE and the displayed behavior is that it never stop doing so. It fetches the resultset N TIMES.
    Here is the managed bean and the method to look at is the performSearch method:
    package arcoiris;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.model.SelectItem;
    public class SearchManagedBean {
        //Collected from search form
        private String keyword;
        private String country;
        private Integer[] postcode;
        private boolean commentExists;
        private Integer rating;
        private boolean websiteExists;
        //Used to populate form
        private List<SelectItem> availableCountries;
        private List<SelectItem> availablePostcodes;
        private List<SelectItem> availableRatings;
        //Retrieved from ejb tier
        private List<EstablishmentLocal> retrievedEstablishments;
        //Service locator
        private arcoiris.ServiceLocator serviceLocator;
        //Constructor
        public SearchManagedBean() {
            System.out.println("within constructor SearchManagedBean");
        //Getters and setters
        public String getKeyword() {
            return keyword;
        public void setKeyword(String keyword) {
            this.keyword = keyword;
        public String getCountry() {
            return country;
        public void setCountry(String country) {
            this.country = country;
        public boolean isCommentExists() {
            return commentExists;
        public void setCommentExists(boolean commentExists) {
            this.commentExists = commentExists;
        public Integer getRating() {
            return rating;
        public void setRating(Integer rating) {
            this.rating = rating;
        public boolean isWebsiteExists() {
            return websiteExists;
        public void setWebsiteExists(boolean websiteExists) {
            this.websiteExists = websiteExists;
        public List<SelectItem> getAvailableCountries() {
            List<SelectItem> countries = new ArrayList<SelectItem>();
            SelectItem si_1 = new SelectItem();
            SelectItem si_2 = new SelectItem();
            SelectItem si_3 = new SelectItem();
            si_1.setValue("2");
            si_1.setLabel("ecuador");
            si_2.setValue("1");
            si_2.setLabel("colombia");
            si_3.setValue("3");
            si_3.setLabel("peru");
            countries.add(si_1);
            countries.add(si_2);
            countries.add(si_3);
            return countries;
        public void setAvailableCountries(List<SelectItem> countries) {
            this.availableCountries = availableCountries;
        public List<SelectItem> getAvailablePostcodes() {
            List<SelectItem> postcodes = new ArrayList<SelectItem>();
            SelectItem si_1 = new SelectItem();
            SelectItem si_2 = new SelectItem();
            SelectItem si_3 = new SelectItem();
            si_1.setValue(new Integer(75001));
            si_1.setLabel("75001");
            si_2.setValue(new Integer(75002));
            si_2.setLabel("75002");
            si_3.setValue(new Integer(75003));
            si_3.setLabel("75003");
            postcodes.add(si_1);
            postcodes.add(si_2);
            postcodes.add(si_3);
            return postcodes;
        public void setAvailablePostcodes(List<SelectItem> availablePostcodes) {
            this.availablePostcodes = availablePostcodes;
        public List<SelectItem> getAvailableRatings() {
            List<SelectItem> ratings = new ArrayList<SelectItem>();
            SelectItem si_1 = new SelectItem();
            SelectItem si_2 = new SelectItem();
            SelectItem si_3 = new SelectItem();
            si_1.setValue(new Integer(1));
            si_1.setLabel("1");
            si_2.setValue(new Integer(2));
            si_2.setLabel("2");
            si_3.setValue(new Integer(3));
            si_3.setLabel("3");
            ratings.add(si_1);
            ratings.add(si_2);
            ratings.add(si_3);
            return ratings;
        public void setAvailableRatings(List<SelectItem> availableRatings) {
            this.availableRatings = availableRatings;
        public Integer[] getPostcode() {
            return postcode;
        public void setPostcode(Integer[] postcode) {
            this.postcode = postcode;
        public List<EstablishmentLocal> getRetrievedEstablishments() {
            return retrievedEstablishments;
        public void setRetrievedEstablishments(List<EstablishmentLocal> retrievedEstablishments) {
            this.retrievedEstablishments = retrievedEstablishments;
        //Business methods
        public String performSearch(){
            System.out.println("performSearchManagedBean begin");
            SearchRequestDTO searchRequestDto = new SearchRequestDTO(this.keyword,this.country,this.postcode,this.commentExists,this.rating, this.websiteExists);
            System.out.println("java bean "+this.keyword+" "+this.country+" "+this.postcode+" "+this.commentExists+" "+this.rating+" "+this.websiteExists);
            SearchSessionLocal searchSession = lookupSearchSessionBean();
            List<EstablishmentLocal> retrievedEstablishments = searchSession.performSearch(searchRequestDto);
            this.setRetrievedEstablishments(retrievedEstablishments);
            System.out.println("performSearchManagedBean end");
            return "success";
        private arcoiris.ServiceLocator getServiceLocator() {
            if (serviceLocator == null) {
                serviceLocator = new arcoiris.ServiceLocator();
            return serviceLocator;
        private arcoiris.SearchSessionLocal lookupSearchSessionBean() {
            try {
                return ((arcoiris.SearchSessionLocalHome) getServiceLocator().getLocalHome("java:comp/env/ejb/SearchSessionBean")).create();
            } catch(javax.naming.NamingException ne) {
                java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
                throw new RuntimeException(ne);
            } catch(javax.ejb.CreateException ce) {
                java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ce);
                throw new RuntimeException(ce);
    }Here is the object request passed:
    package arcoiris;
    import java.io.Serializable;
    public class SearchRequestDTO implements Serializable {
        private String keyword;
        private String country;
        private Integer[] postcode;
        private boolean commentExists;
        private Integer rating;
        private boolean websiteExists;
        public SearchRequestDTO() {
        public SearchRequestDTO(String keyword, String country, Integer[] postcode, boolean commmentExists, Integer rating, boolean websiteExists){
            this.keyword=keyword;
            this.country= country;
            this.postcode = postcode;
            this.commentExists = commentExists;
            this.rating = rating;
            this.websiteExists = websiteExists;
        public String getKeyword() {
            return keyword;
        public void setKeyword(String keyword) {
            this.keyword = keyword;
        public String getCountry() {
            return country;
        public void setCountry(String country) {
            this.country = country;
        public Integer[] getPostcode() {
            return postcode;
        public void setPostcode(Integer[] postcode) {
            this.postcode = postcode;
        public boolean isCommentExists() {
            return commentExists;
        public void setCommentExists(boolean commmentExists) {
            this.commentExists = commmentExists;
        public Integer getRating() {
            return rating;
        public void setRating(Integer rating) {
            this.rating = rating;
        public boolean isWebsiteExists() {
            return websiteExists;
        public void setWebsiteExists(boolean websiteExists) {
            this.websiteExists = websiteExists;
    }and here is the session ejb:
    package arcoiris;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    public class SearchSessionBean implements SessionBean, SearchSessionLocalBusiness {
        private SessionContext context;
        private arcoiris.ServiceLocator serviceLocator;
        // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">
        // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
        // TODO Add business methods or web service operations
         * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
        public void setSessionContext(SessionContext aContext) {
            context = aContext;
         * @see javax.ejb.SessionBean#ejbActivate()
        public void ejbActivate() {
         * @see javax.ejb.SessionBean#ejbPassivate()
        public void ejbPassivate() {
         * @see javax.ejb.SessionBean#ejbRemove()
        public void ejbRemove() {
        // </editor-fold>
         * See section 7.10.3 of the EJB 2.0 specification
         * See section 7.11.3 of the EJB 2.1 specification
        public void ejbCreate() {
            // TODO implement ejbCreate if necessary, acquire resources
            // This method has access to the JNDI context so resource aquisition
            // spanning all methods can be performed here such as home interfaces
            // and data sources.
        // Add business logic below. (Right-click in editor and choose
        // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
        public List<EstablishmentLocal> performSearch(SearchRequestDTO searchRequestDto) {
            System.out.println("within performSearch");
            List<EstablishmentLocal> establishments = new ArrayList<EstablishmentLocal>();
            try {
                Context ctx = new InitialContext();
                DataSource ds = (DataSource)ctx.lookup("java:/guia");
                Connection con = ds.getConnection();
                Statement stm = con.createStatement();
                String query = buildQueryFromSearchRequestDTO(searchRequestDto);
                ResultSet rs = stm.executeQuery(query);
                int rowCount = 0;
                while(rs.next()){
                    rowCount = rowCount + 1;
                    System.out.println("while");
                    try {
                        EstablishmentLocal establishment = lookupEstablishmentBean().findByEstablishmentId(rs.getInt("establishment_id"));
                        establishments.add(establishment);
                        System.out.println("est name "+establishment.getEstablishmentName());
                    } catch (FinderException ex) {
                        ex.printStackTrace();
                    } catch (SQLException ex) {
                        ex.printStackTrace();
                System.out.println("rowCount = "+rowCount);
                rs.close();
                stm.close();
                con.close();
            catch (SearchRequestMalformedException ex){
                ex.printStackTrace();
            }catch (NamingException ex) {
                ex.printStackTrace();
            }catch (SQLException ex){
                ex.printStackTrace();
            //TODO implement performSearch
            return null;
        private String buildQueryFromSearchRequestDTO(SearchRequestDTO searchRequestDto) throws SearchRequestMalformedException {
            StringBuffer sb = new StringBuffer();
            //Head of the query
            sb.append("SELECT ");
            sb.append("e.establishment_id, ");
            sb.append("e.establishment_name, ");
            sb.append("avg(r.rating) as avg_rating ");
            sb.append("FROM ");
            sb.append("establishment e, ");
            sb.append("rating r, ");
            sb.append("comment com, ");
            sb.append("establishment_country ec, ");
            sb.append("country_ref cou ");
            sb.append("where ");
            sb.append("e.establishment_id=ec.establishment_id and ");
            sb.append("ec.country_id=cou.country_id and ");
            sb.append("e.establishment_id=com.establishment_id and ");
            sb.append("r.establishment_id=e.establishment_id and ");
            //Conditional parts of the query
            //If user wants comment to be present
            if(searchRequestDto.isCommentExists()){
                sb.append("e.establishment_id=com.establishment_id and ");
            //If user has typed in a keyword
            if(!searchRequestDto.getKeyword().equals("") && !searchRequestDto.getKeyword().equals(" ")&& searchRequestDto.getKeyword()!=null){
                sb.append("e.establishment_name like '%"+ searchRequestDto.getKeyword() +"%' and ");
            //If user has choosen a country
            if(searchRequestDto.getCountry()!=null && !searchRequestDto.getCountry().equals("") && !searchRequestDto.getCountry().equals(" ")&& searchRequestDto.getCountry()!=null){
                sb.append("ec.country_id = " + searchRequestDto.getCountry() + " and ");
            //If user wants website to be present
            if(searchRequestDto.isWebsiteExists()){
                sb.append("e.establishment_website is not null and ");
    /* conditions
    si utilisateur a renseign� un premier code postal "e.establishment_postcode = 'postcode_one' --si racine
            si autre code postal "or e.establishment_postcode = 'postcode_two'
            ainsi de suite
    and--vient de si racine
            //Tail of the query
            sb.append("0=0 ");
            sb.append("group by e.establishment_id ");
            //If the user wants a minimum rating
            if(searchRequestDto.getRating() != null && searchRequestDto.getRating().intValue()!=0){
                sb.append("having avg(r.rating) >= " + searchRequestDto.getRating());
            sb.append(" ");
            sb.append("order by e.establishment_id ");
            System.out.println("****************************");
            System.out.println(sb);
            System.out.println("****************************");
            return sb.toString();
        private arcoiris.ServiceLocator getServiceLocator() {
            if (serviceLocator == null) {
                serviceLocator = new arcoiris.ServiceLocator();
            return serviceLocator;
        private EstablishmentLocalHome lookupEstablishmentBean() {
            try {
                return (arcoiris.EstablishmentLocalHome) getServiceLocator().getLocalHome("java:comp/env/ejb/EstablishmentBean");
            } catch(javax.naming.NamingException ne) {
                java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
                throw new RuntimeException(ne);
    }I just don't understand why it does so. The peformSearch should be executed ONCE only.
    Here is my face config file:
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
        <managed-bean>
            <managed-bean-name>SearchManagedBean</managed-bean-name>
            <managed-bean-class>arcoiris.SearchManagedBean</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <navigation-rule>
           <description></description>
            <from-view-id>/welcomeJSF.jsp</from-view-id>
            <navigation-case>
            <from-outcome>success</from-outcome>
            <to-view-id>index.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>
    </faces-config>Can anyone help?
    Thanks in advance,
    Julien.

    Just reactivating my thread hoping someone will reply to it....
    Julien.

  • C# Constructo​r being called multiple times when I run my VI

    Hi all,
    We are runing LabVIEW 8.51 in the lab and have been using a bodged together C++ DLL which was crude but got the job done. Now looking at rewriting it in C# to make it easier to maintain and support long term.
    Ive got the C# DLL appearing in Labview and can happily call my test functions from the VI to prove both the DLL inputs and outputs are working fine (the simple input a number, add 1 and return result type of code).
    However, this DLL will end up managing a Serial port connection so the contstructor must only be called once as its responsible for making my .net serial port object. Ive added a text log message in the constructor and have found that just running the VI is causing the constructor to be called at least 5 times a second. There is no user input causing this....just running the VI.
    Both VI and C# source is attached.
    Any ideas folks? Im a complete newbie at LabVIEW having taken this on from another developer.
    The VI is in \Release and this is where the Log file is generated.
    Mat
    Attachments:
    Bus Pirate LabVIEW.zip ‏78 KB

    Ummmm.. yes, loop. That big thing gray rectangle that surrounds your code. Have you done any LabVIEW tutorials? That isn't even a LabVIEW question, but a basic programming question.
    To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. There are also several Technical Resources. You can also take the online courses for free.

  • H:commandLink and an Action being called multiple times.

    Hi everyone. I'm more or less relatively new in terms of JSF, though I've had to do a lot of "catching up" recently.
    I've been reading that with managed-beans, the getters/setters are not gaurenteed to be called once. http://www.jsf-faq.com/faqs/faces-misc.html#106
    My question is, are there any reasons why an action method would get called twice? An example of my jsp page.
    <h:commandLink action="#{exploreCaseAction.exploreCase}" >                    
         <h:outputText value="#{case.caseNumber}"/>
         <f:param name="caseId" value="#{case.caseId}"/>
    </h:commandLink>My faces-config
    <managed-bean>
       <managed-bean-name>exploreCaseAction</managed-bean-name>
       <managed-bean-class>com.unyric.cias.cm.web.action.ExploreCaseAction</managed-bean-class>
       managed-bean-scope>request</managed-bean-scope>
       <managed-property>
          <property-name>caseTreeHelper</property-name>
             <value>#{caseTreeHelper}</value>
       </managed-property>
       <managed-property>
          <property-name>caseId</property-name>
             <value>#{param.caseId}</value>
       </managed-property>     
       <managed-property>
          <property-name>sessionManager</property-name>
             <value>#{sessionManager}</value>
       </managed-property>               
    </managed-bean>When I click on one of the links and set a breakpoint, it comes up twice. Here's the crazy part. if I use <af:commandLink> then it only runs once.
    Personally I'd rather not use oracles components (I know it got donated and is/will be Trinidad).
    Anyone with any ideas?

    Would you be willing to try the RI (1.1_02) [1] to see if you have the same problem?
    [1] https://javaserverfaces.dev.java.net/servlets/ProjectDocumentList?folderID=5225&expandFolder=5225&folderID=0

  • Custom tag library called multiple times

    Hi ppl ,
    I have a custom tag library which i use to populate some menu components. When i do call my custom tag library though , it is called multiple times, use case is as follows.
    I have menu tabs and menu bars which thanks to Mr.Brenden is working splendidly as so:-
    <af:menuTabs>
    <af:forEach var="menuTab" items="#{bindings.menu.vwUserMenuTabRenderer.rangeSet}">
    <af:commandMenuItem text="#{menuTab.MenuLabel}"
    shortDesc="#{menuTab.MenuHint}"
    rendered="true"
    immediate="true"
    selected="#{sessionScope.selectedMenuId == menuTab.MenuId }"
    onclick="fnSetSelectedValue('#{menuTab.MenuId}')" >
    </af:commandMenuItem>
    </af:forEach>
    </af:menuTabs>
    <af:menuBar>
    <af:forEach var="menuBar" items="#{bindings.menu.vwUserMenuBarRenderer.rangeSet}">
    <af:commandMenuItem onclick="return clickreturnvalue()"
    onmouseover="dropdownmenu(this, event,#{menuBar.MenuId}, '150px')"
    onmouseout="delayhidemenu()"
    text="#{menuBar.MenuLabel}"
    action="#{menuBar.MenuUri}"
    rendered="#{menuBar.ParentId == sessionScope.selectedMenuId}"
    immediate="true" />
    </af:forEach>
    </af:menuBar>
    </afc:cache>
    now all of this code is within a subview , and just directly below the subview tag , i have the call to my custom tag library:-
    <myCustomTagLib:menuCascade />
    only issue now is that assuming i have in all 7 menu bar components, the doStartTag is called 7 times. the relevant code within my custom tag class is as follows :-
    public int doStartTag() throws JspException {
    return (EVAL_BODY_INCLUDE);
    public int doEndTag() throws JspException {
    try {
    declareVariables();
    return EVAL_PAGE;
    }catch (Exception ioe) {
    throw new JspException(ioe.getMessage());
    and within my declareVariables method i do an out of the jscript ( out.print(jscript.toString()); ) which is a simple string generated based on certain conditions...
    now it seems to be working fine on the front end , but when i view the source of the page, i notice that the declaration is called multiple times, and this happens because the doStartTag method is called multiple times, i haven't even nested the call to the custom tag within the menu components , any clue as to whats going wrong ?
    Cheers
    K

    Hi,
    if you add the following print statement
    System.out.println("rendering "+FacesContext.getCurrentInstance().getViewRoot().getViewId());
    Then the output in my case is
    07/04/24 08:14:04 rendering /BrowsePage.jsp
    07/04/24 08:14:05 rendering /otn_logo_small.gif
    The image comes from the file system, which means it is rendered by the JSF lifecycle. If you reference the image with a URL then the lifecycle doesn't render the image but only refrences it.
    To avoid your prepare render code to be executed multiple times, just check for jsp and jspx file extensions, which will guarantee that your code only executes for JSF pages, not for loaded files.
    The reason why this happens is because the JSF filter is set to /faces , which means all files that are loaded through that path
    Frank

  • CommandLink Disabled called multiple times

    Hello,
    I'm developing a brief method to enable/disable af:commandLink on certain condition.
    The layout is simple: a table to the left and a panelTabbed to the right. PanelTabbed has a partialTrigger to the table.
    In a visible tab there is a commandLink with Disabled attribute bound to a backingBean method.
    In this method I placed a System.out.println and I can see that this method is called multiple times.
    On pagestart the method is called 2 times.
    On table current row change the method is called 3 times.
    On tab change out of first tab 1 time.
    On tab change to first tab 2 times.
    I wen through all the way from commandLink to top component and there are no additional partialTriggers.
    Could someone explain this to me, please?
    Thanks.
    ADF 11.1.1.4

    Ilya,
    Have you tried using the ADF logger (see [url http://blogs.oracle.com/groundside/entry/adventures_in_logging_index]this blog for lots of details, especially part 5)? Replace your System.out.println calls with calls to the logger, crank up the logging level and use the log analyser to see by ADF/JSF phase when things are called.
    John

  • How to find the number of times method being called.....

    hi,
    can any one pls tell me how to find the number of times the method being called......herez the example....
    Refrence ref = new Refrence();
    for(int i = 0;i < arr.length; i++){
    if(somecondition){
    ref.getMethod();
    here i want to know how many times the getMethod() is calling...Is there any method to do this.. i have seen StrackTraceElement class..but not sure about that....pls tell me the solution....

    can any one pls tell me how to find the number of times the method being called......
    herez the example.... http://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal ? in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

Maybe you are looking for

  • Test in the morning...having issues

    I cannot figure out what I am doing wrong here, I am trying to go through all my example programs and redo exercises but have hit a snag with this one, any ideas? public class Employee private String social; private String name; private int vacation;

  • My iPod 5thG it's stuck

    Hi, I have a problem, as in the title. My iPod nano 5thG doesn't turn on. It has less then 2 years. When it is not in charge, it seems die, but when I connect it to the usb of my mac, or the socket, the apple appear, for few seconds and than..black s

  • Fonts once working in PC Version do not appear in Lion OS CS5 Version?

    Hello Extremely Knowledgable Flash Users: I have had no trouble at all having my favorite fonts used for my website {created previously on a PC} show up in all other Adobe applications except for Flash CS5. The True Type fonts I freely downloaded are

  • Partial Triggers and column highlighting

    I've read a few posts about how to conditionally highlight rows in the table. Right now I am using this expression to find out if a row in my tree table has not been saved (on the inline style of the column elements). #{node.row.entities[0].entitySta

  • Can't tell what generation ipod shuffle I have

    I've looked at the online community for I-pod shuffle's link and still can't tell what generation I have.  My last 3 serial numbers aren't numbers they are letters. Any help? Thanks