Skip to content

Commit

Permalink
Trying to sort broken OSGi config
Browse files Browse the repository at this point in the history
.. but not quite getting there. More work needed:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'interactionActivityFactory' defined in URL [bundleentry://84.fwk450287720/META-INF/spring/interaction-activity-context.xml]: Cannot resolve reference to bean 'interactionVelocity' while setting bean property 'interactionVelocity'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'interactionVelocity' defined in URL [bundleentry://84.fwk450287720/META-INF/spring/interaction-activity-context.xml]: Invocation of init method failed; nested exception is org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'ask'
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
  at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:200)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
  ... 14 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'interactionVelocity' defined in URL [bundleentry://84.fwk450287720/META-INF/spring/interaction-activity-context.xml]: Invocation of init method failed; nested exception is org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'ask'
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
  ... 26 more
Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'ask'
  at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
  at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
  at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
  at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
  at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:299)
  at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:358)
  at net.sf.taverna.t2.activities.interaction.velocity.InteractionVelocity.loadTemplates(InteractionVelocity.java:99)
  at net.sf.taverna.t2.activities.interaction.velocity.InteractionVelocity.checkVelocity(InteractionVelocity.java:61)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
  ... 33 more
  • Loading branch information
stain committed Jan 6, 2015
1 parent 2c85907 commit 2231a5f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
Expand Up @@ -35,7 +35,7 @@ public class InteractionRecorder {
static Map<String, Map<String, Set<String>>> runToInteractionMap = Collections
.synchronizedMap(new HashMap<String, Map<String, Set<String>>>());

public InteractionUtils interactionUtils;
private InteractionUtils interactionUtils;

private InteractionRecorder() {
super();
Expand Down Expand Up @@ -121,7 +121,7 @@ public void persist() {
}

private File getUsageFile() {
return new File(interactionUtils.getInteractionServiceDirectory(),
return new File(getInteractionUtils().getInteractionServiceDirectory(),
"usage");
}

Expand Down Expand Up @@ -152,4 +152,12 @@ public void load() {
}
}

public InteractionUtils getInteractionUtils() {
return interactionUtils;
}

public void setInteractionUtils(InteractionUtils interactionUtils) {
this.interactionUtils = interactionUtils;
}

}
Expand Up @@ -55,8 +55,6 @@ public class InteractionPreference {

private final Logger logger = Logger.getLogger(InteractionPreference.class);

private static InteractionPreference instance = null;

private final Properties properties;

private File getConfigFile() {
Expand All @@ -71,7 +69,8 @@ private File getConfigFile() {
return configFile;
}

private InteractionPreference() {
private InteractionPreference(ApplicationConfiguration appConfig) {
setAppConfig(appConfig);
final File configFile = this.getConfigFile();
this.properties = new Properties();
if (configFile.exists()) {
Expand Down
Expand Up @@ -29,7 +29,7 @@ public class InteractionVelocity {

public static Logger logger = Logger.getLogger(InteractionVelocity.class);

// private static boolean velocityInitialized = false;
private static boolean velocityInitialized = false;

private static final String TEMPLATE_SUFFIX = ".vm";

Expand All @@ -42,7 +42,10 @@ public class InteractionVelocity {

@SuppressWarnings("deprecation")
public synchronized void checkVelocity() {

if (velocityInitialized) {
return;
}
velocityInitialized = true;
ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "string");
ve.setProperty("resource.loader.class",
"org.apache.velocity.runtime.resource.loader.StringResourceLoader");
Expand Down
Expand Up @@ -12,9 +12,10 @@

<reference id="credentialManager" interface="net.sf.taverna.t2.security.credentialmanager.CredentialManager" />

<reference id="app-config"
interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
<reference id="applicationConfiguration"
interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />


<service ref="interactionRunDeletionListener" interface="net.sf.taverna.t2.workflowmodel.RunDeletionListener" />

</beans:beans>
</beans:beans>
Expand Up @@ -16,7 +16,7 @@
</bean>

<bean id="interactionUtils" class="net.sf.taverna.t2.activities.interaction.InteractionUtils">
<property name="appConfig" ref="app-config" />
<property name="appConfig" ref="applicationConfiguration" />
<property name="interactionRecorder" ref="interactionRecorder" />
<property name="interactionPreference" ref="interactionPreference" />
</bean>
Expand Down Expand Up @@ -50,12 +50,12 @@
</bean>

<bean id="interactionPreference" class="net.sf.taverna.t2.activities.interaction.preference.InteractionPreference">
<property name="appConfig" ref="app-config" />
<constructor-arg ref="applicationConfiguration" />
</bean>

<bean id="interactionVelocity"
class="net.sf.taverna.t2.activities.interaction.velocity.InteractionVelocity"
init-method="checkVelocity">
</bean>

</beans>
</beans>

0 comments on commit 2231a5f

Please sign in to comment.