cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Bean Action problems

sergio
Champ in-the-making
Champ in-the-making
Hi.

I have created a new custom action as a Java class that implements the ActionExecuterAbstractBase as you suggest in the wiki documentation.

Then, I created a class to test the new action executer, extending the BaseSpringTest class, too.

The new action bean has been registered into the action-service-context.xml file in order to be loaded into Spring context….

The problem is: when executing the JUnit test class the following exception is raised:


10:01:51,421 ERROR [alfresco.action.UploadFolderCleanerActionExecuterTest] Setup error
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'deleteNodeAction' is defined
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:352)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:671)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:555)
   at it.nsi.microarray.alfresco.action.UploadFolderCleanerActionExecuterTest.onSetUpInTransaction(UploadFolderCleanerActionExecuterTest.java:68)
   at org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(AbstractTransactionalSpringContextTests.java:116)
   at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:192)
   at junit.framework.TestCase.runBare(TestCase.java:125)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

It seems not to find the bean named 'deleteNodeAction'….Why?

Taking a look at the BaseSpringTest class, I found that it tries to load any .xml configuration file from the alfresco classpath (isn't it), so I was supposing that even the action-service-context.xml file was loaded, and my action class, too. What was wrong?

Any help will be very appreciated….

All the best.

Sergio
2 REPLIES 2

tyve
Champ in-the-making
Champ in-the-making
Is this all information in the log? No Caused by… line?

andy
Champ on-the-rise
Champ on-the-rise
Hi

Where have you defined this xml file? Either the xml file with the bean definition it is not found or its replacement is broken somehow (and you are seeing the old one in preference). I would add "custom" to the front of the filename to rule this out, make sure it is in the extension directory and check the classpath (you can get this from the admin screen if you start your app without your changes).

Andy