1

因此,我正在尝试使用 JSP 和 JSTL 来构建 UI 以与 OSGi 环境一起使用。我已经添加了 JSTL 工作所需的包:-

我还在环境中添加了所有必需的捆绑包。最后,解决了以下依赖项,我最终添加了太多捆绑包,但我被困在某一点上。

我的一个捆绑包(我认为这是一个片段)还没有开始,它的依赖关系也没有得到解决。我得到的例外是: -

org.osgi.framework.BundleException: A fragment bundle cannot be started: com.springsource.org.apache.jasper_7.0.26 [107]

在这个例外之后,我还有一个例外:-

org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.jsp.jasper_1.0.0.v20070607 [117]" could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.jasper.servlet; version="0.0.0"

我已经安装了以下捆绑包列表,其中一些不是Active:-

id  State       Bundle
0   ACTIVE      org.eclipse.osgi_3.7.1.R37x_v20110808-1106
6   ACTIVE      org.eclipse.persistence.core_2.3.2.v20111125-r10461
10  ACTIVE      javax.persistence_2.0.3.v201010191057
12  ACTIVE      org.eclipse.persistence.antlr_2.3.2.v20111125-r10461
15  ACTIVE      org.eclipse.persistence.jpa.jpql_2.0.1.v20121003-ad44345
16  ACTIVE      org.eclipse.persistence.asm_2.3.2.v20111125-r10461
21  ACTIVE      org.eclipse.persistence.jpa_2.3.2.v20111125-r10461
25  ACTIVE      StockControlSystem_0.0.1
28  ACTIVE      javax.annotation_1.1.0.v201105051105
32  ACTIVE      org.springframework.core_3.0.5.RELEASE
33  ACTIVE      org.springframework.aop_3.0.5.RELEASE
34  ACTIVE      com.scs.request_1.0.0.qualifier
35  ACTIVE      org.eclipse.virgo.util.common_3.0.1.RELEASE
37  ACTIVE      com.scs.order_1.0.0.qualifier
38  ACTIVE      org.springframework.osgi.io_1.2.1
41  ACTIVE      mysql.jdbc_1.0.0
45  ACTIVE      com.springsource.org.apache.tomcat.api_7.0.26
47  ACTIVE      org.springframework.osgi.core_1.2.1
48  ACTIVE      com.springsource.org.apache.commons.logging_1.1.1
49  ACTIVE      com.springsource.org.eclipse.jdt.core.compiler.batch_3.6.1
53  ACTIVE      com.scs.persistence_1.0.0.qualifier
55  ACTIVE      com.scs.stockdetails_1.0.0.qualifier
58  ACTIVE      com.scs.delivery_1.0.0.qualifier
59  ACTIVE      org.springframework.beans_3.0.5.RELEASE
60  ACTIVE      org.springframework.context_3.0.5.RELEASE
66  ACTIVE      joda.time_1.0.0
67  ACTIVE      com.springsource.org.aopalliance_1.0.0
71  ACTIVE      javax.servlet_3.0.0.v201103241009
72  ACTIVE      com.springsource.org.apache.xmlcommons_1.3.4
73  ACTIVE      javax.el_2.2.0.v201105051105
74  ACTIVE      javax.servlet.jsp_2.2.0.v201103241009
75  ACTIVE      com.springsource.javax.servlet.jsp.jstl_1.2.0.v20110728
76  ACTIVE      org.eclipse.osgi.services_3.3.0.v20110513
78  ACTIVE      com.springsource.javax.xml.soap_1.3.0
80  RESOLVED    com.springsource.org.apache.coyote_7.0.26
                Master=83
81  ACTIVE      com.springsource.javax.activation_1.1.1
82  ACTIVE      com.springsource.javax.mail_1.4.0
83  ACTIVE      com.springsource.org.apache.catalina_7.0.26
                Fragments=80, 88, 95, 97
84  ACTIVE      com.springsource.javax.persistence_1.0.0
88  RESOLVED    com.springsource.org.apache.catalina.ha_7.0.26
                Master=83
92  ACTIVE      org.eclipse.virgo.util.parser.manifest_3.0.1.RELEASE
93  ACTIVE      com.springsource.org.apache.juli.extras_7.0.26
95  RESOLVED    com.springsource.org.apache.catalina.tribes_7.0.26
                Master=83
97  RESOLVED    com.springsource.org.apache.tomcat.util_7.0.26
                Master=83
