I had that error ( user lacks privilege or object not found) when I didnt configure the datasource in tomee.xml. try to do a simple query and check .if you can read the database, if not, try to configure.your datasource in tomee.xml. El 18/11/2012 17:22, "Howard W. Smith, Jr." <smithh032...@gmail.com> escribió:
> I am attempting to migrate from Glassfish 3.1.2.2 to TomEE. This is a > showstopper for me; this error occurs when enduser clicks Login on Logon > page, and this is the first database table accessed via the web app. Please > see the following and advise. > > > server log: > > [EL Info]: 2012-11-18 > > 18:08:58.203--ServerSession(2001576835)--file:/C:/Users/Public/NetBeansProjects/mcms/build/web/WEB-INF/classes/_mcmsPU > login successful > [EL Warning]: 2012-11-18 18:08:58.444--UnitOfWork(1589240253)--Exception > [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): > org.eclipse.persistence.exceptions.DatabaseException > Internal Exception: *java.sql.SQLSyntaxErrorException: user lacks privilege > or object not found:* USERS > Error Code: -5501 > Call: SELECT USER_NAME, ACTIVE, ACTIVE_STATUS_CHANGED_DT, CREATED_DT, > LAST_LOGIN_DT, LAST_LOGOUT_DT, LOGGED_IN_VIA_MOBILE, PASSWORD, > PASSWORD_LAST_CHANGED_DT, THEME FROM USERS WHERE (USER_NAME = ?) > bind => [1 parameter bound] > Query: ReadObjectQuery(referenceClass=Users sql="SELECT USER_NAME, ACTIVE, > ACTIVE_STATUS_CHANGED_DT, CREATED_DT, LAST_LOGIN_DT, LAST_LOGOUT_DT, > LOGGED_IN_VIA_MOBILE, PASSWORD, PASSWORD_LAST_CHANGED_DT, THEME FROM USERS > WHERE (USER_NAME = ?)") > UsersFacade.getUser() throwing Exception > pf_UsersController.getUser(String id) throwing > EJBException.getCausedByException() > > > context.xml contains the following: > > <Resource name="jdbc/mcms" auth="Container" > type="java.sql.Driver" > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > maxActive="100" maxIdle="30" maxWait="10000" > timeBetweenEvictionRunsMillis="30000" > initialSize="10" > removeAbandonedTimeout="60" > removeAbandoned="true" > logAbandoned="true" > minEvictableIdleTimeMillis="30000" > jmxEnabled="false" > > jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState; > > org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer" > username="name" password="password" > driverClassName="org.apache.derby.jdbc.EmbeddedDriver" > url="jdbc:derby:C:/javadb/databases/mcmsdev;create=true"/> > > I had to comment out the following from web.xml, > > <!-- > <resource-ref> > <res-ref-name>jdbc/mcms</res-ref-name> > <res-type>java.sql.Driver</res-type> > <res-auth>Container</res-auth> > </resource-ref> > --> > > because it was causing the following error, which caused app startup to > fail. :( > > OpenEJBException: No provider available for resource-ref 'null' of type > 'java.sql.Driver' >