sâmbătă, 21 mai 2016

Checksum Verification with Microsoft File Checksum Integrity Verifier

For executing the checksum verification follow the steps:
  1. Install the File Checksum Integrity Verifier. You can download it from microsoft site. 
  2. Create a but file with the script comands for every neccesary subfolder.
Ex of fciv cmd script:
     fciv.exe -v -bp E:\...\test -sha1 -xml   
   "E:\DB/..\test -sha1.xml"   

where
fciv - the comand for checksum
-v - executing the verification
-bp - remove the base path (it will not remove anything on your subfolder, just used for its verification)
E:\..\test\  - the subfolder path that contains other subfolders with file content
sha1 - is the verification algoritm
"E:\..\test -sha1.xml" - the name of DB xml that contains all the hashes with with will be compared to.
   
 3.  Put the bat script file into the same path with the fciv.exe file of instaled Checksum Integrity Verifier program that you downloaded from microsoft site.
4. Execute the bat created. Ex:
D:\Tasks\Checksum>D:\Tasks\Checksum\checksum.bat >checksum.log
You will receive the log trace in checksum.log

luni, 4 aprilie 2016

Hibernate Error: Initial SessionFactory creation failed.java.lang.NoSuchFieldError: TRACE

During the creation of a new hibernate project in NetBeans 8.0.1 I met the following error:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
Initial SessionFactory creation failed.java.lang.NoSuchFieldError: TRACE
Exception in thread "main" java.lang.ExceptionInInitializerError
    at HibernateUtil.<clinit>(HibernateUtil.java:30)
    at Main.main(Main.java:9)
Caused by: java.lang.NoSuchFieldError: TRACE
    at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:60)
    at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:35)
    at org.jboss.logging.Logger.logv(Logger.java:1953)
    at org.jboss.logging.DelegatingBasicLogger.tracev(DelegatingBasicLogger.java:89)
    at org.hibernate.cfg.EJB3DTDEntityResolver.resolveEntity(EJB3DTDEntityResolver.java:59)
    at org.apache.xerces.util.EntityResolverWrapper.resolveEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.resolveEntity(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2155)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:2075)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:2054)
    at HibernateUtil.<clinit>(HibernateUtil.java:26)
    ... 1 more
Java Result: 1


The issue is due to Hibernate 4. So the solution is to delete the version of hibernate library that is > 4.0 and to replace with a smaller one. For example the hibernate 3.2 jars salved the above problem.