• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SqlException :Jforum 2.1.8 & postgresql 8.3&jdk1.5 (windows XP)

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I replace the postgres...jdbc3.jar file from postgres 8.0(Jforum default) to 8.3(download from postgres jdbc3). the bugs show following.
Then I change database to postgress 8.1.11 with postgresql-8.1-413.jdbc3.jar. all bugs disappear.
Logs........(Asia Pacific is a topic for the forum)
Method public java.util.List net.jforum.entities.Forum.getModeratorList() threw an exception when invoked on [Asia Pacif
ic , id=1, order=2]
The problematic instruction:
----------
==> assignment: moderators=forum.getModeratorList() [on line 311, column 41 in default/forum_show.htm]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Method public java.util.List net.jforum.entities.Forum.getModeratorList() th
rew an exception when invoked on [Asia Pacific , id=1, order=2]
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Assignment.accept(Assignment.java:90)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at net.jforum.JForum.processCommand(JForum.java:233)
at net.jforum.JForum.service(JForum.java:200)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: net.jforum.exceptions.DatabaseException: net.jforum.exceptions.DatabaseException: java.sql.SQLException: ERRO
R: operator does not exist: character varying = integer
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:392)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at net.jforum.dao.generic.GenericForumDAO.getModeratorList(GenericForumDAO.java:498)
at net.jforum.repository.ForumRepository.getModeratorList(ForumRepository.java:596)
at net.jforum.entities.Forum.getModeratorList(Forum.java:101)
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:585)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:825)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 26 more
Caused by: net.jforum.exceptions.DatabaseException: java.sql.SQLException: ERROR: operator does not exist: character var
ying = integer
... 42 more
Caused by: java.sql.SQLException: ERROR: operator does not exist: character varying = integer
... 42 more
14:47:01,406 ERROR [ExceptionWriter ]
Method public java.util.List net.jforum.entities.Forum.getModeratorList() threw an exception when invoked on [Asia Pacif
ic , id=1, order=2]
The problematic instruction:
----------
==> assignment: moderators=forum.getModeratorList() [on line 311, column 41 in default/forum_show.htm]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Method public java.util.List net.jforum.entities.Forum.getModeratorList() th
rew an exception when invoked on [Asia Pacific , id=1, order=2]
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Assignment.accept(Assignment.java:90)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at net.jforum.JForum.processCommand(JForum.java:233)
at net.jforum.JForum.service(JForum.java:200)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: net.jforum.exceptions.DatabaseException: net.jforum.exceptions.DatabaseException: java.sql.SQLException: ERRO
R: operator does not exist: character varying = integer
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:392)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at net.jforum.dao.generic.GenericForumDAO.getModeratorList(GenericForumDAO.java:498)
at net.jforum.repository.ForumRepository.getModeratorList(ForumRepository.java:596)
at net.jforum.entities.Forum.getModeratorList(Forum.java:101)
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:585)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:825)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 26 more
Caused by: net.jforum.exceptions.DatabaseException: java.sql.SQLException: ERROR: operator does not exist: character var
ying = integer
... 42 more
Caused by: java.sql.SQLException: ERROR: operator does not exist: character varying = integer
... 42 more

URL is: /jforum/forums/show/1.page?null
14:47:42,109 ERROR [runtime ]
[originally posted on jforum.net by Jingyu_zhang]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the problem with DB that are trying to migrate from "almost standard" to SQL Standard compliant... they tend to have to change things that break existing working queries...

That said take a look at this post, especially the part at the bottom about modifying the queries to include a "Cast" statement.

https://coderanch.com/t/577915 #18284

One thing that might be work looking into is if there are any new PostGress JDBC URL options or Database options that will let the old queries work. Sometimes they add stuff like this for backwards compatiblity. This would be easier than finding and fixing the "broken" SQL queries.

FWIW - How to find a bad query 101.

First, check if the Underlying error in your error trace stack has an SQLException as the underlying cause that looks like a syntax problem... e.g "Operator does not exist: character varying = integer"

Then look down the trace for the first net.jforum entry, e.g. "net.jforum.dao.generic.GenericForumDAO.getModeratorList(GenericForumDAO.java:498 )"

You then have to look in the source code for the class (e.g. GenericForumDAO) at the line specified (e.g. 498) or find the method (e.g. getModeratorList).

Somewhere above this line, there will be a "SystemGlobale.getSQL(<String>) call.

The value of the <String> is the key to the actual query being used. This can be found in either the config/database/postgres/postgres.sql file or the config/database/generic/generic_queries.sql file.

FWIW, the DB specific file has DB Specific statements and the generic file has the default (MySQL based) queries.
[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Those line fixes on the thread you refer to above fixed my problem, thank you! I even used the 101 lesson to catch the error I'd introduced:

"PSQLException: No value specified for parameter 2."

...I just needed to take out the #comment lines I'd added. This all happened after I upgraded my postgres connector.

Thanks!!
[originally posted on jforum.net by ken0]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic