Author | Message |
---|---|
cysun
Posts: 2935
|
Posted 11:16 Sep 28, 2011 |
A couple of students have reported this error. There could be several possible causes for this problem, but now that I think about it, the biggest mistake is the decision to include a JDBC dependency in the POM - it seemed like a good idea at that time because the driver could be downloaded automatically by Maven, but it's problematic because the database, which is outside the control of the project, may not match the driver version. So if you have not set up the development environment yet, do the following in addition to the instructions here:
If you have set up the environment and run into this problem, do the two thing above, then recreate the Tomcat server runtime in Eclipse as follows: In Window -> Preferences -> Server -> Runtime Environments, remove the server runtime then use the Add button to add it back. The reason to do this is so that the server runtime will pick up the new JDBC driver you placed in the Tomat lib folder.
Many students have reported having problems with the latest Tomcat version 7.0.21. You should use an older version - 7.0.11, 7.0.14, and 7.0.16 have all been confirmed to work. After this you can run the project again and it should work. If you see this error again during development (usually happens when Tomcat tries to auto-restart when a Java file is changed), simply stop the server then run the project again. Sorry about the inconvenience. Last edited by cysun at
19:22 Sep 28, 2011.
|
cysun
Posts: 2935
|
Posted 19:32 Sep 28, 2011 |
It seems like the main problem is Tomcat 7.0.21 instead of the JDBC driver - it's been confirmed that the 8.4 JDBC driver can connect to PostgreSQL 9.1 without any problem. So you have two options and both should be fine: a) Just keep things as is - no need to change pom.xml or do anything (other than making sure not to use Tomcat 7.0.21).. b) As described in the post above, add the matching JDBC driver to Tomcat, and change the scope of the PostgreSQL dependency in pom.xml from compile to test so that it's only used during testing. To change the scope of a dependency to test, select pom.xml in Eclipse, select the dependency in the Dependencies tab, click Properties ..., then select test in the Scope dropdown list, then save pom.xml. |
sepidehnazari
Posts: 2
|
Posted 15:24 Sep 30, 2011 |
Hi Professor, I tried all step in Setting up Development Environment guide. I got the same error; so I tried all of your fix guidelines but I still get the same error. in my log file I got
2011-09-30 12:27:38,940 WARN JDBCExceptionReporter: SQL Error: 0, SQLState: 42501 At my Console I got: Sep 30, 2011 2:43:37 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [csns2] in context with path [/csns2] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query] with root cause org.postgresql.util.PSQLException : ERROR: permission denied for relation news at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
Apache Tompcat/7.0.11 -Error report is HTTP Status 500 - typeException report message descriptionThe server encountered an internal error () that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) |
cysun
Posts: 2935
|
Posted 15:31 Sep 30, 2011 |
That's not the same error. Yours is a permission denied error, which means the user you specified in your build.properties does not have access to the csns2 database. |
ummata
Posts: 68
|
Posted 04:42 Oct 05, 2011 |
Thanks a lot, Dr.Sun. |
aaronyen
Posts: 29
|
Posted 21:38 Oct 31, 2011 |
Hi, How did you resolve this problem? Thanks |
sepidehnazari
Posts: 2
|
Posted 23:31 Oct 31, 2011 |
Dr. Sun suggested me to clean my Eclipse you can find the steps in the following link: http://csns.calstatela.edu/forum/viewTopic.html?topicId=4268508 |
aaronyen
Posts: 29
|
Posted 07:34 Nov 01, 2011 |
I've tried to the clean Eclipse method but it still doesn't work. I am still getting the same errors. Should I just use CS3's PostgreSQL? |
cysun
Posts: 2935
|
Posted 08:37 Nov 01, 2011 |
Check if the owner of the database/tables is the same as the one you specified in build.properties. |
aaronyen
Posts: 29
|
Posted 08:45 Nov 01, 2011 |
Hi Dr. Sun, I've created a new role and assigned all servers, databases to that role and have changed the authentications inside build.properties for different project examples but still show the same error. Inside PgAdmin it says the roles are indeed fetching data from the DB. I believe the problem lies deep within my server configuration, although I've removed and added new servers multiple times already with different Tomcat versions. Also, could it be the errors from Environment Variables? |
cysun
Posts: 2935
|
Posted 08:47 Nov 01, 2011 |
Changing the database ownership does not change the ownership of the tables inside the database. Just drop the databases, then log in as the user (not as postgres) and recreate them. |
cysun
Posts: 2935
|
Posted 08:48 Nov 01, 2011 |
Or just use the postgres user in your build.properties. |
aaronyen
Posts: 29
|
Posted 09:11 Nov 01, 2011 |
Thank you very much Dr. Sun. The problem is solved. I had to drop all databases just like you've said and recreate them using the new role that I've created. |