尝试在JBoss上运行示例LiveCycle代码时出现RMI错误

时间:2013-11-22 14:07:30

标签: java jboss adobe rmi livecycle

我在Windows 7机器上的JBoss上运行Adobe LiveCycle ES4 Server。在同一网络中的另一台Windows机器上,我设置了一个也在JBoss上运行的客户端,但可能是更新的版本(7.1.1)。使用Adobe提供的示例代码,我试图通过RMI测试我的连接,但遇到了错误。这是堆栈跟踪:

14:57:40,226 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) Caused by: java.lang.ClassNotFoundException: org.jboss.proxy.ClientContainer from [Module "deployment.jboss-as-kitchensink-jsp.war:main" from Service Module Loader] (no security manager: RMI class loader disabled)
14:57:40,226 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
14:57:40,227 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
14:57:40,227 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
14:57:40,228 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
14:57:40,228 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
14:57:40,228 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
14:57:40,229 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readClassDesc(Unknown Source)
14:57:40,229 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
14:57:40,230 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readObject0(Unknown Source)
14:57:40,230 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
14:57:40,231 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readSerialData(Unknown Source)
14:57:40,231 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
14:57:40,231 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readObject0(Unknown Source)
14:57:40,232 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.io.ObjectInputStream.readObject(Unknown Source)
14:57:40,232 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at java.rmi.MarshalledObject.get(Unknown Source)
14:57:40,233 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
14:57:40,233 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:816)
14:57:40,234 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)   ... 29 more

这是我的代码:

protected void applyUsageRights() {

    try {

        //Set connection properties required to invoke LiveCycle                                 
        Properties connectionProps = new Properties(); 
        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://113.252.20.43:1099"); 
        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);           
        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); 
        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, MY_USER); 
        connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, MY_PASSWORD); 

        //Create a ServiceClientFactory object 
        ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps); 

        //Create a ReaderExtensionsServiceClient object 
        ReaderExtensionsServiceClient reClient = new ReaderExtensionsServiceClient(myFactory);  

        //Retrieve the PDF document to which to apply usage rights 
        FileInputStream fileInputStream = new FileInputStream("C:\\sample.pdf");  
        Document inputPDF = new Document(fileInputStream); 

        //Create a UsageRight object and specify specific usage rights 
        UsageRights useRight = new UsageRights();  
        useRight.setEnabledDynamicFormFields(true); 
        useRight.setEnabledComments(true); 
        useRight.setEnabledFormFillIn(true); 
        useRight.setEnabledDigitalSignatures(true); 

        //Create a ReaderExtensionsOptions object 
        ReaderExtensionsOptionSpec reOptions = new ReaderExtensionsOptionSpec();  

        //Set the usage rights  
        reOptions.setUsageRights(useRight);  
        reOptions.setMessage("This is a Rights-Enabled PDF Document"); 

        //Apply usage rights to a PDF document 
        Document rightsEnabledPDF = reClient.applyUsageRights( 
           inputPDF, 
           "RE2", 
          null, 
          reOptions);  

        //Create a new PDF file that represents the rights-enabled PDF document 
        File resultFile = new File("C:\\Adobe\\LoanUsageRights.pdf");  
        rightsEnabledPDF.copyToFile(resultFile); 

      }catch (Exception e) { 
           e.printStackTrace(); 
      }         
    }

谁能告诉我自己做错了什么?我知道我的客户端计算机可以访问LiveCycle服务器,因为我能够使用REST访问我在Workbench中创建的服务(只需将URL Workbench提供的内容剪切并粘贴到我的客户端计算机的浏览器中)。是因为我使用了错误的EJB端口吗?根据示例代码,1099是默认值,但我不确定如何检查它是否正确并且对JNDI了解不多。它与安全设置有关吗?

1 个答案:

答案 0 :(得分:1)

例外清楚地说'它找不到类' - org.jboss.proxy.ClientContainer。你肯定错过了所需的jboss-client.jar文件。请将其添加到类路径中。这个link有解决方案。希望这会有所帮助。