开发者

Could not initialize class org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean

开发者 https://www.devze.com 2023-04-02 06:42 出处:网络
Using SpringSource Tool Suite 2.7.1, I see this error in Problems view for several XML files in an application I\'ve inherited (applicationContext.xml, osgi-context.xml, and module-context.xml for dif

Using SpringSource Tool Suite 2.7.1, I see this error in Problems view for several XML files in an application I've inherited (applicationContext.xml, osgi-context.xml, and module-context.xml for different projects):

Error occured processing '/video_service/src/main/webapp/WEB-INF/applicationContext.xml':
java.lang.NoClassDefFoundError: Could not initialize class org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.springframework.osgi.config.ReferenceBeanDefinitionParser.class$(ReferenceBeanDefinitionParser.java:68)
at org.springframework.osgi.config.ReferenceBeanDefinitionParser.getBeanClass(ReferenceBeanDefinitionParser.java:68)
at org.springframework.osgi.config.AbstractReferenceDefinitionParser.parseInternal(AbstractReferenceDefinitionParser.java:168)
at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
at org.springframework.ide.eclipse.beans.core.internal.model.namespaces.DelegatingNamespaceHandlerResolver$ElementTrackingNamespaceHandler.parse(DelegatingNamespaceHandlerResolver.java:177)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$ErrorSuppressingBeanDefinitionParserDelegate.parseCustomElement(BeansConfig.java:1293)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$2.registerBeanDefinitions(BeansConfig.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDe开发者_Python百科finitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$2.loadBeanDefinitions(BeansConfig.java:376)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$3.call(BeansConfig.java:422)
at org.springframework.ide.eclipse.beans.core.internal.model.BeansConfig$3.call(BeansConfig.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

The error appears at the line

<osgi:reference id="facade" interface="ru.focusmedia.odp.pshd.integration.Facade" />

and this interface looks like this:

public interface Facade {

    /**
     * register callback for {@link InputTriggerFact} 
     * @param callback
     */
    void addNotificationListener(InputCallback callback);
    void addNotificationListener(FBCallback callback);
    void addNotificationListener(UserCallback callback);
    void addNotificationListener(RoleCallback callback);

    /**
     * unregister callback for {@link InputTriggerFact}
     * @param callback
     */
    void removeNotificationListener(InputCallback callback);
    void removeNotificationListener(FBCallback callback);
    void removeNotificationListener(UserCallback callback);
    void removeNotificationListener(RoleCallback callback);

    /**
     * getting input by URL
     * @param url
     * @return
     */
    Input getInput(String url);

    /**
     * getting output by URL
     * @param url
     * @return
     */
    Output getOutput(String url);

    /**
     * @param input
     * @return current (last) value for input, may be null
     */
    Measure getCurrentValue(Input input);

    /**
     * request current value from input driver
     * where value is comming, fire InputTriggerFact to InputCallback
     * @param input
     */
    void refreshValue(Input input);

    /**  
     * @param input
     * @param from
     * @param to
     * @param limit
     * @return list of values for input by dates from - to range, may be null
     */
    List<InputTriggerFact> getValues(Input input, Date from, Date to, int limit);

    /**
     * setting value on output
     * @param output
     * @param value
     */
    public void setValue(Output output, Value<? extends Quantity> value);   
}

org.springframework.spring [3.0,3.1) is listed in Import Library section of MANIFEST.MF. I've tried adding org.springframework.osgi.service.importer.support directly to Import Package, but this doesn't help.

Strangely, this does not prevent application from running, but I suspect it might lead to other problems, so getting rid of these errors seems like a good idea. Is there anything I can do?


The message "NoClassDefFoundError: Could not initialize class XXX" is reporting that a previous class load attempt failed for class XXX. To diagnose this, you need to look for the stack trace for the earlier failure. It should include a nested exception for the problem that caused the original class initialization to fail.

The original problem occurred in the static initialization of XXX or some other class. The JVM specs say that the JVM will only attempt to run the class initialization for a class once. If it fails, the class and classes that depend on it are left in a failed state to prevent them being used. If application code (in this case Spring) then attempts to use the failed class by loading it (or some other class that depends on it) again, you will get this error.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号