简体   繁体   English

如何在OSGi中找到类未找到问题的根本原因?

[英]How can I find the root cause for class not found issue, in OSGi?

I want to try some steps to fix ClassNotFound issue. 我想尝试一些步骤来解决ClassNotFound问题。 Im using Equinox/OSGI. 我正在使用Equinox / OSGI。 For example, im getting 例如,即时通讯

   java.lang.ClassNotFoundException: org.wso2.carbon.tomcat.ext.servlet.DelegationServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)

I tried, ss, ls -c, diag , b commands..but could not find any useful info from that. 我尝试了ss,ls -c,diag和b命令..但是找不到任何有用的信息。 I put the output of those commands.. 我把这些命令的输出。

Can anybody let me know, how can i go through such OSgi issues and how can i figure out the root cause for such issues.. 有人可以让我知道吗,我该如何处理此类OSgi问题,以及如何找出此类问题的根本原因。

#osgi> p org.wso2.carbon.tomcat.ext.servlet
org.wso2.carbon.tomcat.ext.servlet; version="4.2.0"<org.wso2.carbon.tomcat.ext_4.2.0 [421]>

#osgi> diag 421
reference:file:../plugins/org.wso2.carbon.tomcat.ext_4.2.0.jar [421]
  No unresolved constraints.

#osgi> b 421
org.wso2.carbon.tomcat.ext_4.2.0 [421]
  Id=421, Status=ACTIVE      Data Root=C:\Projects\scartch\chunk13\08_07_new\wso2am-1.7.1\repository\components\default\configuration\org.eclipse.osgi
\bundles\421\data
  "No registered services."
  Services in use:
    {org.wso2.carbon.user.core.service.RealmService, org.wso2.carbon.user.api.UserRealmService}={service.id=136}
    {org.wso2.carbon.tomcat.api.CarbonTomcatService}={service.id=130}
    {org.wso2.carbon.base.api.ServerConfigurationService}={service.id=103}
    {org.wso2.carbon.registry.core.service.RegistryService, org.wso2.carbon.registry.api.RegistryService}={service.id=143}
  Exported packages
    org.wso2.carbon.tomcat.ext.service; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.scan; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.valves; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.saas; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.utils; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.filter; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.realms; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.transport; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.servlet; version="4.2.0"[exported]
    org.wso2.carbon.tomcat.ext.transport.statistics; version="4.2.0"[exported]
  Imported packages
    org.wso2.carbon.utils.multitenancy; version="4.2.0"<org.wso2.carbon.utils_4.2.0 [454]>
    org.wso2.carbon.utils; version="4.2.0"<org.wso2.carbon.utils_4.2.0 [454]>
    org.wso2.carbon.user.core.tenant; version="4.2.0"<org.wso2.carbon.user.core_4.2.0 [449]>
    org.wso2.carbon.user.core.service; version="4.2.0"<org.wso2.carbon.user.core_4.2.0 [449]>
    org.wso2.carbon.user.api; version="1.0.1"<org.wso2.carbon.user.api_4.2.0 [448]>
    org.wso2.carbon.tomcat.api; version="4.2.0"<org.wso2.carbon.tomcat_4.2.0 [420]>
    org.wso2.carbon.tomcat; version="4.2.0"<org.wso2.carbon.tomcat_4.2.0 [420]>
    org.wso2.carbon.registry.core.service; version="1.0.1"<org.wso2.carbon.registry.core_4.2.0 [344]>
    org.wso2.carbon.registry.core.ghostregistry; version="1.0.1"<org.wso2.carbon.registry.core_4.2.0 [344]>
    org.wso2.carbon.registry.api; version="1.0.1"<org.wso2.carbon.registry.api_4.2.0 [341]>
    org.wso2.carbon.core.session; version="4.2.0"<org.wso2.carbon.core_4.2.0 [197]>
    org.wso2.carbon.core; version="4.2.0"<org.wso2.carbon.core_4.2.0 [197]>
    org.wso2.carbon.context; version="4.2.0"<org.wso2.carbon.utils_4.2.0 [454]>
    org.wso2.carbon.base.api; version="1.0.0"<org.wso2.carbon.base_4.2.0 [189]>
    org.wso2.carbon.base; version="1.0.0"<org.wso2.carbon.base_4.2.0 [189]>
    org.osgi.service.component; version="1.2.0"<org.eclipse.osgi.services_3.3.100.v20120522-1822 [132]>
    org.eclipse.osgi.framework.adaptor; version="0.0.0"<org.eclipse.osgi_3.8.1.v20120830-144521 [0]>
    org.eclipse.equinox.http.servlet; version="1.1.0"<org.eclipse.equinox.http.servlet_1.1.300.v20120522-1841 [102]>
    org.apache.tomcat.util.scan; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.tomcat.util.res; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.tomcat.util.file; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.tomcat; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.juli.logging; version="7.0.34"<tribes_7.0.34.wso2v1 [496]>
    org.apache.coyote; version="1.7.0"<org.wso2.carbon.tomcat.patch_4.2.0 [423]>
    org.apache.commons.logging; version="1.1.1"<org.wso2.carbon.logging_4.2.0 [287]>
    org.apache.catalina.valves; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.catalina.startup; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.catalina.realm; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.catalina.ha; version="1.7.0"<tomcat-ha_7.0.34.wso2v1 [495]>
    org.apache.catalina.core; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.catalina.connector; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.catalina; version="1.7.0"<tomcat_7.0.34.wso2v1 [494]>
    org.apache.axis2.clustering; version="1.6.1.wso2v10"<axis2_1.6.1.wso2v10 [13]>
    javax.servlet.http; version="2.6.0"<javax.servlet_3.0.0.v201112011016 [57]>
    javax.servlet; version="2.6.0"<javax.servlet_3.0.0.v201112011016 [57]>
  No fragment bundles
  Named class space
    org.wso2.carbon.tomcat.ext; bundle-version="4.2.0"[provided]
  No required bundles


