Execution of the remote java code in JBoss ON fails with the message "Failure : cause - org.hibernate.LazyInitializationException: could not initialize proxy - no Session"

Solution Verified - Updated -

Issue

  • Execution of the remote java code in JBoss ON fails with the message Failure : cause - org.hibernate.LazyInitializationException: could not initialize proxy - no Session
  • Executing the following code fails with the could not initialize proxy - no Session message:

    myCriteria.fetchConditions(true);
    List<AlertDefinition> myAlertDefs = new ArrayList<AlertDefinition>();
    myAlertDefs = adm.findAlertDefinitionsByCriteria(subject, myCriteria);
    if(myAlertDefs.size()>0)
    {
        String name = null;
        for (AlertDefinition alertDefinition : myAlertDefs) {
            Iterator<AlertCondition> alertConditionsIterator = alertDefinition.getConditions().iterator();
            while(alertConditionsIterator.hasNext())
            {
                name = alertConditionsIterator.next().getMeasurementDefinition().getDisplayName();
            }
            ....
    
  • The error message is logged when the following line is executed:

    name = alertConditionsIterator.next().getMeasurementDefinition().getDisplayName();
    

Environment

  • Red Hat JBoss Operations Network (ON) 3.3
  • Red Hat JBoss ON Remote API 3.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In