最近,我一直在尝试在XPages项目中设置和自定义scheduler。我尝试将以下代码片段放入我们的项目中:

import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator extends Plugin implements BundleActivator {

 @Override
    public void start(final BundleContext context) throws Exception {
       // Here you start your scheduler
    }

}


在模板的Code部分中,我可以轻松编写此代码,但是我没有关于未解决的依赖项的警告。因此,我认为org.eclipse.core.runtimeorg.osgi.framework软件包必须与Domino一起提供。

但似乎并非如此。

每当执行此代码时,都会在浏览器和堆栈中显示500 error,如下所示:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org.eclipse.core.runtime.Plugin
    at com.ibm.xsp.webapp.FacesServlet.handleError(FacesServlet.java:595)
    at com.ibm.xsp.webapp.FacesServlet.renderErrorPage(FacesServlet.java:424)
    at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:182)
    at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
    at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588)
    at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:865)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:808)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577)
    at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
    at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
    at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
    at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
    at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
    at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Caused by: java.lang.NoClassDefFoundError: org.eclipse.core.runtime.Plugin
    at java.lang.ClassLoader.defineClassImpl(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:346)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
    at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.findClass(ModuleClassLoader.java:455)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:850)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:829)
    at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.loadClass(ModuleClassLoader.java:403)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:809)
    at ru.lanit.egrz.scheduler.RefreshEGRZTokenExecutor.executeAndScheduleRefreshToken(RefreshEGRZTokenExecutor.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:508)
    at com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:322)
    at com.ibm.jscript.types.FBSObject.call(FBSObject.java:161)
    at com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197)
    at com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119)
    at com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139)
    at com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435)
    at com.ibm.jscript.JSExpression.access$1(JSExpression.java:424)
    at com.ibm.jscript.JSExpression$2.run(JSExpression.java:414)
    at java.security.AccessController.doPrivileged(AccessController.java:686)
    at com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:410)
    at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251)
    at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:234)
    at com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:222)
    at com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:111)
    at com.ibm.xsp.application.ActionListenerImpl.processAction(ActionListenerImpl.java:60)
    at javax.faces.component.UICommand.broadcast(UICommand.java:324)
    at com.ibm.xsp.component.UIEventHandler.broadcast(UIEventHandler.java:366)
    at com.ibm.xsp.component.UIDataPanelBase.broadcast(UIDataPanelBase.java:400)
    at com.ibm.xsp.component.UIViewRootEx.broadcast(UIViewRootEx.java:1535)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:307)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:428)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:94)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:96)
    at com.ibm.xsp.controller.FacesControllerImpl.execute(FacesControllerImpl.java:256)
    at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:227)
    at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
    at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:159)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
    at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.loadClass(ModuleClassLoader.java:359)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:809)
    ... 54 more


IBM确实一次又一次地吓我一跳(对此很抱歉)。

我试图在部分->仍然相同的情况下将其添加为外部jar。

我什至尝试将这两个添加到lib/ext->仍然相同。

在构建路径中,这两个作为插件依赖项包括在内。

从字面上看,我相信导入jar和解决Domino中的依赖项存在问题(甚至超出了此特定问题的范围)。

这是我关于IBM Domino的第三个问题,如果不是第四个问题。真令人尴尬,我向社会表示歉意,但请使我正确。在Domino中,您解决了一个问题,然后出现了另外两个问题。您可以解决这两个问题,然后再解决另外四个问题。等等

如何正确导入它而没​​有任何问题?

提前致谢

UPD

为了改善我的问题,我将添加一些代码

因此,bean看起来像这样:

SchedulerActivatorBean:

import java.io.Serializable;

public class SchedulerActivatorBean implements Serializable  {

    /**
     *
     */
    private static final long serialVersionUID = -3559937702716018697L;

    public static void activate() throws Exception
    {
        new SchedulerActivator().start(null);
    }

}


SchedulerActivator(OSGI插件):

import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;


public class SchedulerActivator extends Plugin implements BundleActivator {

     @Override
        public void start(final BundleContext context) throws Exception {
         // Here you start your scheduler
         QuartzScheduler.getInstance(); // starts the scheduler
        }

    }


然后,我对faces-config.xml进行了如下修改:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
  <managed-bean>
    <managed-bean-name>schedulerActivatorBean</managed-bean-name>
    <managed-bean-class>ru.lanit.egrz.scheduler.SchedulerActivatorBean</managed-bean-class>
    <managed-bean-scope>application</managed-bean-scope>
  </managed-bean>
</faces-config>


最后,我从SSJS调用bean:

 <xp:eventHandler event="onclick" submit="true"
    refreshMode="complete"
    action="#{javascript:schedulerActivatorBean.activate()}">
 </xp:eventHandler>


实例化了Bean,并在应用程序中将其可用。但是当我调用该方法时,我仍然得到:

Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
    at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.loadClass(ModuleClassLoader.java:359)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:809)
    ... 54 more


不用说,这让我毫无头绪

最佳答案

NSF中没有插件。您可能想先了解一下。将此用作入门:https://www.slideshare.net/fiorep/domino-osgi-development

您可能需要重新考虑整个方法。为什么不使用计划的Notes代理并刷新存储在NSF中的令牌。简单的问题解决了。

然后让您的XPage在NSF中查找值。节省您的整个头痛。

对于新用户,您可以使用XPages中的agent.run。诀窍是在NSF中存储。

使用阅读器字段来保护文档的安全,这样用户就不会看到彼此的令牌。

关于java - 引起原因:java.lang.ClassNotFoundException:org.eclipse.core.runtime.Plugin,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59184377/

10-11 08:20