Oracle ADF - Tomcat 6.x - MySql 5.5 - java.lang.AbstractMethodError - mysql

We developed a Oracle ADF web app using
jDeveloper 11.1.2.4
MySql 5.5
and after a lot of google help we deployed our app onto tomcat this post.Oracle ADF onto Tomcat 6.x
In the above post he used Oracle Db. We deployed a test app with Oracle. Its running fine. But our original app has to work with MySql. We have setup our connection configuration as follows.
In conf/context.xml
<ResourceLink global="jdbc/webApp" name="jdbc/MySqlCOnDSDS" type="javax.sql.DataSource"/>
conf/server.xml
<Resource name ="jdbc/webApp" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/easyrun"
username="teja" password="teja"
maxActive="20" maxIdle="10" maxWait="10000"/>
when we are trying to run our page(first.jsf) we are getting the following error.
javax.servlet.ServletException: Servlet execution threw an exception
oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
root cause
java.lang.AbstractMethodError: org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.isClosed()Z
oracle.jbo.server.QueryCollection.setResultSetState(QueryCollection.java:5624)
oracle.jbo.server.QueryCollection.hasNextInResultSet(QueryCollection.java:4859)
oracle.jbo.server.ViewObjectImpl.hasNextForCollection(ViewObjectImpl.java:7306)
oracle.jbo.server.QueryCollection.hasNext(QueryCollection.java:4768)
oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:1294)
oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:913)
oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:7282)
oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:1227)
oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:1413)
oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:1319)
oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:1304)
oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:7211)
oracle.adf.model.bc4j.DCJboDataControl.executeIteratorBindingIfNeeded(DCJboDataControl.java:1366)
oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:2219)
oracle.jbo.uicli.binding.JUCtrlHierBinding.getRootNodeBinding(JUCtrlHierBinding.java:92)
oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.addRowKeyChangeListener(FacesCtrlHierBinding.java:616)
oracle.adfinternal.view.faces.renderkit.rich.TableRendererUtils.registerRowKeyChangeListener(TableRendererUtils.java:2715)
oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.encodeAll(TableRenderer.java:758)
oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
org.apache.myfaces.trinidad.component.UIXCollection.encodeEnd(UIXCollection.java:617)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1681)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:641)
oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:274)
oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1681)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:624)
oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:3201)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:641)
oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3062)
oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1275)
oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1452)
org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:511)
org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:923)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1681)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1677)
oracle.adfinternal.view.faces.component.AdfViewRoot.encodeAll(AdfViewRoot.java:91)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:399)
org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.renderView(ViewDeclarationLanguageFactoryImpl.java:350)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:165)
oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1035)
oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:342)
oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:236)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
Please help us..
Thanks in advance.

Tomcat 6 datasource implementation is not upgraded to work with Java 1.6.
You can switch to Apache Datasource implementation by following the steps:
Download and copy commons-dbcp 1.4 to $CATALINA_HOME/lib
Download and copy commons-pool 1.5.5 to $CATALINA_HOME/lib
Change your "Resource" tag to include the following attribute:
factory="org.apache.commons.dbcp.BasicDataSourceFactory"

Related

