Hi,
i write a componet for a Lifecycle ES2. This componet have a parameter PDFURI. This is the Uri to a PDF-File, it is save in the repository. This component is open this PDF with PDFbox - Library. I write this code to load the PDF from repository and open this to use it with PDFbox:
Properties connectionProps = new Properties();
connectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "jnp://localhost:1099");
connectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");
connectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
connectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "xxxxxx");
connectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "xxxxxx");
ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(myFactory);
String resourceUri = pdfFile;
Resource Doc = repositoryClient.readResource(resourceUri);
java.io.InputStream is = Doc.getContent().getDataDocument().getInputStream();
//java.io.InputStream is = new FileInputStream(pdfFile);
try{
PDFParser parser = new PDFParser(is);
parser.parse();
document = parser.getPDDocument();
if( document.isEncrypted() ){
try{
document.decrypt( "" );
}
catch( InvalidPasswordException e ){
System.err.println( "Error: Document is encrypted with a password." );
//System.exit( 1 );
}
}
I find this error at the Serverlog:
At line 80 is this:
Resource Doc = repositoryClient.readResource(resourceUri);
Have one an idea to this error? Or how can i open and load a file to use with PDFbox in a component?
Thanks
Holger Janssen
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Holger,
I believe the snippet you posted below is part of a DSC component which is deployed on a LC server and hence running within the LC server.With that in mind you can try this
The error is happening because you are probably packaging the adobe-repository-client.jar within your component. As this jar has the Resource class it causes a conflict with the call when it reaches the Repostory service as it also has this class packaged with it. To correct it
Also from within a DSC you need not provide all those details to ServiceClientFactory. Just use ServiceClientFactory.createInstance() and things should work for you
Views
Replies
Total Likes
Hi Holger,
I believe the snippet you posted below is part of a DSC component which is deployed on a LC server and hence running within the LC server.With that in mind you can try this
The error is happening because you are probably packaging the adobe-repository-client.jar within your component. As this jar has the Resource class it causes a conflict with the call when it reaches the Repostory service as it also has this class packaged with it. To correct it
Also from within a DSC you need not provide all those details to ServiceClientFactory. Just use ServiceClientFactory.createInstance() and things should work for you
Views
Replies
Total Likes
Hi Chetan,
it runs! Great !!! Thanks!!!
Holger
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies