So I got sort of strange situation. I have Spring webapp and in it I have JNDI datasource that I have defined in tomcat's server.xml to connect to mysql database
I have mysql-connector-java 5.1.2 in my Maven pom.
Application works when I start it from localhost, but when I deploy it to remote tomcat it is not getting the call to the database.
This Exception occurs :
Couldnt execute sql CALL shareholders_company_list(?)
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unable to create correct SQLException class instance, error class/codes may be incorrect. Reason:
** BEGIN NESTED EXCEPTION **
java.sql.SQLException
MESSAGE: Can't instantiate required class due to java.lang.ClassNotFoundException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException
STACKTRACE:
java.sql.SQLException: Can't instantiate required class due to java.lang.ClassNotFoundException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException
Is there away to avoid this ClassNotFoundException, so that I can get full stack trace, since it seems that explicit error why this happens is in MySQLNonTransientConnectionException, and I can't seem to reach it.
import required version(if you don't have any preference go for latest) of mysql-connector-java-latestVersion.jar under tomcat\lib
Related
We have deployed our application on tomcat server.
Java version - 1.8
Sometime our application is impacted with the error :
SEVERE [main] org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans Exception processing Global JNDI Resources
javax.naming.NamingException: Unexpected exception resolving reference [Root exception is java.sql.SQLException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver']
But whenever we restart the server, it will resolved.
We get this issue once in two days.
Any help in this is appreciated .
I have an application that use Spring and Hibernate.
Originally, I thought that this application would deployed on Tomcat, but, by requirements of customer, now I need deploy on Oracle AS 10g.
First, appear me the famous error:
XML-24509: (Error) Definición duplicada para: 'xxx',
and I solved with this, I put this on VM of the Server:
-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
but now I have the following error:
/Users/hlopez/SPRING/sts-3.1.0.RELEASE/plugins/org.eclipse.jst.server.generic.oc4j_1.5.206.v20090812/buildfiles/oracle.10.1.3.xml:74: Deploy error: Operation failed with error:
Error creating bean with name 'analyzerConfigDAOImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [META-INF/spring/mvc/servlet-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
I read about this, and a lot of people typed that, this error is caused for some .jars of hibernate,
I removed the hibernate-jpa-2.0-api-1.0.1.Final, but this caused more errors,
I have these .jars on my server:
adf-connections.jar
adfmtl.jar
adfui.jar
dc-adapters.jar
adfbinding.jar
adfcm.jar
adfm.jar
adfmweb.jar
adfshare.jar
bc4jct.jar
bc4jctejb.jar
bc4jdomorcl.jar
bc4jimdomains.jar
bc4jmt.jar
bc4jmtejb.jar
collections.jar
commons-cli-1.0.jar
jdev-cm.jar
ojmisc.jar
regexp.jar
share.jar
xmlef.jar
xsqlserializers.jar
concurrent.jar
mdsrt.jar
ordhttp.jar
ordim.jar
Help please, Thanks.
I am deploying the MBOs in SUP 2.2 and it is failing with the Null Pointer Exception.
Errors occurred while creating packages.
Deployment Error: Create package failed (package=/TestforSR/.pkg, server=MOF Server)
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
But it is working fine and able to fetch the response when preview and by using the SOAPUI utilities and not throwing any error or exception. Only the exception when deploying the package.
Check if you are connected the SUP server? And while deploying, it would be better to use the
Update
mode.
I have found a work around for the issue. Not sure if this is the only solution but this is working for me and MBOs are getting deployed to the SUP Server successfully without throwing the Null Pointer Exception.
The webservice that i was using had some parameters of datatype set as enum, which is not supported by SUP and by changing the parameter datatype from enum to String resolved the issue, and error is no more there.
I have problem with rmiregistry. I'm getting below error:
Cannot bind to URL [rmi://........]: javax.naming.NamingException [Root exception is java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
java.lang.ClassNotFoundException: Could not find class (javax.management.remote.rmi.RMIServerImpl_Stub) at codebase ()]
I checked, class exist in the classpath.
I used java 1.6 on linux. I started rmiregistry 6667.
Has anyone met with this error?
class exist in the classpath.
In your JVM's classpath. It is also needed on the Registry's classpath, and the client's.
I'm trying a sample hibernate program, to connect to MS SQL DB and execute some sql.
I've created hbm and cfg.xml files but while executing I'm getting following exception.
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at com.persistent.demo.HibernateUtil.<clinit>(HibernateUtil.java:12)
at com.persistent.demo.HelloWorld.main(HelloWorld.java:15)
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.persistent.demo.HibernateUtil.<clinit>(HibernateUtil.java:14)
at com.persistent.demo.HelloWorld.main(HelloWorld.java:15)
Caused by: org.hibernate.HibernateException: Dialect class not found: net.sf.hibernate.dialect.SQLServerDialect
I'm not getting whether I have missed any jar files or is there any other problem.
Please help.
Thanks.
-Uday
Dialect class not found: net.sf.hibernate.dialect.SQLServerDialect
You need to put the Jar, containing this class, in your class paht.
May the problem is, that the dialect you need is: org.hibernate.dialect.SQLServerDialect which is aviable in the hibernate core jar.
have you add Mssqlserver.jar in your class path . or check your connection url