Getting 'java.sql.SQLException: com.mysql.jdbc.Driver' with grails run-app (when BuildConfig.groovy doesn't need to be recompiled)

I've upgraded my grails application from 1.3.9 to 2.2.3 and then to 2.3.3. I read the release and upgrade notes for 1.3.9->2.2.3 and then from 2.2.3->2.3.3
I am using OpenJDK 6, Jetty 6 and the plugin jetty 1.1, MySQL 5.5 and I have the connector library under lib
Now my issue is if I run grails clean and then grails run-app the application runs without any problems but if I stop it and run grails run-app again I get a gigantic error (see here: http://pastebin.com/36MpXhir)
I also found that changing something like adding a space somewhere in BuildConfig.groovy (anything that makes it be recompiled) makes the application run normally.
Looking at the stacktrace the first thing that puzzles me is
[02.12.13 16:13:59.919] [main] pool.ConnectionPool Unable to create initial connections of pool.
java.sql.SQLException: com.mysql.jdbc.Driver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.afterPropertiesSet(LazyConnectionDataSourceProxy.java:162)
There are references to org.apache.tomcat even though I'm using jetty (and removed tomcat from BuildConfig.groovy).
Did anyone else encounter such a problem?
Don't put jar files in the lib directory if they're available in a public Maven repo. It's far better to download jars once and keep them in a local cache, and reuse them as needed.
The MySQL driver is used as the commented-out example in the generated BuildConfig.groovy - just un-comment it :) You might want to bump up the version to the latest, e.g.
dependencies {
runtime 'mysql:mysql-connector-java:5.1.27'
}
This is a good site for finding Maven artifacts: http://mvnrepository.com/artifact/mysql/mysql-connector-java
If you do have a jar that's not in a Maven repo (e.g. one with shared code at your company) then you can put it in the lib directory, but it's not auto-discovered. Run grails compile --refresh-dependencies to get it added to the classpath.
For me same error has occurred while running the Grails Application.Then I debug and view the code history of my code which was committed recently.
From that I found the issue that was:
Inside the controller file I send the instance with-out properly
Eg:
**def list=[personInstance.]---> error occurred.**
**render list as JSON**
Then I correct my mistake-->clean the app --> run the app
Now its working fine.

Jdbc driver error : jdbc.NonRegisteringDriver

I am getting the below error when i am trying to connect to my database.
Exception in thread "main" java.lang.NoClassDefFoundError: java.util.concurrent.ConcurrentHashMap
at com.mysql.jdbc.NonRegisteringDriver.<clinit>(NonRegisteringDriver.java:83)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
at java.lang.Class.forName(libgcj.so.7rh)
at java.lang.Class.forName(libgcj.so.7rh)
at test.main(test.java:14)
Information :
Platform : RHEL 5
Java : jdk1.6.0_45
jdbc connector : mysql-connector-java-5.1.26-bin.jar
Sever: Tomcat 6
I have placed the jdbc connector inside usr/share/java/ Directory.
and my program to test the connection is placed in the root folder.
I have set the CLASSPATH to point to the connector using EXPORT command.
and I am using javac filename.java command to compile & java filename to run it.
A JDBC driver doesn't need to be installed or configured. You download the jar, add it to the runtime classpath of your application, and you're done:
java -cp someJar.jar:someDirectory:theMySQLJdbcDriver.jar com.foo.bar.Main
I have installed the old version of mysql connector which was compatible with RHEL5
and now its working fine.
Thanks !!

Tomcat JDBC MySQL ClassNotFoundException

I would like to use springMVC and JPA (using hibernate) on my tomcat 7 server (running locally on my Mac).
I was able to set up everything successfully with an embedded H2 database.
Now I switched to mysql and am getting the following error
java.lang.ClassNotFoundException: "com.mysql.jdbc.Driver"
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
This suggests tomcat is having trouble finding the mysql-connector for java.
There are a multitude of tutorials on how to add the connector to $CATALINA_HOME/lib.
After trying to use a maven dependency for my project, I followed the advice and copied the .jar file into the lib directory:
$ ls $CATALINA_HOME/lib/mysql*.jar
/Users/david/Applications/tomcat/lib/mysql-connector-java-5.1.20-bin.jar
I have read and execute permissions on the directory and file.
At the moment I can't figure out how to make tomcat aware of the jar. The folder is included in
$CATALINA_HOME/conf/catalina.properties
and I have restarted the server multiple times.
Thanks for you help.
Normally, the output of a CNFE is as follows:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
whereas your error message shows
java.lang.ClassNotFoundException: "com.mysql.jdbc.Driver"
I think you've still got quotes around the driver class name in your config.

how to deploy jbpm5.2 on tomcat 7 using mysql database?

Can anybody please help me with a link or document to run jbpm-5.2 on tomcat 7 using mysql as database ? Does jbpm deployment to tomcat require some other tool or repository or something else ? I am a complete novice to jbpm... Please help me.
Thanks in advance...
I had same problem and have posted a solution here (there is an ANT script referenced which can be downloaded):
http://ironclaws.wordpress.com/2012/06/18/jbpm-5-2-tomcat-7-mysql-ant-script-18-2/
To summarize what is required in order to install jbpm 5.2 onto tomcat 7 using the final full distribution:
Bitronix Transaction Manager : The distribution does not attempt to deploy / configure this despite the requirement. The above Ant installer will install Bitronix at the Tomcat Server level – advantageous as at this point BTM may be integrated into other projects on the platform.
The jBPM distribution is designed for JBoss AS server and the console / console-server packages include EL (expression language) libraries. These will conflict with those which are installed with Tomcat – the Tomcat EL should be preserved.
There is some confusion with respect to javassist jar in the config / config-server distributions.
The included jars should be dropped – and included into both config / config-server javassist-3.4.GA
The reason for this dependency is that Hibernate 3.4 is deployed as persistence layer in this distribution.
There is a conflicting dom4j library – dom4j-1.6.jar deployed with the console / console-server packages. This should also be removed.
It is not mentioned clearly that the parameter:
-Dreporting.needcontext=true needs to be passed to the Tomcat JVM in order to allow the gtw-server to correctly instantiate the report module loader.
For the ‘Demo’ it is important to configure the human-server persistence correctly, and additionally address the includeantruntime issue during starting of this service.

MySQL queries cause: SEVERE: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

Whenever I try (My)SQL queries on the sever (the server is in debug mode in Eclipse) I get this error:
SEVERE: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
Now I can't recall how I got this detail, but I suspect that the following info is relevant:
with %MyWorkspace% being some path like x:\some_path, this path:
%MyWorkspace%\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\rewardy\WEB-INF\lib
contains the mysql-connector-java-5.1.13-bin.jar file, that if I'm not wrong has the com.mysql.jdbc.Driver class that it looks for (am I right ?...)
I use this config: Win7 x64, Eclipse Helios Service Release 2, WAMP Server and Tomcat 6.0.26.
You should have to add location of mysql-connector-java-5.1.13-bin.jar via project properties + Java Build Path + Add External Jars (Eclipse IDE)
have you mysql-connector-java-5.1.13-bin.jar in classpath or in libs/ on tomcat ? – triclosan
Thanks #triclosan, I put it in Tomcat/lib and it works now!