Did you play with digest attribute? Le 30 août 2012 23:46, "Luca Merolla" <luca.mero...@gmail.com> a écrit :
> I think here the problem is the encoding of the password defined in the > datasource. > > Basically since I'm migrating from JBoss, where I have a configuration like > that: > > <login-module code="Database" flag="required"> > <module-option name="dsJndiName" > value="java:jboss/datasources/testDS"/> > <module-option name="principalsQuery" > value="SELECT vpassword FROM VUser WHERE vname=?"/> > <module-option name="rolesQuery" value="SELECT > vrole, 'Roles' FROM VRole WHERE vname=?"/> > <module-option name="hashAlgorithm" > value="MD5"/> > <module-option name="hashEncoding" > value="HEX"/> > </login-module> > > While on TomEE I have this > > <Realm className="org.apache.catalina.realm.DataSourceRealm" > localDataSource="true" > dataSourceName="MyDS" > userTable="VUser" userNameCol="vname" userCredCol="vpassword" > userRoleTable="VRole" roleNameCol="vrole" > digest="MD5"/> > > I don't think there is an hashEncoding option for DataSourceRealm. Should I > use a different Realm to have the same encoding like for JBoss? > > > > On Thu, Aug 30, 2012 at 11:20 PM, Romain Manni-Bucau > <rmannibu...@gmail.com>wrote: > > > Hmm, > > > > Did you check values (login/pwd), database (do you use the one you > expect). > > > > Here we need to know why it fail (user not found, bad credential etc) > > > > Any more info? > > Le 30 août 2012 23:09, "Luca Merolla" <luca.mero...@gmail.com> a écrit : > > > > > Yes, the persistence.xml was in a jar library that by mistaken got > > deployed > > > in two different places. Now this is working. > > > > > > However I have a problem with an existing web application where I'm not > > > able to authenticate. I have the login form which is failing while > trying > > > to authenticating the user. > > > It's trying to perform a HttpServletRequest "request.login(user, pwd)" > > and > > > I get > > > > > > SEVERE: Error logging in > > > javax.servlet.ServletException: Login failed > > > at > > > > > > > > > org.apache.catalina.authenticator.AuthenticatorBase.doLogin(AuthenticatorBase.java:820) > > > at > > > > > > > > > org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:800) > > > at > org.apache.catalina.connector.Request.login(Request.java:2613) > > > at > > > > > > org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1065) > > > at > > > org.pn.infiniti.login.LoginViewModel.doLogin(LoginViewModel.java:47) > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > at > > > > > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > > at > > > > > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > > at java.lang.reflect.Method.invoke(Method.java:597) > > > at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:108) > > > at > org.zkoss.bind.impl.BinderImpl.doExecute(BinderImpl.java:1576) > > > at > org.zkoss.bind.impl.BinderImpl.doCommand(BinderImpl.java:1329) > > > at > org.zkoss.bind.impl.BinderImpl.access$1500(BinderImpl.java:94) > > > at > > > > > > > > > org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1213) > > > at > > > > > > > > > org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1171) > > > at > > > org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2736) > > > at > > > org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2707) > > > at > > > org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2648) > > > at > > > org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) > > > at > > > org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1702) > > > at > > > org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1487) > > > at > > > org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1204) > > > at > > > > > > > > > org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:558) > > > at > > > > > > org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:456) > > > at > > > > > > org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:464) > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) > > > at > > > > > > > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) > > > at > > > > > > > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) > > > at > > > > > > > > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) > > > at > > > > > > > > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) > > > at > > > org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45) > > > at > > > > > > > > > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581) > > > at > > > > > > > > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) > > > at > > > > > > > > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) > > > at > > > > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) > > > at > > > > > > > > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) > > > at > > > > > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) > > > at > > > > > > > > > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001) > > > at > > > > > > > > > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) > > > at > > > > > > > > > org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) > > > at > > > > > > > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > > > at > > > > > > > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > > > at java.lang.Thread.run(Thread.java:662) > > > > > > > > > > > > On Thu, Aug 30, 2012 at 6:00 PM, Romain Manni-Bucau > > > <rmannibu...@gmail.com>wrote: > > > > > > > Where is the persistence.xml? Sure it is not in the war too? > > > > > > > > - Romain > > > > Le 30 août 2012 13:47, "Luca Merolla" <luca.mero...@gmail.com> a > > écrit : > > > > > > > > > Hi, > > > > > > > > > > I'm using TomEE 1.1.0-SNAPSHOT version from the 29/08/2012. > > > > > I have an EAR folder which I have deployed in the apps/ folder. The > > EAR > > > > > consists of 2 jar libraries, 1 ejb module and 2 war application. > > > > > > > > > > For the security and authentication of the users I want to use a DB > > so > > > I > > > > > have configured TomEE in this way. > > > > > > > > > > in tomee.xml I have my 2 datasources > > > > > <Resource id="MyDS" type="DataSource"> > > > > > JdbcDriver org.postgresql.Driver > > > > > JdbcUrl jdbc:postgresql://127.0.0.1:5432/test > > > > > UserName test > > > > > # For Production password should be a ciphered value Static3DES > > > codec. > > > > > Check OpenEJB cipher > > > > > Password test1 > > > > > JtaManaged true > > > > > </Resource> > > > > > > > > > > <Resource id="MyUnmanagedDS" type="DataSource"> > > > > > JdbcDriver org.postgresql.Driver > > > > > JdbcUrl jdbc:postgresql://127.0.0.1:5432/test > > > > > UserName test > > > > > # For Production password should be a ciphered value Static3DES > > > codec. > > > > > Check OpenEJB cipher > > > > > Password test1 > > > > > JtaManaged false > > > > > </Resource> > > > > > > > > > > in server.xml I have > > > > > <Realm className="org.apache.catalina.realm.DataSourceRealm" > > > > > localDataSource="true" > > > > > dataSourceName="MyDS" > > > > > userTable="VUser" userNameCol="vname" userCredCol="vpassword" > > > > > userRoleTable="VRole" roleNameCol="vrole" > > > > > digest="MD5"/> > > > > > > > > > > > > > > > I get this error for all the EAO classes which uses the > > EntityManager, > > > as > > > > > an example: > > > > > > > > > > SEVERE: FAIL ... PayoutStructureEAO: The reference > > > > > @PersistenceContext(name="em", unitName="gamgamEJB") cannot be > > resolved > > > > as > > > > > there are 2 units with the same name. Update your unitName to one > of > > > the > > > > > following:gamgamEJB 500754579 > > > > > gamgamEJB 811645777 > > > > > > > > > > All the EAO beans extends AbstractEAO which contains the following > > > > > > > > > > public abstract class AbstractEAO { > > > > > > > > > > @PersistenceContext(unitName = "gamgamEJB") > > > > > protected EntityManager em; > > > > > > > > > > } > > > > > > > > > > persistence.xml > > > > > > > > > > <?xml version="1.0" encoding="UTF-8"?> > > > > > <persistence version="2.0" xmlns=" > > > http://java.sun.com/xml/ns/persistence > > > > " > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > > > xsi:schemaLocation=" > > > > > http://java.sun.com/xml/ns/persistence > > > > > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> > > > > > <persistence-unit name="gamgamEJB" transaction-type="JTA"> > > > > > <!-- Enable Hibernate provider. Add dependency pom.xml --> > > > > > <provider>org.hibernate.ejb.HibernatePersistence</provider> > > > > > <jta-data-source>MyDS</jta-data-source> > > > > > <non-jta-data-source>MyUnmanagedDS</non-jta-data-source> > > > > > > > > > > <class>...</class> > > > > > <properties> > > > > > <property name="hibernate.dialect" > > > > > value="org.hibernate.dialect.PostgreSQLDialect" /> > > > > > <property name="hibernate.hbm2ddl.auto" value="update" /> > > > > > <!-- property name="hibernate.hbm2ddl.auto" value="create-drop"/ > --> > > > > > <!-- enable sql log, not for production --> > > > > > <property name="hibernate.show_sql" value="false"/> > > > > > </properties> > > > > > </persistence-unit> > > > > > </persistence> > > > > > > > > > > I'm using hibernate as persistence provider and I have followed the > > > guide > > > > > from the TomEE website. > > > > > > > > > > About a year ago I did managed to make it run on Tomcat + OpenEJB, > > so I > > > > > believe i'm actually missing something in the configuration. > > > > > > > > > > Thanks in advance for any help, > > > > > Luca > > > > > > > > > > -- > > > > > *Luca Merolla* > > > > > Management, Business & Technology Consultant > > > > > > > > > > > > > > > <http://maps.google.com/maps?q=&hl=en> *Mobile:* +393774569974 > > > > > *http://nl.linkedin.com/in/lucamerolla* > > > > > *Blog <http://lucamerolla.wordpress.com>* > > > > > > > > > > > > > > > Merolla Consulting Limited > > > > > > > > > > > > > > > > > > > > > -- > > > *Luca Merolla* > > > Management, Business & Technology Consultant > > > > > > > > > <http://maps.google.com/maps?q=&hl=en> *Mobile:* +393774569974 > > > *Email:* luca.mero...@gmail.com > > > *http://nl.linkedin.com/in/lucamerolla* > > > *Blog <http://lucamerolla.wordpress.com>* > > > > > > > > > Merolla Consulting Limited > > > > > > > > > -- > *Luca Merolla* > Management, Business & Technology Consultant > > > <http://maps.google.com/maps?q=&hl=en> *Mobile:* +393774569974 > *Email:* luca.mero...@gmail.com > *http://nl.linkedin.com/in/lucamerolla* > *Blog <http://lucamerolla.wordpress.com>* > > > Merolla Consulting Limited >