Posts

Showing posts with the label Exception

Openstack Keystone : 'Client' object has no attribute 'service_catalog'

When I try the following command on my setup keystone catalog or keystone token-get I get the following error 'Client' object has no attribute 'service_catalog' When I run in debug mode I can see that the issue is client side. I checked my environment variables env | grep --perl "^OS|^SERV" the variables SERVICE_ENDPOINT and SERVICE_TOKEN were defined and taking precedence Doing following resolved it export SERVICE_TOKEN= export SERVICE_ENDPOINT=  

Openstack Keystone : No handlers could be found for logger "keystoneclient.client"

When I hit the the command Keystone user-list I get the following error No handlers could be found for logger "keystoneclient.client" Invalid OpenStack Identity credentials.  If you run the command in debug mode keystone --debug user-list you get the following response send: 'GET /v2.0//users HTTP/1.1\r\nHost: 10.1.1.1:35357\r\nx-auth-token: 012345\r\naccept-encoding: gzip, deflate\r\nuser-agent: python-keystoneclient\r\n\r\n' reply: 'HTTP/1.1 401 Not Authorized\r\n' header: Vary: X-Auth-Token header: Content-Type: application/json header: Date: Wed, 16 Jan 2013 08:58:36 GMT header: Transfer-Encoding: chunked No handlers could be found for logger "keystoneclient.client" connect: (10.128.176.48, 5000) send: 'POST /v2.0/tokens HTTP/1.1\r\nHost: 10.128.176.48:5000\r\nContent-Length: 87\r\nx-auth-token: 12345\r\ncontent-type: application/json\r\naccept-encoding: gzip, deflate\r\nuser-agent: python-keystoneclient\r\n\r\n{"auth...

Hibernate + Spring + MySql: Cannot convert value '0000-00-00 00:00:00' from column X to TIMESTAMP

Image
When I was trying to load an Hibernate object, I received the following error: nested exception is java.sql.SQLException: Cannot convert value '0000-00-00' from column 4 to TIMESTAMP. at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQL This exception means that the column "X" has an invalid date "0000-00-00 00:00:00" According to http://bugs.mysql.com/bug.php?id=13030 "Datetimes with all-zero components ('0000-00-00 ...') - These values can not represented reliably in Java. Connector/J 3.0.x always converted them to NULL when being read from a ResultSet. When working with MySQL over JDBC and the driver encounters a zero DATE, TIME, or DATETIME value (that is, e.g, ‚0000–00–00‘ for DATE), this exception is thrown. This can be handled by adding the JDBC Parameter: zeroDateTimeBehavior=convertToNull to your JDBC connection. url=jdbc:mysql://localhost/test?connectTimeout=60000&autoReconnect=true&ze...

Hibernate: a different object with the same identifier value was already associated with the session

People working with Hibernate might be familiar with the below error. org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session This exception is generated when we try to load an instance object in session which has been already loaded by hibernate. Easier said than done. Hibernate considers two persistent entities identical if the two rows of the table can be said identical. Above error could be generated in many ways and there may be various solutions on net like using session merge etc to get away with the problem. I will discuss here the reason for me getting this problem and the way I resolved it. Below is the code which generated the exception for me. Following is the method which caused the exception @Transactional(propagation=Propagation....

Context initialization failed - java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

I received the following error while running a Spring and Hibernate application Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/ applicationContext.xml ]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder Caused by: java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder at org.slf4j.LoggerFactory. (LoggerFact...

org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

This Exception during the maven build in an hibernate based project could come due to various reasons. Primarily one should look into the complete stack trace. The further exception usually do give clue of the actual problem. I my case, the stack trace revealed the below issue Exception in thread "main" org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping. (EntityEntityModeToTuplizerMapping.java:80) at org.hibernate.tuple.entity.EntityMetamodel. (EntityMetamodel.java:323) at org.hibernate.persister.entity.AbstractEntityPersister. (AbstractEntityPersister.java:456) at org.hibernate.persister.entity.SingleTableEntityPersister. (SingleT...

java.lang.nosuchmethoderror org.objectweb.asm.classwriter

I was working on a RESTFul Service based project. Recently I migrated the plain JDBC DAO layer to the hibernate based orm layer. As a first step I migrated one of the DAO class. When I deployed the complete solution in Tomcat, I faced the following error java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter. (Z)V at net.sf.cglib.core.DebuggingClassWriter. (Debu ggingClassWriter.java:47) at net.sf.cglib.core.DefaultGeneratorStrategy.getClas sWriter(DefaultGeneratorStrategy.java:30) at net.sf.cglib.core.DefaultGeneratorStrategy.generat e(DefaultGeneratorStrategy.java:24) at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:216) at net.sf.cglib.core.KeyFactory$Generator.create(KeyF actory.java:145) at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:117) at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.jav a:104) at net.sf.cglib.proxy.Enhancer. (Enhancer.java :69) at java.lang.Class.forN...