100 ACTIVE      com.springsource.javax.ejb_3.0.0
101 ACTIVE      com.springsource.javax.xml.rpc_1.1.0.v20110517
102 ACTIVE      org.eclipse.equinox.util_1.0.300.v20110502
103 ACTIVE      org.eclipse.equinox.ds_1.3.0.v20110502
104 ACTIVE      com.springsource.slf4j.api_1.6.1
                Fragments=113
105 ACTIVE      org.eclipse.virgo.util.math_3.0.1.RELEASE
106 ACTIVE      org.eclipse.virgo.util.io_3.0.1.RELEASE
107 INSTALLED   com.springsource.org.apache.jasper_7.0.26
108 ACTIVE      com.springsource.javax.transaction_1.1.0
109 ACTIVE      org.eclipse.virgo.util.osgi_3.0.1.RELEASE
110 ACTIVE      org.eclipse.gemini.web.tomcat_2.0.2.RELEASE
111 ACTIVE      org.eclipse.gemini.web.core_2.0.2.RELEASE
112 ACTIVE      com.springsource.javax.xml.bind_2.1.7
113 RESOLVED    com.springsource.slf4j.nop_1.6.1
                Master=104
114 ACTIVE      com.springsource.javax.xml.stream_1.0.1
115 ACTIVE      org.eclipse.gemini.web.extender_2.0.2.RELEASE
116 ACTIVE      com.springsource.org.apache.el_7.0.26
117 INSTALLED   org.eclipse.equinox.jsp.jasper_1.0.0.v20070607

所以,你可以看到,Bundle 107-com.springsource.org.apache.jasper_7.0.26处于安装状态,我认为它包含捆绑Missing-Import包的equinox.jsp.jasper包 -Bundle 117

经过一番研究,我发现,我需要添加更多的包: -

  • catalina.osgi (5.5.23-SNAPSHOT)
  • jasper.osgi (5.5.23-SNAPSHOT)
  • com.springsource.org.apache.taglibs.standard (1.1.2)

其中,我找到了第三个捆绑包,但我找不到前两个捆绑包。

任何人都可以看到发生了什么。我在某个地方做错了吗?还是我错过了添加一些捆绑包?从过去 2 天开始,我一直被困在这个问题上,我认为,我绝不会解决这个问题。

我认为可能很重要的另一件事是,当我尝试启动我的Web APP捆绑包时,我收到了这些警告 - Bundle 25: -

Jan 18, 2013 11:06:30 AM org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd
Jan 18, 2013 11:06:30 AM org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/resources/javaee_5.xsd
Jan 18, 2013 11:06:30 AM org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/resources/javaee_6.xsd
Jan 18, 2013 11:06:30 AM org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/resources/xml.xsd
Jan 18, 2013 11:06:30 AM org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/resources/XMLSchema.dtd

还有一些类似这样的警告,但我已经跳过它们,因为太多了。

我已经添加了我认为需要的尽可能多的信息。但是,如果您需要更多信息,请同样询问。

4

2 回答 2

2

首先,片段永远无法启动,因为它们没有自己的生命周期。所以这并不是真正的错误;你只是不应该尝试开始一个片段。

其次,看起来 bundle 117 确实失败了,因为缺少 package 的导入org.apache.jasper.servlet,并且这个包可能来自无法解析的片段 107。因此,挑战在于找出 107 无法解决的原因。你可以通过输入命令来获得这方面的线索diag 107;这将打印片段的未满足导入列表。

于 2013-01-22T02:29:16.730 回答
0

这对您来说可能不愉快,但是如果您使用 Pax-Web 而不是 Gemini,它将立即与 jsp 一起使用。

Pax-Web 可以在http://www.google.de/url?sa=t&rct=j&q=pax%20web&source=web&cd=1&cad=rja&ved=0CDcQFjAA&url=http%3A%2F%2Fteam.ops4j.org%2Fwiki找到%2Fdisplay%2Fpaxweb%2FPax%2BWeb&ei=-WT6UITsL4mItQbw_IGICA&usg=AFQjCNFWWNAvM4nxEqoqVnlL14P3gt2aLw&sig2=Q7fVwc6mjMN68ErFbhTDEA&bvm=bv.41248874,d.Yms

在我看来,就像您正在构建一个完整的容器。曾经考虑过使用 Apache Karaf 或 Eclipse Virgo 吗?Karaf 也有一个最小的集合,只包含基础知识。

于 2013-01-19T09:19:52.137 回答