0 Replies Latest reply on Jan 8, 2006 12:33 PM by Taud Anas

    Problem when executing query

    Taud Anas Newbie

      I have this EJB Session :

      @Stateless
      @Remote(Paulva.class)
      public class PaulvaBean implements Paulva {

      ....

      /**
      * Gestionaire de persistence
      */
      @PersistenceContext(unitName="paulva")
      protected EntityManager entityManager;

      public boolean authenticate(String pseudo, String password) {
      if (log.isDebugEnabled()) {
      log.debug("START " + getClass() + ".authenticate");
      }

      boolean isValid= false;

      if (check(pseudo,MIN_PSEUDO_SIZE,MAX_PSEUDO_SIZE) && check(password,MIN_PASSWORD_SIZE,MAX_PASSWORD_SIZE)) {

      if (log.isDebugEnabled()) {
      log.debug("pseudo="+pseudo+" checked.");
      }

      // définition de la requête
      Query query=entityManager.createQuery("SELECT a FROM Ancien a WHERE a.pseudo = :pseudo AND a.password = :password");

      // Substitution des paramètres de la requête
      query.setParameter("pseudo",pseudo);
      query.setParameter("password",password);

      // Exécution de la requete
      AncienEntity ancien=(AncienEntity)query.getSingleResult();
      isValid=ancien!=null;
      }

      if (log.isDebugEnabled()) {
      log.debug("END " + getClass() + ".authenticate");
      }
      return isValid;
      }

      private boolean check(String value,int min,int max) {
      return (value!=null)&&(value.length()>=min)&&(value.length()<=max);
      }

      .....
      }


      but when I execute the query bellow
      ...
      AncienEntity ancien=(AncienEntity)query.getSingleResult();
      ...

      I have this error in log:
      2006-01-08 18:17:45,326 INFO security.JaccHelper - Initialising JACC Context for deployment: paulva-bus.jar
      2006-01-08 18:17:45,405 INFO ejb3.Ejb3AnnotationHandler - found EJB3: ejbName=com.paulva.business.PaulvaBean, class=com.paulva.business.PaulvaBean, type=STATELESS
      2006-01-08 18:17:45,748 INFO security.JaccHelper - com.paulva.business.PaulvaBean has no @SecurityDomain - skipping JACC configuration
      2006-01-08 18:17:45,826 INFO ejb3.Ejb3Deployment - Found persistence.xml file in EJB3 jar
      2006-01-08 18:17:46,530 INFO ejb3.Ejb3Deployment - Create EntityManager with JNDI name: paulva
      2006-01-08 18:17:46,530 INFO security.JaccHelper - JACC Policy Configuration for deployment has been put in service
      2006-01-08 18:17:46,530 INFO ejb3.Ejb3Deployment - EJB3 deployment time took: 1204
      2006-01-08 18:17:46,951 INFO ejb3.ProxyDeployer - no declared remote bindings for : com.paulva.business.PaulvaBean
      2006-01-08 18:17:46,951 INFO ejb3.ProxyDeployer - there is remote interfaces for com.paulva.business.PaulvaBean
      2006-01-08 18:17:46,951 INFO ejb3.ProxyDeployer - default remote binding has jndiName of com.paulva.business.Paulva
      2006-01-08 18:17:47,108 INFO ejb3.EJB3Deployer - Deployed: file:/C:/java/jboss-4.0.3SP1/server/all/deploy/paulva-bus.jar
      2006-01-08 18:18:11,280 DEBUG business.PaulvaBean - START class com.paulva.business.PaulvaBean.authenticate
      2006-01-08 18:18:11,280 DEBUG business.PaulvaBean - END class com.paulva.business.PaulvaBean.authenticate
      2006-01-08 18:18:11,358 DEBUG business.PaulvaBean - START class com.paulva.business.PaulvaBean.authenticate
      2006-01-08 18:18:11,358 DEBUG business.PaulvaBean - pseudo=PSEUDO0 checked.
      2006-01-08 18:18:11,842 ERROR socket.ServerThread - failed
      java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream.java:168)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
      at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2200)
      at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2380)
      at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2447)
      at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2519)
      at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2668)
      at java.io.ObjectInputStream.readByte(ObjectInputStream.java:864)
      at org.jboss.remoting.transport.socket.ServerSocketWrapper.checkConnection(ServerSocketWrapper.java:54)
      at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:217)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:298)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169)