我在Sling / Felix中部署了两个OSGi包。
Bundle Core是Java代码(OSGi Services和Sling模型),Bundle UI仅包含使用Sling-initial-content在存储库中导入的JSP和JS代码。
首先部署Bundle A,例如注册服务,放置根URL以获取应用程序的图像:
[c.r.o.c.services.models.components.ImageComponentServiceImpl,1410] ServiceEvent REGISTERED
以下是具有属性的关联类:
@Component(metatype=true, label="Image component service", description="Service providing data to image components")
@Service(value = ImageComponentService.class)
public class ImageComponentServiceImpl extends AbstractModelService implements ImageComponentService {
@Property(label="Images root URL", description="URL to the web directory containing image files")
public static final String IMAGE_ROOT_URL = "image.root.url";
}
然后我在此服务的属性上添加一个值:
INFO c.r.o.c - Service [c.r.o.c.services.models.components.ImageComponentServiceImpl,1410] ServiceEvent UNREGISTERING
INFO c.r.o.c - Service [c.r.o.c.services.models.components.ImageComponentServiceImpl,1451] ServiceEvent REGISTERED
但是当我部署Bundle UI时,我得到了这个:
INFO o.a.s.i.p.jcr.impl.JcrInstaller - Removing resource from OSGi installer: [/apps/sling/install/c.r.o.c.services.models.components.ImageComponentServiceImpl.config]
INFO o.a.s.i.p.jcr.impl.JcrInstaller - Deleting WatchedFolder:/apps/sling/install, path does not exist anymore
INFO o.apache.sling.audit.osgi.installer - Deleted configuration c.r.o.c.services.models.components.ImageComponentServiceImpl from resource TaskResource(url=jcrinstall:/apps/sling/install/c.r.o.c.services.models.components. ImageComponentServiceImpl.config, entity=config:c.r.o.c.services.models.components.ImageComponentServiceImpl, state=UNINSTALL, attributes=[service.pid=c.r.o.c.services.models.components.ImageComponentServiceImpl, resource.uri .hint=c.r.o.c.services.models.components.ImageComponentServiceImpl], digest=5474257d3971e3f9a92ac39b2f2d4b69)
INFO c.r.o.c - Service [c.r.o.c.services.models.components.ImageComponentServiceImpl,1451] ServiceEvent UNREGISTERING
INFO c.r.o.c - Service [c.r.o.c.services.models.components.ImageComponentServiceImpl,1452] ServiceEvent REGISTERED
为什么要从其他捆绑包中删除配置?这些捆绑包一起工作但与Import / Export-Instructions无关。
我已将org.apache.sling.installer.provider.jcr更新为3.1.18,但它是一样的。
是否与https://issues.apache.org/jira/browse/SLING-4925 / https://issues.apache.org/jira/browse/SLING-4929有关?它需要更新Jackrabbit,我不确定现有内容是否容易。
答案 0 :(得分:1)
问题是UI Bundle正在部署JSP以添加自定义错误页面(404/403),如下所示:
<Sling-Initial-Content>
SLING-INF/content/apps/sling;overwrite:=true;uninstall=true
</Sling-Initial-Content>
因此,整个/ apps / sling目录被覆盖并删除了配置。
所以我改变了这一行并解决了问题:
<Sling-Initial-Content>
SLING-INF/content/apps/sling/servlet;path:=/apps/sling/servlet;overwrite:=true;uninstall=true
</Sling-Initial-Content>