digital-preservation / droid

DROID (Digital Record and Object Identification)
BSD 3-Clause "New" or "Revised" License
284 stars 75 forks source link

BeanCreationException: Error creating bean with name 'dataSource' #16

Closed timrdf closed 8 years ago

timrdf commented 11 years ago

The following command causes a BeanCreationException. Is the problem in DROID or is it user error?

This is on a MacBook Pro 10.8.2 with java version 1.7.0_07.

Thanks, Tim Lebo

bash-3.2$ java -Xmx2048m -jar droid-binary-6.1-bin/droid-command-line-6.1.jar --profile-resources "`pwd`/droid-binary-6.1-bin" -p "`pwd`/droid-binary-6.1-bin.droid" 2>&1
2012-11-28 11:42:32,903  INFO Creating profile: 1354120952902
2012-11-28 11:42:32,925  INFO Attempting state change [INITIALISING] to [VIRGIN]
2012-11-28 11:42:32,925  INFO Starting profile: 1354120952902
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [META-INF/spring-jpa.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error the @annotation pointcut expression is only supported at Java 5 compliance level or above
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:405)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    at uk.gov.nationalarchives.droid.profile.SpringProfileInstanceFactory.getProfileInstanceManager(SpringProfileInstanceFactory.java:89)
    at uk.gov.nationalarchives.droid.profile.ProfileContextLocator.openProfileInstanceManager(ProfileContextLocator.java:178)
    at uk.gov.nationalarchives.droid.profile.ProfileManagerImpl.getProfileInstanceManager(ProfileManagerImpl.java:203)
    at uk.gov.nationalarchives.droid.profile.ProfileManagerImpl.start(ProfileManagerImpl.java:215)
    at uk.gov.nationalarchives.droid.command.action.ProfileRunCommand.execute(ProfileRunCommand.java:78)
    at uk.gov.nationalarchives.droid.command.DroidCommandLine.run(DroidCommandLine.java:116)
    at uk.gov.nationalarchives.droid.command.DroidCommandLine.main(DroidCommandLine.java:144)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error the @annotation pointcut expression is only supported at Java 5 compliance level or above
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:87)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:98)
    at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.findCandidateAdvisors(AnnotationAwareAspectJAutoProxyCreator.java:83)
    at org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator.shouldSkip(AspectJAwareAdvisorAutoProxyCreator.java:105)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessBeforeInstantiation(AbstractAutoProxyCreator.java:281)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:791)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:762)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:399)
    ... 17 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error the @annotation pointcut expression is only supported at Java 5 compliance level or above
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
    ... 37 more
Caused by: java.lang.IllegalArgumentException: error the @annotation pointcut expression is only supported at Java 5 compliance level or above
    at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:317)
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:206)
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:193)
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:174)
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:195)
    at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:250)
    at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:284)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:113)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:85)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:66)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:325)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1344)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    ... 46 more
Dclipsham commented 11 years ago

Hi Tim,

There are currently known compatibility issues with DROID and Java 7, and potentially 64 bit versions of Java 6. For now, please try using a version of Java 6 later than v22 (I believe the current version is v32). Hopefully this will resolve the immediate issue in lieu of a fix being implemented

timrdf commented 11 years ago

Great. Thanks for the pointers. May we leave this issue open until DROID can handle the newer versions of Java? Or, is it a duplicate of an existing?

Thanks, Tim

timrdf commented 11 years ago

I guess I can confirm that DROID 6.1 doesn't work on 64 bit unix. So, DROID doesn't work on any modern computer?

~/droid$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

:~/droid$ uname -a
Linux ... 2.6.32-28-vserver #55~ppa1-Ubuntu SMP Fri Feb 4 21:25:09 UTC 2011 x86_64 GNU/Linux