#osgi> ls -c 421
Components in bundle org.wso2.carbon.tomcat.ext:
ID      Component details
139     Component[
        name = tomcat.ext.service.comp
        factory = null
        autoenable = true
        immediate = true
        implementation = org.wso2.carbon.tomcat.ext.internal.CarbonRealmServiceComponent
        state = Unsatisfied
        properties = {service.pid=tomcat.ext.service.comp}
        serviceFactory = false
        serviceInterface = null
        references = {
                Reference[name = user.realm.provider, interface = org.wso2.carbon.user.core.service.RealmService, policy = dynamic, cardinality = 1..1
, target = null, bind = setRealmService, unbind = unsetRealmService]
                Reference[name = registry.service.provider, interface = org.wso2.carbon.registry.core.service.RegistryService, policy = dynamic, cardi
nality = 1..1, target = null, bind = setRegistryService, unbind = unsetRegistryService]
        }
        located in bundle = org.wso2.carbon.tomcat.ext_4.2.0 [421]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      service.pid = tomcat.ext.service.comp
      component.name = tomcat.ext.service.comp
      component.id = 138
    Instances:
      org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@68c19d85
        Bound References:
        String[org.wso2.carbon.registry.core.service.RegistryService,org.wso2.carbon.registry.api.RegistryService]
                -> org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService@7f4cbc7d
        String[org.wso2.carbon.user.core.service.RealmService,org.wso2.carbon.user.api.UserRealmService]
                -> org.wso2.carbon.user.core.common.DefaultRealmService@6eaf3d6

140     Component[
        name = tomcat.service.comp
        factory = null
        autoenable = true
        immediate = true
        implementation = org.wso2.carbon.tomcat.ext.internal.CarbonTomcatServiceComponent
        state = Unsatisfied
        properties = {service.pid=tomcat.service.comp}
        serviceFactory = false
        serviceInterface = null
        references = {
                Reference[name = server.configuration.service, interface = org.wso2.carbon.base.api.ServerConfigurationService, policy = dynamic, card
inality = 1..1, target = null, bind = setServerConfigurationService, unbind = unsetServerConfigurationService]
                Reference[name = tomcat.service.provider, interface = org.wso2.carbon.tomcat.api.CarbonTomcatService, policy = dynamic, cardinality =
1..1, target = null, bind = setCarbonTomcatService, unbind = unsetCarbonTomcatService]
        }
        located in bundle = org.wso2.carbon.tomcat.ext_4.2.0 [421]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      service.pid = tomcat.service.comp
      component.name = tomcat.service.comp
      component.id = 139
    Instances:
      org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@2b2e6a26
        Bound References:
        String[org.wso2.carbon.base.api.ServerConfigurationService]
                -> org.wso2.carbon.base.ServerConfiguration@4c309c86
        String[org.wso2.carbon.tomcat.api.CarbonTomcatService]
                -> org.wso2.carbon.tomcat.internal.CarbonTomcat@b74487e

You diagnosed the plugin providing the class. 您诊断出提供该类的插件。 Looking at the requester might help as well. 查看请求者可能也会有所帮助。

In general troubleshooting OSGi class loading is hard. 通常,对OSGi类加载进行故障排除很困难。 Incompatible libraries versions and duplicated libraries are the most popular causes of ClassNotFoundException. 库版本不兼容和库重复是ClassNotFoundException的最常见原因。 So, looking for config changes around the time of the crash might give you some hints. 因此,在崩溃时寻找配置更改可能会给您一些提示。

Is the stack trace complete? 堆栈跟踪是否完整? If no you can paste the whole stack, might help. 如果否,则可以粘贴整个堆栈,可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM