Recent Posts
Archives

Archive for the ‘en-US’ Category

PostHeaderIcon Remove duplicated lines from a file

Abstract: you have to remove duplicate lines in one file. For instance, you have a file:

foo1
foo2
foo2

Solution: use this command:

uniq myFile.txt

You’ll get:

foo1
foo2
uniq myFile.txt

PostHeaderIcon Sort the content of a file

Case: you have to sort the content of a file in Unix.

Solution

sort -d sourceFile > destinationFile

PostHeaderIcon How to find all the files of which size is greater than a given value?

Abstract: we need to retrieve all the files in current folder (and its sub-folders) of which size is greater than 10 Mo

Use:

find . -type f -size +10000 -print

PostHeaderIcon Ternary operator in Oracle PL/SQL

Abstract: we need the max of two dates

Read the rest of this entry »

PostHeaderIcon XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit

Error:

MyStrutsAction     - Error on uploading: MyPersonnalClass@971720[primaryId=<null>,type=XXX,myDate=20080702,entityId=<null>,optimisticTimestamp=<null>] org.springframework.remoting.RemoteAccessException: Could not access remote service [my-service-bean]; nested exception is javax.transaction.TransactionRolledbackException: BEA1-0F416BB49A8BE6353E83: javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit. To force this participation, set the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source = myDatasource

Fix:

  • Go on WebLogic console
  • Then follow the pages: Home > Summary of JDBC Data Sources > myDatasource > Transactions
  • Uncheck:One-Phase Commit
  • Check: Emulate Two-Phase Commit

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 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 How to have syntax color in VIm under CygWin?

In order to have syntax color in VIm under CygWin, in your $HOME folder, add a file .vimrc, with this simple line as content:

syntax on

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