cancel
Showing results for 
Search instead for 
Did you mean: 

Obscure error message with own JSP page

alr
Champ in-the-making
Champ in-the-making
Hello

again with a problem, I do not understand. Not a good day today I guess 🙂

First I try to explain my szenario again:
1. Wrote an own JSP Page, which only outputs the name property of a nodeID along with the content of a certain node
2. put it under the /jsp/ directory (which means you have to login anyway to access, if I got the navigation cases right)

Now when I access the JSP page and only output the name property, everything runs fine. If I add the part where I output the content of a node, I get the following error

This is basically my JSP


<f:view>

<h:outputText value="#{EditMediaDetailBean.name}" />

and

<h:outputText value="#{EditMediaDetailBean.defaultLanguage}" />

</f:view>

If  I comment out the last line it works, otherwise this is my error message:


javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/comnos/editMediaDetail.jsp][Class: javax.faces.component.html.HtmlOutputText,Id: _idJsp1]}
caused by:
org.apache.jasper.JasperException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/comnos/editMediaDetail.jsp][Class: javax.faces.component.html.HtmlOutputText,Id: _idJsp1]}
caused by:
javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /jsp/comnos/editMediaDetail.jsp][Class: javax.faces.component.html.HtmlOutputText,Id: _idJsp1]}
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{EditMediaDetailBean.defaultLanguage}'
caused by:
javax.faces.el.EvaluationException: Exception getting value of property defaultLanguage of base of type : com.comnos.alfresco.web.bean.EditMediaDetailBean
caused by:
javax.faces.el.EvaluationException: Bean: com.comnos.alfresco.web.bean.EditMediaDetailBean, property: defaultLanguage
caused by:
java.lang.reflect.InvocationTargetException
caused by:
org.alfresco.error.AlfrescoRuntimeException: Transaction must be active and synchronization is required: Thread[http-8080-Processor22,5,main]

The relevant code, which causes this exception is the following (nothing special)
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT)

This all leaves me with the conclusion, that I have missed something far before the transaction based code. However I have no idea right now, what it might be:


   <managed-bean>
      <description>Bean that manages media detail GUI</description>
      <managed-bean-name>EditMediaDetailBean</managed-bean-name>
      <managed-bean-class>com.comnos.alfresco.web.bean.EditMediaDetailBean</managed-bean-class>
      <!– <managed-bean-scope>request</managed-bean-scope> –>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>sessionBean</property-name>
         <value>#{SessionBean}</value>
      </managed-property>
    </managed-bean>

My SessionBean included some services like nodeService, searchService, permissionService, versionService, contentService, copyService, authenticationService, transactionService - but mostly to test if they were missing, I only need five of them actually.

So anyone has an idea what I've not looked consciously enough at?


Regards, Alexander
1 REPLY 1

alr
Champ in-the-making
Champ in-the-making
Hi all,

just for the record: The solution is pretty simple.

In order to be transactional safe, I just needed to define the complete ServiceRegistry instead of only a single NodeService in my SessionBean as a managed-property (in the faces configuration). After that, everything worked smooth.

BTW: Why is there a possibility to get a readOnly UserTransaction out of the TransactionService? When does that make sense?


–Alexander