Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Problem with JBoss and Servlets

Avatar

Former Community Member
I have 2 questions that are related. I'd appreciate it if anyone can address either or both questions...



(1) We installed the turnkey LiveCycle ES on a windows box with JBoss. Ih ave built a servlet that will invoke a renderPDF orchestration and show a PDF. I followed the sample given at: http://www.adobe.com/devnet/livecycle/articles/java_servlets.html

When deploying and attempting to test on the LC ES server, I am getting 404 errors. I decided to see if JBoss was up and running normally and I went to http://localhost:8080/ and see a JBoss page with JBoss Onlien REsources links at the top and JBoss Management links at the bottom. The links go to Tomcat Status, JMX Console and JBoss Web Console. All 3 links at the bottom return 404 error messages. Workspace works just fine on this machine. Web Service calls also work fine. What could be wrong?



(2) I decided that since the app server on the LC ES server was malfunctioning, I would install TomCat on my desktop and then just run the servlet with remote calls to the livecycle server. I am getting error messages in the logs "stdout_20080919.log" saying that I have a java.lang.IllegalStateException. I set up the connection properties to include the full server name, not just localhost, so it looked like: jnp://servername:1099.



Any help would be greatly appreciated.
7 Replies

Avatar

Level 10
I think your appserver is fine in (1). You'll get a 404 error for the JMX Console and possibly the other links (under :8080/) because we've removed those modules for security reasons.



Now to make sure the service is running fine can you try to hit the wsdl. The url is typically http://localhost:8080/soap/services/NameOfService?wsdl.



Now are you packaging your servlet in a war file? The typical URL would be http://localhost:8080/NameOfWar/NameofClass.



My guess is the project is not packaged properly.



Jasmin

Avatar

Former Community Member
Hi Jasmin,

The WSDL works just fine. I have also started "recording" of the process in workbench but it is never invoked via the servlet. I did in fact package the servlet in a war file and used the typical URL as you describe above. I am using eclipse to build and package the servlet. Should I post the log results or my java code?

Avatar

Former Community Member
UPDATE

I changed the package and made sure the libraries were included. I still can't get it to work on my desktop, but I redeployed to the LC ES server and it definitely invoked the process. I see it in the playback. And I can see the output PDF document during the playback. Unfortunately, in the browser, I don't see anything but a blank screen. No PDF.



Thoughts?

Avatar

Former Community Member
CODE BELOW:



import java.io.IOException;

import java.io.InputStream;

import java.util.HashMap;

import java.util.Map;

import java.util.Properties;



import javax.servlet.ServletException;

import javax.servlet.ServletOutputStream;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;



import com.adobe.idp.Document;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;

import com.adobe.idp.dsc.clientsdk.ServiceClient;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;

import com.adobe.idp.dsc.InvocationRequest;

import com.adobe.idp.dsc.InvocationResponse;

import com.adobe.livecycle.formsservice.client.FormsResult;



/**

* servlet implementation class for Servlet: TestGetForm2

*

*/

public class testGetForm2 extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {

static final long serialVersionUID = 1L;



public testGetForm2() {

super();

}



/* (non-Java-doc)

* @see javax.servlet.http.HttpServlet#HttpServlet()

*/



/* Just calls the doPost method. EJC 09/18/08

* @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException

{

doPost(request,response);

}



/* (non-Java-doc)

* @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)

*/

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

try{

String lanIDConst = "XXXXXX";

Properties connectionProps = new Properties();

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT,"jnp://servername:1099");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "xxxxxxx");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "xxxxxxx");



//Create a ServiceClientFactory object

ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);



//Create a ServiceClient object

ServiceClient myServiceClient = myFactory.getServiceClient();



//Create a MAP object to store the parameter value

Map params = new HashMap();



//Populate the Map object with a parameter value

//required to invoke the TestServlet process

params.put("lanID", lanIDConst);



//Create an Invocation request object

//the last argument is set to true because this is a short-lived process

InvocationRequest esRequest = myFactory.createInvocationRequest("TestServletRenderPDF", "invoke", params, true);



//Send the invocation request to the process and get back an invocation response object

InvocationResponse esResponse = myServiceClient.invoke(esRequest);

FormsResult formOut = (FormsResult)esResponse.getOutputParameter("outFormDoc");



//Create a document object that stores form data

Document myData = formOut.getOutputContent();



//Get the content type of the response and set the HttpServletResponse objects content type

String contentType = myData.getContentType();

response.setContentType(contentType);



//Create a ServletOutputStream object

ServletOutputStream oOutput = response.getOutputStream();



//Create an InputStream object

InputStream inputStream = myData.getInputStream();



//Get the size of the InputStream object

int size = inputStream.available();



//Create and populate a byte array

byte[] data = new byte[size];

inputStream.read(data);



//Write the data stream to the web browser

oOutput.write(data);

}catch (Exception e){

e.printStackTrace();

}

}

}

Avatar

Level 10
What's the value of the "size" and "contentType" variable in your code?



Jasmin

Avatar

Former Community Member
Hi Jasmin, thanks for your reply. I'm getting closer to a solution.



It's choking on the line FormsResult formOut = (FormsResult)esResponse.getOutputParameter("outFormDoc");



I double checked my process and the output variable "outFormDoc" is not set to variable type "FormsResult". It was set to "Document". When I change the variable type to "FormsResult", it crashes in the process in the Render Form (renderPDFForm) activity when I assign the outFormDoc variable. It says "invalid location: /process_data/@outFormDoc cannot be stored for action instance -1"



My settings for the renderPDFForm activity are:

Input:

Form to Render -literal value = "/POC/getHRInfo.xdp"

Form Data = blank (no data to merge)

Stand Alone Rendition = True

Form Model = Client

Application WEb Root = Blank

Target URL = Blank

Content URI = repository://

Base URL = Blank

Output:

Forms Result = /process_data/@outFormDoc where outFormDoc is of type FormsResult



Thanks for your help!

Avatar

Former Community Member
IT'S WORKING



I changed the output Forms Result to a "variable" instead of "XPath expression" and it works just fine now.

Thanks for your help Jasmin!