java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.getXmlStandalone()Z

If you are facing this issue than most probably have a wrong version of XercesImpl.jar file I had a 2.0.2 version, which causing conflict. Replacing it with 2.8.1 resolved the issue.

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value:

This error may crop up if you are doing any DML operation through IN clause. Example String sql = 'update table set status = true where id in (?)' If you are using the above statement as part of the prepared statement and the 'id' column is of long type. Following would give this error. String str = "1,2,3,4"; PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, str); stmt.executeUpdate(); The last line would give the error. Reason being that the column is of Long(BIGINT) type and value is passed as string. You cannot say stmt.setLong(1, str); as the 'str' contains comma separated values. One of the solution in this case is to create separate place holders for each input value String sql = 'update table set status = true where id in (?,?,?,?)' in this case and pass individual long values to the statement object. Other options are welcome.

Behavior of AUTO INCREMENT column when max value has reached

I was looking on the net for the query that "What will happen in an InnoDB MySQL table with column of type AUTO INCREMENT if the max value has reached?" There is so much of information on the net regarding this but does not lead anywhere. I could not find any official word in this query. Most of the links say that it would throw an error. Some had other views that the behavior is not predictable http://www.dbforums.com/mysql/1207954-auto-increment-field-hit-maximum-integer-value.html So i tried a small test myself through mysqlcc by inserting the largest value in int(11) - AUTO INCREMENT type column (name "id"). Th maximum value i could insert manually was "2147483647" (the next number gives "Out of range value" error) The moment I inserted a new row, the new number assigned to the column "id" was "1000000000" Behavior was strange, might help someone that it did not give an error

Error "Document could not be opened"

When we try to open any of the jasper reports in pdf, csv or rtf format, it results in an error saying that the document can't be opened. However, when we first save the report then it can be opened. This problem only occurs when we connect directly to Websphere 6.1. When there is a HTTP server in between, everything works ok. Analysis: We studied the HTTP header information being transmitted in both the cases; with HTTP Server and without HTTP server. Realized that the issue does occur because in case of no HTTP Server the HTTP had the cache settings as "Cache-Control: no-cache" Following is what we have suggested the customer: If you have 'CookiesConfigureNoCache' property already configured in your server, then please change its value to False, restart the server and try to replicate the problem. Otherwise, please add this property following the steps mentioned below. Steps to configure custom property CookiesConfigureNoCache on WAS 6.1: Login to the Administra...

Custom Exception with same name as JDK Exception

If I create an exception example IOException, will there be an conflict with the existion IOException of JDK? In a discussion the qustion popped up for a quick response and most us had it. But if someone has confusions, here is a quick explanation. Lets  create a custom exception IOException as stated below (IOException.java) package my.test; class IOException extends Exception { IOException() { super("MyIOException Has Raised"); } } Next lets create a test program to see what happens (TestException.java). package my.test; public class TestException { public static void main(String[] args) { try { throw new IOException(); } catch(IOException e) { System.out.println(e.getMessage()); } } } When we run the TestException.java file we get the following message: MyIOException Has Raised Now lets include an import statement to import java.io.IOException class. package my.test; import java.io.IOException; public class TestException { public static void main...