一千萬個為什麽

搜索

Alfresco內容存儲庫API的副作用?

我正在學習Alfresco,特別是它的內容存儲庫Java API。

我正在嘗試使用SDK“First Foundation Client”中的示例進行訓練。

我拿了代碼,我設法處理了一下但是當我重新啟動我的露天服務器時,我得到了醜陋的堆棧跟蹤

ERROR [web.context.ContextLoader] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 03130001 Failed to initialise org.alfresco.enterprise.license.LicenseComponent
    at org.alfresco.repo.descriptor.DescriptorServiceImpl.constructSpecialService(DescriptorServiceImpl.java:301)
    at org.alfresco.repo.descriptor.DescriptorServiceImpl.access$100(DescriptorServiceImpl.java:51)
    at org.alfresco.repo.descriptor.DescriptorServiceImpl$1$1.execute(DescriptorServiceImpl.java:181)
    at org.alfresco.repo.descriptor.DescriptorServiceImpl$1$1.execute(DescriptorServiceImpl.java:179)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
    at org.alfresco.repo.descriptor.DescriptorServiceImpl$1.doWork(DescriptorServiceImpl.java:175)
    at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:514)
    at org.alfresco.repo.descriptor.DescriptorServiceImpl.onBootstrap(DescriptorServiceImpl.java:168)
    at org.alfresco.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:62)
    at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:77)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:75)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:246)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:617)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:355)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
    at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:69)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.alfresco.repo.descriptor.DescriptorServiceImpl.constructSpecialService(DescriptorServiceImpl.java:286)
    ... 42 more
Caused by: java.lang.NullPointerException
    at org.alfresco.repo.domain.NodePropertyValue.getValue(NodePropertyValue.java:986)
    at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.makeSerializableValue(HibernateNodeDaoServiceImpl.java:5371)
    at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.collapsePropertiesWithSameQNameAndListIndex(HibernateNodeDaoServiceImpl.java:5313)
    at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.convertToPublicProperties(HibernateNodeDaoServiceImpl.java:5155)
    at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.getNodeProperties(HibernateNodeDaoServiceImpl.java:1424)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.alfresco.repo.transaction.TransactionalDaoInterceptor.invoke(TransactionalDaoInterceptor.java:68)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.invoke(DirtySessionMethodInterceptor.java:419)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:163)
    at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy9.getNodeProperties(Unknown Source)
    at org.alfresco.repo.node.db.DbNodeServiceImpl.getPropertiesImpl(DbNodeServiceImpl.java:1292)
    at org.alfresco.repo.node.db.DbNodeServiceImpl.getProperties(DbNodeServiceImpl.java:1283)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy11.getProperties(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
    at $Proxy12.getProperties(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:179)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:179)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:218)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:218)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy11.getProperties(Unknown Source)
    at org.alfresco.repo.descriptor.RepositoryDescriptorDAOImpl.getDescriptor(RepositoryDescriptorDAOImpl.java:178)
    at org.alfresco.enterprise.license.LicenseComponent.(LicenseComponent.java:99)
    ... 47 more

我確切地說,當我退出我的露天並且重新啟動它時,我沒有遇到這個問題,只要我在服務器停止時不運行我的代碼。 !

這是一個已知的問題 ?谷歌對此並不是很健談(可能是我不能讓他說話)......

I work with Ubuntu 9.10 Karmic Koala

I've an official JDK jdk1.6.0_14

和服務器的 alfresco 3.2r Enterprise

EDIT reason ='add'

和SDK的 alfresco-community-sdk-3.3

我運行了其他測試(結果並不漂亮): - 原始示例運行良好但崩潰了我的服務器 - 運行“Daguerre調查”我刪除了所有行,以找出隱含的失敗

ApplicationContextHelper.getApplicationContext();

這是API使用的支柱......

如果有人有任何想法......

最佳答案

Add the end of you code do you do a System.exit(0);

這是我從Enterprise SDK示例中獲得的:

public static void main(String[] args)
    {
       //initialise app content 
        ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
       //get registry of services
        final ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);

       //use TransactionWork to wrap service calls in a user transaction
        TransactionService transactionService = serviceRegistry.getTransactionService();
        RetryingTransactionCallback exampleWork = new RetryingTransactionCallback() { public Object execute() throws Exception { doExample(serviceRegistry); return null; } }; transactionService.getRetryingTransactionHelper().doInTransaction(exampleWork); System.exit(0); } 

轉載註明原文: Alfresco內容存儲庫API的副作用?