AnsweredAssumed Answered

Java backend webscript e Spring

Question asked by mcodeluppi on May 27, 2011
Latest reply on May 30, 2011 by mturatti
Ciao a tutti.

Ho creato un nuovo webscript con java ma ho dei problemi sul caricamento delle property definite nel file spring dello script.
Per meglio capire:

nel mio file test-context.xml ho questa definizione:
<beans>
  <bean id="webscript.org.alfresco.xxxx.test.test.get"
        class="org.alfresco.xxxx.test.MyClass" parent="webscript">
    <property name="repository" ref="repositoryHelper"/>
   <property name="serviceRegistry" ref="ServiceRegistry" />
  </bean>
</beans>

e nella classe java ho:
….
    private ServiceRegistry serviceRegistry;

   public void setServiceRegistry (ServiceRegistry serviceRegistry) {
       this.serviceRegistry = serviceRegistry;
    }
…..
do logic etc etc
….

Il problema sorge quando viene eseguita questa linea di codice:

Collection<QName> coll = serviceRegistry.getServices();

Ottengo questa eccezione:
17:00:54,609  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 04270001 Wrapped Exception (with status template): null
org.springframework.extensions.webscripts.WebScriptException: 04270001 Wrapped Exception (with status template): null
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:758)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:383)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:352)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
   at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsupportedOperationException
   at org.alfresco.repo.service.ServiceDescriptorRegistry.getServices(ServiceDescriptorRegistry.java:112)
   at org.alfresco.xxxxx.test.MyClass.executeImpl(MyClass.java:44)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
   … 24 more


Dov'è l'errore?
La versione di alfresco che sto utilizzando è la 3.4 Enterprise Edition nella versione TRial

Ciao

Grazie

Marco

Outcomes