Recent Posts
Archives

Posts Tagged ‘Java’

PostHeaderIcon NoClassDefFoundError: com/sun/corba/se/connection/ORBSocketFactory

Error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsQueueConnectionFactory' defined in class path resource MyResourceApplicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/sun/corba/se/connection/ORBSocketFactory

Fix: In the classpath, replace Weblogic 8.X jars with Weblogic 9.2 jars

PostHeaderIcon org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl/BitSet;)V

Error:

java.lang.reflect.UndeclaredThrowableException at $Proxy0.createQuery(Unknown Source) at somewhere in some Hibernate DAO... at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301) ... 26 more Caused by: java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl/BitSet;)V

Fix: Upgrade AntLR from version 2.7.2 to 2.7.6

PostHeaderIcon org.objectweb.asm.ClassWriter.

On calling:

MockClassControl.createStrictControl(Toto.class);

Error:

java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V

Fix: add a dependency to cglib-full-2.0.2.jar before the other dependencies.

PostHeaderIcon ids for this class must be manually assigned before calling save()

Error:

javax.ejb.EJBException: EJB Exception: : org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():

Fix: You must assign the primary-key (which is probably a composite-id) before saving the object.

PostHeaderIcon java.lang.NullPointerException at org.dbunit.dataset.DefaultTableIterator.next

Still another dumb error:

java.lang.NullPointerException at org.dbunit.dataset.DefaultTableIterator.next(DefaultTableIterator.java:59)  at org.dbunit.dataset.AbstractDataSet.getTable(AbstractDataSet.java:77)  at org.dbunit.dataset.AbstractDataSet.getTableMetaData(AbstractDataSet.java:70)  at org.dbunit.dataset.filter.SequenceTableFilter.getTableNames(SequenceTableFilter.java:94)  at org.dbunit.dataset.filter.SequenceTableFilter.iterator(SequenceTableFilter.java:110)  at org.dbunit.dataset.FilteredDataSet.createIterator(FilteredDataSet.java:74)  at org.dbunit.dataset.AbstractDataSet.iterator(AbstractDataSet.java:112)  at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:81)

I’m laughing because I had only to check the DBUnit XML file did start with <dataset> tag… :-S

PostHeaderIcon javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found

Here is the stacktrace I have had this morning:

 javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found   at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)   at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:176)   at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)   at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)

To solve it, I had to add following jars to my lib/ folder:

  • wls-stax-1.0.jar
  • wls-jsr173-1.0-ri.jar

PostHeaderIcon Unable to validate using XSD: Your JAXP provider does not support XML Schema

Here is the stacktrace that happened this morning:

Unable to validate using XSD: Your JAXP provider org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@e6a73d does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.

To solve it, I had to remove the j2ee-X.X.jar from my project.xml Maven config file.

PostHeaderIcon HashMap: beware of autoboxing!

Advice: with Java 5, do not use autoboxing without generics!

Read the rest of this entry »

PostHeaderIcon HashMap.put(null, toto)

Question: does Java’s HashMap accept null as a key?
Read the rest of this entry »

PostHeaderIcon List the content of a jar

Case: you have a jar foo.jar, and you need list the names of the files in it.

Solution: use the following command:
jar -tf foo.jar