No suitable driver exception while grail tomcat deployment - spring

I have deployed a grails application into tomcat container but am getting No suitable driver exception: can any one help in solving this.
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoader Listener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'h ibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationExc eption: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:xxxx:oracle://xxxxx:1521;ServiceName=xxxx'>
at org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator.postProcessBeanFactory(PersistenceContextInterce ptorAggregator.groovy:104) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve refe rence to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframewo rk.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons .dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:xxxx:oracle://xxxx :1521;xxxx=xxxx'
... 1 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init meth od failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exc eption is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:in formatica:oracle://xxxx:1521;xxx=xxx'
... 1 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache .commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:xxx:oracle://xxxx:1521;xxxx=xxxx'
... 1 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc: xxxx:oracle://xxxx:1521;xxxx=xxxx'
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
... 1 more Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:264)
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
... 3 more
May 30, 2013 7:31:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 30, 2013 7:31:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/Jarvis] startup failed due to previous errors
May 30, 2013 7:31:25 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext

UPDATED for a dependency definition example
Add the following repository definition to your BuildConfig.groovy
mavenRepo "https://code.lds.org/nexus/content/groups/main-repo"
In your dependencies section the following should appear:
runtime 'com.oracle:ojdbc6:11.2.0.3'
A better way is to install manually the Oracle driver to your corporate Repository(Artifactory, Nexus, Archiva, file server, etc.)

Related

Problems while restore nifi version 1.12.1 with old configs

In general, the update was successful. But after transferring the configs from the old version (authorizers.xml, nifi.properties, keystore.jks, flow.xml.gz) to the new version, it starts to swear that they are not valid, and the keystore password is incorrect, but open it with the old password successfully. Below presented errors in the log:
WARN [main] org.eclipse.jetty.webapp.WebAppContext Failed startup of context o.e.j.w.WebAppContext#6bb4dd34{nifi-api,/nifi-api,file:///opt/nginx/nifi-ift/nifi/work/jetty/nifi-web-api-1.12.1.war/webapp/,UNAVAILABLE}{./work/nar/framework/nifi-framework-nar-1.12.1.nar-unpacked/NAR-INF/bundled-dependencies/nifi-web-api-1.12.1.war}
org.apache.nifi.web.NiFiCoreException: Unable to start Flow Controller.
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'flowService': FactoryBean threw
exception on object creation; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'flowController': FactoryBean threw exception
on object creation; nested exception is
java.lang.IllegalStateException: Flow controller TLS configuration is
invalid
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'flowController': FactoryBean threw
exception on object creation; nested exception is
java.lang.IllegalStateException: Flow controller TLS configuration is
invalid
Caused by: java.lang.IllegalStateException: Flow controller TLS
configuration is invalid
Caused by: org.apache.nifi.security.util.TlsException: The truststore
properties are not valid
WARN [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.
java.io.IOException: Keystore was tampered with, or password was incorrect
Caused by: java.security.UnrecoverableKeyException: Password verification failed

Mule Migration from 3.8.4 to 3.9.2 jars related issue

Getting below issue while migration from 3.8.4 to 3.9.2 Mule runtime.
java.lang.NoClassDefFoundError: org/springframework/context/ResourceLoaderAware (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
I have spring spring-context-4.1.9.RELEASE.jar and all default jars in opt folder of Mule runtime.
ResourceLoaderAware class is in this spring-context-4.1.9.RELEASE.jar.
Any idea how do I resolve this issue.
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_muleTransactionManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.mule.api.transaction.TransactionManagerFactory org.mule.config.spring.factories.TransactionManagerFactoryBean.txManagerFactory; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] for bean with name 'entityManagerFactory' defined in class path resource [CCModuleFlood-context.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/ResourceLoaderAware (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:89) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:222) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:81) ~[mule-core-3.9.2.jar:3.9.2]
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:210) ~[mule-module-launcher-3.9.2.jar:3.9.2]
... 18 more
Error NoClassDefFoundError doesn't mean that it was not able to find the class, it means that there was some previous error loading the class. You need to find the previous error to identify the root cause.
It might that there are some incompatible versions in the classpath that caused the original error.

Error creating bean with name 'BitronixTransactionManager' defined in URL

I created two tomcat instances in single OS(windows). when i ran second instance i got below error.
2018-07-04 13:11:22,859 ERROR [localhost-startStop-1] o.s.w.c.ContextLoader [ContextLoader.java:331] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BitronixTransactionManager' defined in URL [jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%208/webapps/mfsmiddleware/WEB-INF/lib/a.b.c.d.e-0.1-SNAPSHOT.jar!/META-INF/spring/jbpm-a-b.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [bitronix.tm.BitronixTransactionManager]: Factory method 'getTransactionManager' threw exception; nested exception is bitronix.tm.utils.InitializationException: cannot open disk journal
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.1.8.RELEASE.jar:4.1.8.RELEASE]
Caused by: bitronix.tm.utils.InitializationException: cannot open disk journal
Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file

SPRING Lookup failed for 'jdbc/ww2b/DataSource' in SerialContext

[#|2014-04-01T15:19:03.824+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=76;_ThreadName=Thread-2;|15:19:03.822 [admin-thread-pool-4848(5)] ERROR o.s.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoryUiDao': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [jar:file:/C:/glassfish3/glassfish/domains/domain1/applications/web/WEB-INF/lib/core-2.6-SNAPSHOT.jar!/META-INF/spring/db-env.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in URL [jar:file:/C:/glassfish3/glassfish/domains/domain1/applications/web/WEB-INF/lib/core-2.6-SNAPSHOT.jar!/META-INF/spring/db-env.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Lookup failed for 'java:comp/env/jdbc/ww2b/DataSource' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Lookup failed for 'jdbc/ww2b/DataSource' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming, com.sun.enterprise.naming.logicalName=java:comp/env/jdbc/ww2b/DataSource} [Root exception is javax.naming.NameNotFoundException: ww2b]]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
what is wrong. When I build a project everything works but when I try to deploy to glassfish3 I get error.
Assuming your Spring application configuration is right it seems that the JNDI resource java:comp/env/jdbc/ww2b/DataSource is not correctly configured on the server.
You should configure JNDI resource on GlassFish as described in the Administrator Guide.

Weird ClassNotFoundException in WebLogic 10.3.6

We have an .ear file that is running normal in a WebLogic 10.3.6 application server.
The .ear uses Spring 3.0.5 and Hibernate 3.5.2.
If we deploy the same .ear file in another WebLogic 10.3.6 server, we get the next error.
org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterService': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private nl.surf.adapter.generic.dao.MessageFilterDAO nl.surf.adapter.generic.service.FilterService.messageFilterDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private nl.surf.adapter.generic.dao.MessageFilterDAO nl.surf.adapter.generic.service.FilterService.messageFilterDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: java.lang.NoClassDefFoundError
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
I've tried several solutions:
Place hibernate3.jar in .war/WEB-INF/lib (all jars are now in .ear/lib)
Use <prefer-web-inf-classes>true</prefer-web-inf-classes> in .war/WEB-INF/weblogic.xml
Nothing seems to work.
I'm kind of lost here...
After some extensive searching on the web and trial and error changes on the .ear, i've found the solution for my problem.
I've changed file META-INF/weblogic-application.xml and added the tags beneath inside tag <weblogic-application>
<prefer-application-packages>
<package-name>org.apache.*</package-name>
<package-name>antlr.*</package-name>
</prefer-application-packages>

Resources