<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Why doen't this SEAM injection work? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/why-doen-t-this-seam-injection-work/m-p/315472#M2473</link>
    <description>&lt;P&gt;I'm getting a null pointer for the stack value in the PushBESState method. See below&lt;/P&gt;
&lt;P&gt;Background:&lt;/P&gt;
&lt;P&gt;I'm attempting to implement a stack which will be available during a long running SEAM conversation. I want to be able to backtrack through the lifecycle states of a document and I'm using the stack to store the previous N states as Strings. The document moves through the lifecycle states and reveals, in the edit view, properties for editing based on the lifecycle state.&lt;/P&gt;
&lt;P&gt;I've built a simple push and pop automation operations which load and are called correctly. The backing bean was generated using the IDE as a SEAM service bean. I changed the Scope in that bean from event to CONVERSATION.&lt;/P&gt;
&lt;P&gt;The Stack itself is a standard Java stack extended to change the name only.&lt;/P&gt;
&lt;P&gt;I get an null pointer error on the stack reference when I try a PUSH a string onto this custom stack. I am injecting a reference to the stack into the push and pop automation operation classes . It seems the SEAM backing bean is not being initialized.&lt;/P&gt;
&lt;P&gt;Here is the backing bean code and the push and pop classes: The two log messages are never printed in the backing bean, the Push log message getting the previous state from the Document Model prints.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Name("bESStateStack") @Scope(ScopeType.CONVERSATION) public class BESStateStackBean implements Serializable {

private static final long serialVersionUID = 1L;

protected BESStateStack&amp;lt;String&amp;gt; bESStateStack;

private static final Log log = LogFactory.getLog(BESStateStackBean.class);

@Unwrap
public BESStateStack&amp;lt;String&amp;gt; getService() throws Exception {
    log.warn("Getting Service BESStateStackBean");
    if (bESStateStack == null) {
        log.warn ("Creating BESStateStackBean");
        bESStateStack = Framework.getService(BESStateStack.class);
    }
    return bESStateStack;
}

public BESStateStack&amp;lt;String&amp;gt; getbESStateStack() {
    return bESStateStack;
}

public void setbESStateStack(BESStateStack&amp;lt;String&amp;gt; bESStateStack) {
    this.bESStateStack = bESStateStack;
}

}

@Operation(id=PopBESState.ID, category=Constants.CAT_EXECUTION_STACK, label="PopBESState", description="") public class PopBESState {

public static final String ID = "PopBESState";

@In (value="#{bESStateStack}")
BESStateStack&amp;lt;String&amp;gt; stack;

private static final Log log = LogFactory.getLog(PopBESState.class);

@OperationMethod
public DocumentModel run(DocumentModel input) {
    try {
        String x = (String)stack.pop();
        log.warn("Stack pop state = "+ x);
        input.setProperty("bespreviousstate", "previousstate", x);
    } catch (ClientException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
  return input; 
}

}

@Operation(id=PushBESState.ID, category=Constants.CAT_EXECUTION_STACK, label="PushBESState", description="") public class PushBESState {

@In (value="#{bESStateStack}",create=true)
BESStateStack&amp;lt;String&amp;gt; stack;

public static final String ID = "PushBESState";

private static final Log log = LogFactory.getLog(PushBESState.class);

@OperationMethod
public DocumentModel run(DocumentModel input) {

   try {
       String x = (String)input.getProperty("bespreviousstate", "previousstate");
       log.warn("state = "+ x);
       stack.push(x);
} catch (ClientException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
   return input;

}

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Mar 2012 16:52:15 GMT</pubDate>
    <dc:creator>karl_harris_</dc:creator>
    <dc:date>2012-03-29T16:52:15Z</dc:date>
    <item>
      <title>Why doen't this SEAM injection work?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/why-doen-t-this-seam-injection-work/m-p/315472#M2473</link>
      <description>&lt;P&gt;I'm getting a null pointer for the stack value in the PushBESState method. See below&lt;/P&gt;
&lt;P&gt;Background:&lt;/P&gt;
&lt;P&gt;I'm attempting to implement a stack which will be available during a long running SEAM conversation. I want to be able to backtrack through the lifecycle states of a document and I'm using the stack to store the previous N states as Strings. The document moves through the lifecycle states and reveals, in the edit view, properties for editing based on the lifecycle state.&lt;/P&gt;
&lt;P&gt;I've built a simple push and pop automation operations which load and are called correctly. The backing bean was generated using the IDE as a SEAM service bean. I changed the Scope in that bean from event to CONVERSATION.&lt;/P&gt;
&lt;P&gt;The Stack itself is a standard Java stack extended to change the name only.&lt;/P&gt;
&lt;P&gt;I get an null pointer error on the stack reference when I try a PUSH a string onto this custom stack. I am injecting a reference to the stack into the push and pop automation operation classes . It seems the SEAM backing bean is not being initialized.&lt;/P&gt;
&lt;P&gt;Here is the backing bean code and the push and pop classes: The two log messages are never printed in the backing bean, the Push log message getting the previous state from the Document Model prints.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Name("bESStateStack") @Scope(ScopeType.CONVERSATION) public class BESStateStackBean implements Serializable {

private static final long serialVersionUID = 1L;

protected BESStateStack&amp;lt;String&amp;gt; bESStateStack;

private static final Log log = LogFactory.getLog(BESStateStackBean.class);

@Unwrap
public BESStateStack&amp;lt;String&amp;gt; getService() throws Exception {
    log.warn("Getting Service BESStateStackBean");
    if (bESStateStack == null) {
        log.warn ("Creating BESStateStackBean");
        bESStateStack = Framework.getService(BESStateStack.class);
    }
    return bESStateStack;
}

public BESStateStack&amp;lt;String&amp;gt; getbESStateStack() {
    return bESStateStack;
}

public void setbESStateStack(BESStateStack&amp;lt;String&amp;gt; bESStateStack) {
    this.bESStateStack = bESStateStack;
}

}

@Operation(id=PopBESState.ID, category=Constants.CAT_EXECUTION_STACK, label="PopBESState", description="") public class PopBESState {

public static final String ID = "PopBESState";

@In (value="#{bESStateStack}")
BESStateStack&amp;lt;String&amp;gt; stack;

private static final Log log = LogFactory.getLog(PopBESState.class);

@OperationMethod
public DocumentModel run(DocumentModel input) {
    try {
        String x = (String)stack.pop();
        log.warn("Stack pop state = "+ x);
        input.setProperty("bespreviousstate", "previousstate", x);
    } catch (ClientException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
  return input; 
}

}

@Operation(id=PushBESState.ID, category=Constants.CAT_EXECUTION_STACK, label="PushBESState", description="") public class PushBESState {

@In (value="#{bESStateStack}",create=true)
BESStateStack&amp;lt;String&amp;gt; stack;

public static final String ID = "PushBESState";

private static final Log log = LogFactory.getLog(PushBESState.class);

@OperationMethod
public DocumentModel run(DocumentModel input) {

   try {
       String x = (String)input.getProperty("bespreviousstate", "previousstate");
       log.warn("state = "+ x);
       stack.push(x);
} catch (ClientException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
   return input;

}

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2012 16:52:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/why-doen-t-this-seam-injection-work/m-p/315472#M2473</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-03-29T16:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why doen't this SEAM injection work?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/why-doen-t-this-seam-injection-work/m-p/315473#M2474</link>
      <description>&lt;P&gt;Did you have the seam.properties empty file in src/main/resources ?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 13:24:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/why-doen-t-this-seam-injection-work/m-p/315473#M2474</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-09-12T13:24:12Z</dc:date>
    </item>
  </channel>
</rss>

