Ошибка LiveCycle / JBoss JNDI: не удалось создать экземпляр InitialContextFactory org.jnp.interfaces.NamingContextFactory
У меня есть Adobe LiveCycle ES4 Server, работающий на более старой версии JBoss на компьютере с Windows 7. На другом компьютере с Windows в той же сети я настроил клиент, работающий также на JBoss, но более новой версии (7.1.1). Используя пример кода, предоставленный Adobe, я пытаюсь проверить свое соединение через RMI, но у меня возникают ошибки. Вот трассировка стека:
09:53:18,369 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-5) HHH000230: Schema export complete
09:53:18,370 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016008: Starting weld service for deployment jboss-as-kitchensink-jsp.war
09:53:18,438 INFO [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /jboss-as-kitchensink-jsp
09:53:18,528 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018565: Replaced deployment "jboss-as-kitchensink-jsp.war" with deployment "jboss-as-kitchensink-jsp.war"
09:53:26,035 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) ALC-DSC-031-000: com.adobe.idp.dsc.net.DSCNamingException: Remote EJBObject lookup failed for ejb/Invocation provider
09:53:26,036 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(EjbMessageDispatcher.java:101)
09:53:26,037 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.doSend(EjbMessageDispatcher.java:141)
09:53:26,037 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:69)
09:53:26,038 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
09:53:26,038 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.livecycle.readerextensions.client.ReaderExtensionsServiceClient.invoke(ReaderExtensionsServiceClient.java:58)
09:53:26,039 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.livecycle.readerextensions.client.ReaderExtensionsServiceClient.applyUsageRights(ReaderExtensionsServiceClient.java:105)
09:53:26,040 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.as.quickstarts.kitchensinkjsp.servlet.AdobeServlet.applyUsageRights(AdobeServlet.java:118)
09:53:26,040 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.as.quickstarts.kitchensinkjsp.servlet.AdobeServlet.doPost(AdobeServlet.java:75)
09:53:26,041 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
09:53:26,041 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
09:53:26,042 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
09:53:26,043 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
09:53:26,043 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
09:53:26,044 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
09:53:26,044 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
09:53:26,045 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
09:53:26,046 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
09:53:26,046 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
09:53:26,047 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
09:53:26,047 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
09:53:26,048 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
09:53:26,048 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
09:53:26,049 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
09:53:26,049 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
09:53:26,050 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
09:53:26,051 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
09:53:26,051 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at java.lang.Thread.run(Unknown Source)
09:53:26,052 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) Caused by: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.jboss-as-kitchensink-jsp.war:main" from Service Module Loader
09:53:26,053 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
09:53:26,053 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
09:53:26,054 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
09:53:26,054 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.naming.InitialContext.init(Unknown Source)
09:53:26,055 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at javax.naming.InitialContext.<init>(Unknown Source)
09:53:26,055 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initJndiContext(EjbMessageDispatcher.java:228)
09:53:26,056 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.getJndiContext(EjbMessageDispatcher.java:241)
09:53:26,057 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(EjbMessageDispatcher.java:91)
09:53:26,057 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) ... 26 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();
}
}
2 ответа
Есть проблема, просто включите классы jboss-client в ваш путь к классам. В jboss 5 против jboss 4x их много. Но ЭТО работает. Моя конфигурация LC es4 в Linux и jboss 5.2, вызов удаленного из jboss 6 с клиентскими классами из jboss 5 с использованием Java API
Работает ли это с использованием SOAP?
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "http://113.252.20.43:80");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
Лично мне не удалось вызвать конечную точку EJB на удаленном сервере LiveCycle. Хотелось бы увидеть ваше решение, если оно у вас получится.
Надеюсь это поможет.