Sounds like another regression :-(
Given the stack trace, it seems there is an exception that is swallowed by
the exception displayed, because of the call to close/destroy.
This may mean we need to enclose the applicationContext.destroy(); in a
try/catch block in the AbstractXBeanDeployer#deploy() method.
Could you try that ?

On Tue, Apr 1, 2008 at 2:56 PM, lhe77 <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I did what is described on the servicemix-drools wiki page to inject an
> additional bean.
> When deploying it to smx it throws exception:
>
>
> WARN  - AutoDeploymentService          - Directory: hotdeploy: Automatic
> install of
> /opt/apache-servicemix-3.3-SNAPSHOT/hotdeploy/cp-
> inputrouter-sa-1.0-SNAPSHOT.zip
> failed
> javax.jbi.management.DeploymentException: Failed to update Service
> Assembly:
> cp-inputrouter-sa
>        at
>
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateServiceAssembly
> (AutoDeploymentService.java:368)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(
> AutoDeploymentService.java:256)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory
> (AutoDeploymentService.java:658)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(
> AutoDeploymentService.java:62)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(
> AutoDeploymentService.java:622)
>        at java.util.TimerThread.mainLoop(Timer.java:512)
>        at java.util.TimerThread.run(Timer.java:462)
> Caused by: java.lang.Exception: <?xml version="1.0" encoding="UTF-8"?>
> <jbi-task xmlns="http://java.sun.com/xml/ns/jbi/management-message";
> version="1.0">
> <jbi-task-result>
> <frmwk-task-result>
> <frmwk-task-result-details>
> <task-result-details>
> <task-id>deploy</task-id>
> <task-result>FAILED</task-result>
> <message-type>ERROR</message-type>
> </task-result-details>
> </frmwk-task-result-details>
> </frmwk-task-result>
> <component-task-result
> xmlns="http://java.sun.com/xml/ns/jbi/management-message";>
>        <component-name>servicemix-drools</component-name>
>        <component-task-result-details>
>                <task-result-details>
>                        <task-id>deploy</task-id>
>                        <task-result>FAILED</task-result>
>                        <message-type>ERROR</message-type>
>                        <task-status-msg>
> <msg-loc-info>
> <loc-token/>
> <loc-message>Unable to deploy service unit</loc-message>
> </msg-loc-info>
> </task-status-msg>
>                        <exception-info>
>                                <nesting-level>1</nesting-level>
>                                <msg-loc-info>
>                                        <loc-token/>
>                                        <loc-message>BeanFactory not
> initialized or already closed - call 'refresh' before accessing beans via
> the ApplicationContext</loc-message>
>
> <stack-trace><![CDATA[java.lang.IllegalStateException: BeanFactory not
> initialized or already closed - call 'refresh' before accessing beans via
> the ApplicationContext
>        at
>
> org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory
> (AbstractRefreshableApplicationContext.java:121)
>        at
>
> org.springframework.context.support.AbstractApplicationContext.getLifecycleBeans
> (AbstractApplicationContext.java:912)
>        at
> org.springframework.context.support.AbstractApplicationContext.stop(
> AbstractApplicationContext.java:886)
>        at
> org.springframework.context.support.AbstractApplicationContext.doClose(
> AbstractApplicationContext.java:682)
>        at
> org.springframework.context.support.AbstractApplicationContext.close(
> AbstractApplicationContext.java:651)
>        at
> org.springframework.context.support.AbstractApplicationContext.destroy(
> AbstractApplicationContext.java:639)
>        at
> org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(
> AbstractXBeanDeployer.java:106)
>        at
> org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(
> BaseServiceUnitManager.java:88)
>        at
> org.apache.servicemix.common.BaseServiceUnitManager.deploy(
> BaseServiceUnitManager.java:69)
>        at
>
> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly
> (DeploymentService.java:508)
>        at
>
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateServiceAssembly
> (AutoDeploymentService.java:353)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(
> AutoDeploymentService.java:256)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory
> (AutoDeploymentService.java:658)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(
> AutoDeploymentService.java:62)
>        at
> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(
> AutoDeploymentService.java:622)
>        at java.util.TimerThread.mainLoop(Timer.java:512)
>        at java.util.TimerThread.run(Timer.java:462)
> ]]></stack-trace>
>                                </msg-loc-info>
>                        </exception-info>
>                </task-result-details>
>        </component-task-result-details>
> </component-task-result>
> </jbi-task-result>
> </jbi-task>
>
>        at
> org.apache.servicemix.jbi.framework.ManagementSupport.failure(
> ManagementSupport.java:125)
>        at
> org.apache.servicemix.jbi.framework.ManagementSupport.failure(
> ManagementSupport.java:111)
>        at
>
> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly
> (DeploymentService.java:543)
>        at
>
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateServiceAssembly
> (AutoDeploymentService.java:353)
>        ... 6 more
>
>
> The xbean:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns:drools="http://servicemix.apache.org/drools/1.0";
>       xmlns:cp="http://www.compart.net/ns/jbi";>
>
>  <drools:endpoint service="cp:inputRouter"
>                   endpoint="inEndpoint"
>                   namespaceContext="#nsContext"
>                   ruleBaseResource="classpath:router.drl"
>                   globals="#globals" />
>
>  <util:map id="globals">
>        <entry key="constants" value-ref="constants" />
>  </util:map>
>  <bean id="constants" class="ConstantsHelper" />
>
>  <drools:namespace-context id="nsContext">
>    <drools:namespaces>
>      <drools:namespace
> prefix="cp">http://www.compart.net/ns/jbi</drools:namespace>
>    </drools:namespaces>
>  </drools:namespace-context>
>
> </beans>
>
>
> The drl:
>
>
> package org.apache.servicemix.drools
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.apache.servicemix.drools.model.Exchange;
> import ConstantsHelper;
>
> global org.apache.servicemix.drools.model.JbiHelper jbi;
> global ConstantsHelper constants;
>
> rule UnkownOperation
>    when
>        me : Exchange( status == Exchange.ACTIVE, in : in != null,
>                       operation != 
> "{http://www.compart.net/ns/jbi}process<http://www.compart.net/ns/jbi%7Dprocess>
> "
> )
>    then
>        jbi.fault("<UnknownOperation
> xmlns='http://www.compart.net/ns/jbi'/ <http://www.compart.net/ns/jbi%27/>
> >");
> end
>
> rule ProcessInputAFP
>    when
>        me : Exchange( status == Exchange.ACTIVE, in : in != null,
>                       operation == 
> "{http://www.compart.net/ns/jbi}process<http://www.compart.net/ns/jbi%7Dprocess>
> "
> )
>        eval (isOfType(getFileName(me), "afp"))
>    then
>        jbi.getLogger().info("File " + getFileName(me) + " is of type
> AFP");
>        jbi.route("service:http://www.compart.net/ns/jbi/fileSender";);
> end
>
> function boolean isOfType(String fileName, String type) {
>    return fileName.toLowerCase().endsWith("." + type.toLowerCase());
> }
>
> function String getFileName(Exchange me) {
>    if (me.getIn().getProperty("user-props") != null) {
>        java.util.Map userProps =
> (java.util.Map)me.getIn().getProperty("user-props");
>        String fileName = userProps.get("file-name").toString();
>        if (fileName != null) {
>            return fileName;
>        } else {
>            return "";
>        }
>    } else {
>        return "";
>    }
> }
>
>
> The helper bean:
>
> public class ConstantsHelper
> {
>    public String getFileNameProperty()
>        {
>        return "file-name";
>        }
>
>    public String getUserPropertiesKeyProperty()
>        {
>        return "user-props";
>        }
> }
>
>
> I have no idea why the injection doesn't work. Any ideas?
>
> Regards,
> Lars
>
> --
> View this message in context:
> http://www.nabble.com/Error-injecting-bean-into-servicemix-drools-service-unit-tp16418402s12049p16418402.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Reply via email to