cancel
Showing results for 
Search instead for 
Did you mean: 

Integration of new classes in alfresco

tiofelix
Champ in-the-making
Champ in-the-making
I would know how to integrate a new class for support new features in alfresco.

   I am trying to implement a new bean for auto-assigning incrementing numbers. Firstable i tried to run the simplest class in the world..

  

package org.soluziona;


class Prueba{

   private String pinta;
   
   public String getPinta() {
      return("Hello World");         
      }
   public void setPinta(String s) {
        System.out.println(s);   
      }
}

   And then make the soluziona.jar with this pakage inside. I placed this soluziona.jar within server/default/lib (JBoss server)

   I opened alfresco.war and modified faces-config-bean.xml adding this code:


<managed-bean>
    
      <managed-bean-name>prueba</managed-bean-name>
      <managed-bean-class>org.soluziona.Prueba</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
      <managed-property>
         <property-name>pinta</property-name>       
         <value></value>  
      </managed-property>
    </managed-bean>
  

Finally before save alfresco.war i added this line to the file details.jsp (within jsp/content/create-content-wizard/)

   This error appears when i try to create a new content:
javax.faces.FacesException: Cannot get value for expression '#{prueba.pinta}'

caused by:
org.apache.jasper.JasperException: Cannot get value for expression '#{prueba.pinta}'

caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{prueba.pinta}'

caused by:
javax.faces.FacesException: java.lang.IllegalAccessException: Class org.apache.myfaces.util.ClassUtils can not access a member of class org.soluziona.Prueba with modifiers ""

caused by:
java.lang.IllegalAccessException: Class org.apache.myfaces.util.ClassUtils can not access a member of class org.soluziona.Prueba with modifiers ""



  Am i forgetting something?? There is some easier way or some wiki where i can learn??Thanks.
2 REPLIES 2

tiofelix
Champ in-the-making
Champ in-the-making
I tried another thing too. I saved the soluziona.jar within alfresco.war and defined the bean in extension directory in the file prueba-context.xml
and without modify config-faces-bean.xml:


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <!– Registration of new bean –>   
    <bean id="prueba" class="org.soluziona.Prueba">
     <property name="pinta">
                <value>Beeeeee</value>
        </property>
    </bean>
         
</beans>

At this time the error is:

javax.faces.FacesException: Bean: org.soluziona.Prueba, property: pinta (not accessible!)

caused by:
org.apache.jasper.JasperException: Bean: org.soluziona.Prueba, property: pinta (not accessible!)

caused by:
javax.faces.el.PropertyNotFoundException: Bean: org.soluziona.Prueba, property: pinta (not accessible!)

Thanks again.

kevinr
Star Contributor
Star Contributor
Your class needs to be defined as public:

i.e.

class Prueba

should read:

public class Prueba

Thanks,

Kevin