OK - I have a huge message that I'm going to cut and paste into this one,
rather than finding the original and editing it online.
I'm going to edit in place and try to point out some issues. I'll ask
some questions along the way.
I am trying to tweak my web application at thejarbar.org to be bug
free. Currrntly here is an issue whn clicking the "tutorials button as
you can view in your browser. I am getting some kind of exceptions as
ell listed in the following stack trace and don't know how to osolve
after days of trying. I have been getting mysql SELECT privilege
denied exception even though user has all access to database.
code deleted . . . although I recommend reworking in with try, catch,
and finally blocks. Otherwise you WILL have connection leaks.
As a first timer I would likw to know how a typical hibernate webapp
is moved from development to production please have a look at the page
if you have the time
Use the same database names in both cases. Unfortunately, the URL will
be different. One way is to parametrize your build to use different
hibernate.cfg.xml files. You could also use Ant and appropriate
build.properties files. Finally, you could spend some time with Maven.
here is a log of all errors related to clicking that link
ERROR main org.apache.catalina.core.ContainerBase.[Catalina] -
Exception opening database connection java.sql.SQLException: Access
denied for user ' yucca123_tom'@'localhost' (using password: YES)
This looks like you cannot even connect. As others have pointed out,
there is a space in front of the user name.
I'm also a bit confused here. You say (further down or in another
message), that you have the JDBC driver in your WEB-INF/lib folder,
but this looks like you are using Tomcat's database pooling?
If you're using Tomcat's database pooling, do not put the driver jars
in WEB-INF/lib. If you're using Hibernate to control the connections,
then don't put the driver jars in Tomcat's lib.
See this link for a complete explanation of how to set everything up.
http://wiki.apache.org/tomcat/TomcatHibernate
The only way I was able to sort of reproduce your error was by
changing the attribute resource="username" in my context.xml file to
resource=" username". Adding a space to the username property in
hibernate.cfg.xml caused no error.
Fix your configuration files here.
INFO main org.apache.catalina.core.StandardContext - The listener
"com.sun.faces.config.ConfigureListener" is already configured for this
context. The duplicate definition has been ignored.
INFO main org.apache.catalina.core.StandardContext - The listener
"com.sun.faces.config.ConfigureListener" is already configured for this
context. The duplicate definition has been ignored.
Are you using the database login ID to create tables? This is a very
dangerous practice. One slip concerning SQL injection and you'll have a
completely destroyed database.
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate -
Unsuccessful:
create table jarbartest.user_roles (user_name varchar not null,
role_name
varchar not null, primary key (user_name, role_name))
Fix your HQL
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate - You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'not null, role_name
varchar
not null, primary key (user_name, role_name))' at line 1
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate -
Unsuccessful:
create table jarbartest.usercomments (commentID int unsigned not null,
commentMade varchar not null, dateMade datetime not null, flagged bit not
null, page_id varchar not null, made_by varchar(20) not null, primary key
(commentID))
Fix your HQL
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate - You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'not null, dateMade
datetime
not null, flagged bit not null, page_id varchar not ' at line 1
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate -
Unsuccessful:
create table jarbartest.users (user_name varchar not null, first_name
varchar not null, last_name varchar not null, user_email varchar not
null,
ip_address varchar not null, user_pass varchar not null, primary key
(user_name))
Fix your HQL
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate - You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'not null, first_name
varchar not null, last_name varchar not null, user_email va' at line 1
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate -
Unsuccessful:
alter table jarbartest.usercomments add index FKAA77CEBF792FED2F
(made_by),
add constraint FKAA77CEBF792FED2F foreign key (made_by) references
jarbartest.users (user_name)
This is assigned to a different database user. Are you using multiple
database connections? This is very tricky, and requires multiple
hibernate.cfg.xml files (each named differently of course), and separate
session factories for each connection. Accessing those session
factories is difficult in Tomcat since Tomcat provides a read-only
JNDI (per the specs). There are some hacks around this, but in general
they are not worth the trouble.
ERROR TP-Processor2 org.hibernate.tool.hbm2ddl.SchemaUpdate - ALTER
command
denied to user 'yucca123_hiber'@'localhost' for table 'usercomments'
ERROR TP-Processor2 org.hibernate.util.JDBCExceptionReporter - SELECT
command denied to user 'yucca123_hiber'@'localhost' for table
'usercomments'
A lot of errors. Where are your tag files located for Faclets tags? They
need to be in WEB-INF/tags, a subdirectory of WEB-INF/tags, or some fun
games with jars under WEB-INF/lib. The jars must contain a META-INF folder
with tags and TLD files. This is all for the 2.4 spec. I'd have to look up
the 2.5 spec.
ERROR TP-Processor2
org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces
Servlet] - Servlet.service() for servlet Faces Servlet threw exception
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command
denied to user 'yucca123_hiber'@'localhost' for table 'usercomments'
ERROR TP-Processor2
org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[jsp]
- Servlet.service() for servlet jsp threw exception
java.lang.RuntimeException: Cannot find FacesContext
ERROR TP-Processor2
org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org] -
Exception Processing ErrorPage[exceptionType=java.lang.Throwable,
location=/oops.jsp]
org.apache.jasper.JasperException: java.lang.RuntimeException: Cannot
find
FacesContext
ERROR TP-Processor2 org.hibernate.util.JDBCExceptionReporter -
Communications link failure
The last packet successfully received from the server was 1,201,712
milliseconds ago. The last packet sent successfully to the server was 1
milliseconds ago.
ERROR TP-Processor2
org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces
Servlet] - Servlet.service() for servlet Faces Servlet threw exception
java.io.EOFException: Can not read response from server. Expected to read
4
bytes, read 0 bytes before connection was unexpectedly lost.
ERROR TP-Processor2
org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[jsp]
- Servlet.service() for servlet jsp threw exception
java.lang.RuntimeException: Cannot find FacesContext
ERROR TP-Processor2
org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org] -
Exception Processing ErrorPage[exceptionType=java.lang.Throwable,
location=/oops.jsp]
And there are more, but I didn't edit them in.
Post your hibernate.cfg.xml file, your context.xml file, your web.xml
file.
. . . . just my two cents
/mde/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org