:~/droid$ java -Xmx2048m -jar droid-binary-6.1-bin/droid-command-line-6.1.jar    --profile-resources "`pwd`/droid-binary-6.1-bin" -p "`pwd`/droid-binary-6.1-bin.droid" --recurse 
12:49:24,689  INFO [main] ReflectionServiceFactoryBean:399 - Creating Service {http://pronom.nationalarchives.gov.uk}PronomServiceService from class uk.gov.nationalarchives.pronom.PronomService
12:49:25,220  INFO [main] ProfileManagerImpl:95 - Creating profile: 1354297765220
12:49:25,617  INFO [main] ProfileInstance:298 - Attempting state change [INITIALISING] to [VIRGIN]
12:49:25,619  INFO [main] ProfileManagerImpl:214 - Starting profile: 1354297765220
12:49:38,069  INFO [main] ProfileDiskAction:85 - Saving profile [~/.droid6/profiles/1354297765220/db] to [~/.droid6/profile_templates/schema 6.03/profile.63.template]
12:49:38,796  INFO [main] ProfileInstance:298 - Attempting state change [VIRGIN] to [RUNNING]
12:49:38,813 ERROR [pool-2-thread-1] JDBCExceptionReporter:101 - Data source is closed
12:49:38,816  INFO [pool-2-thread-1] ProfileInstance:298 - Attempting state change [RUNNING] to [FINISHED]
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction;
nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open
connection
ross-spencer commented 11 years ago

"So, DROID doesn't work on any modern computer?" - I'm not sure if that is entirely accurate... The testing list on this page suggests it should work on a number of platforms: http://digital-preservation.github.com/droid/

I think I recognize your problem and if you try running DROID a second time I think it will run correctly, it is to do with DROID needing to set up its initial environment, and it is trying to do something with something that isn't there first run.(I think). And should be related to this issue: https://github.com/digital-preservation/droid/issues/5

It does surprise me that it exists on Ubuntu still, but I think there is an awareness of needing to sort out various issues like this to make DROID work on all different platform variants consistently.

timrdf commented 11 years ago

Ross,

Thanks for taking the time to consider my issues with using DROID. I'm happy to follow any guidance that you are willing to offer.

I hadn't noticed the "tested" list, and I'm glad that there are so many.

I'd love to fit myself within the Mac OS X 10.8 (Mountain Lion) / Java 1.6.0_29-b11 category. However, I wasn't able to figure out how to get Java 1.6 installed on my machine (I have 1.7). I'm wondering if the tester in the configuration listed on that page could help me set up Java 1.6? From my searches on the web and in Apple Developer's internal site, I couldn't find any fruitful leads.

So, are you saying "just run the command again, it'll work"? It sure was the case (on ubuntu)!

myuser@:~/droid$ java -Xmx2048m -jar droid-binary-6.1-bin/droid-command-line-6.1.jar    --profile-resources "`pwd`/droid-binary-6.1-bin" -p "`pwd`/droid-binary-6.1-bin.droid" --recurse
16:10:53,605  INFO [main] ReflectionServiceFactoryBean:399 - Creating Service {http://pronom.nationalarchives.gov.uk}PronomServiceService from class uk.gov.nationalarchives.pronom.PronomService
16:10:54,148  INFO [main] ProfileManagerImpl:95 - Creating profile: 1354309854148
16:10:54,568  INFO [main] ProfileInstance:298 - Attempting state change [INITIALISING] to [VIRGIN]
16:10:54,570  INFO [main] ProfileManagerImpl:214 - Starting profile: 1354309854148
16:11:05,507  INFO [main] ProfileInstance:298 - Attempting state change [VIRGIN] to [RUNNING]
16:11:25,052  INFO [pool-2-thread-1] ProfileInstance:298 - Attempting state change [RUNNING] to [FINISHED]
16:11:25,103  INFO [main] ProfileManagerImpl:311 - Saving profile: 1354309854148 to /home/myuser/droid/droid-binary-6.1-bin.droid
16:11:26,271  INFO [main] ProfileInstance:298 - Attempting state change [FINISHED] to [SAVING]
16:11:26,335  INFO [main] ProfileDiskAction:85 - Saving profile [/home/myuser/.droid6/profiles/1354309854148] to [/home/myuser/droid/droid-binary-6.1-bin.droid]
16:11:27,090  INFO [main] ProfileInstance:298 - Attempting state change [SAVING] to [FINISHED]
16:11:27,090  INFO [main] ProfileManagerImpl:152 - Closing profile: 1354309854148

Unfortunately, this is not the case on MacOS 10.8 with Java 1.7. Still the Bean error. Any more help on that would be much appreciated.

Thanks!

Tim

ross-spencer commented 11 years ago

Ah OK, so as not to conflate issues, I think:

1) The Ubuntu error running Java 1.6 (Could not open JPA EntityManager for transaction) should allow DROID to run next time you try the command. (Fingers crossed for you anyway!)

2) The Mac OS 10.8 issue with Java 1.7 won't work because of Java 1.7 which I remember the binary wasn't compiled for. And although I tried myself, there's a number of third party libraries which cause complications compiling it for that version of Java.

While I don't work at TNA any more and don't have Mac OS I think the developer who had the Mac is still there and I think follows this list to may be able to offer you some advice if so...

I hope the clarification helps though. I wonder if it is worth asking the question of Mac OS on the Google Group in its own right?

timrdf commented 11 years ago

Ross,

Thanks for the clarification. It makes sense.

I acknowledge that my "Installing Java 1.6 on MacOS 10.8" is not directly related to DROID. Yes, I'll start a thread on Google Groups and hope The One at TNA -- or someone else -- notices ;-)

Regards, Tim

Dclipsham commented 11 years ago

Hi Tim,

I've found an update to install java 1.6._37 on OS X 10.7 and later - http://support.apple.com/kb/DL1572 - I hope this works....

David

beltramie commented 11 years ago

Hi everyone,

I too was encountering this problem when using DROID through the command line. I assumed it was caused by corruption in the files I was analyzing since it kept stalling on the same sets but not others.

I followed the suggestion by ross-spencer, kept re-running the analysis and eventually it was successful.

So possible causes: DROID is not starting properly?
The files do in fact have a corrupted element that is sometimes hanging up DROID but sometimes not?

Not sure how to narrow down the causes however.

Environment java version 1.6.0_37 Mac 10.7.5

Dclipsham commented 11 years ago

beltramie, If you are in a position to allow me to look at the files, please send them to pronom@nationalarchives.gsi.gov.uk

ghost commented 11 years ago

Believe this is fixed as a side-effect of changes in 6.1.3 - would be good to have confirmation!

alexgreenDP commented 8 years ago

Related to Java and DROID version compatibility issues. Contemporary versions of both shouldn't have this issue.