I am a new bie to JBPM.
I have created bpmn file with a start ,diverge and two scripts and a converge and endtask.
MY code is
package com.sample;
import java.util.HashMap;
import java.util.Map;
import org.drools.KnowledgeBase;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.process.ProcessInstance;
public class ProcessTest {
public static void main(String[] args){
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newClassPathResource("sample.bpmn"),
ResourceType.BPMN2 );
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
Map<String,Object> params=new HashMap<String,Object>();
params.put("income", 1200);
ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello",params);
}
}
But i am getting the following error
org.drools.RuntimeDroolsException: invalid package name
at org.jbpm.compiler.ProcessBuilderImpl.buildProcess(ProcessBuilderImpl.java:175)
at org.jbpm.compiler.ProcessBuilderImpl.addProcessFromXml(ProcessBuilderImpl.java:254)
at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:564)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:608)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)
at com.sample.ProcessTest.main(ProcessTest.java:23)
[6,13]: [ERR 102] Line 6:13 mismatched input 'income' in rule "RuleFlow- Split-com.sample.bpmn.hello-2-3-DROOLS_DEFAULT"
[13,13]: [ERR 102] Line 13:13 mismatched input 'income' in rule "RuleFlow- Split-com.sample.bpmn.hello-2-4-DROOLS_DEFAULT"
[0,0]: Parser returned a null Package
ProcessLoadError: unable to parse xml : Exception class org.drools.RuntimeDroolsException : invalid package name
Exception in thread "main" java.lang.IllegalArgumentException: Could not parse knowledge.
at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilde rImpl.java:67)
at com.sample.ProcessTest.main(ProcessTest.java:26)
I have given package name com.sample in sample.bpmn
My sample.bpmn file is
Found the solution for this issue. This is related to config change in the Diverge gateway Constraints. For each constraint, try using **Type: code and Dialect: java. Also do not forget to put semicolon ; at the end of the statement in the Textual editor of each constraint. Best way to check this is to open the RF file in a text editor and validate the content.
Something like:
<constraints>
<constraint toNodeId="3" toType="DROOLS_DEFAULT" name="Flight" priority="1" type="code" dialect="java" >return income > 1000;</constraint>
<constraint toNodeId="4" toType="DROOLS_DEFAULT" name="Train" priority="1" type="code" dialect="java" >return income < 1000;</constraint>
</constraints>
Hope this will help.
Related
java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:970)
at java.base/java.util.Collections.max(Collections.java:713)
at io.cucumber.core.feature.FeatureParser.parseResource(FeatureParser.java:46)
at java.base/java.util.function.BiFunction.lambda$andThen$0(BiFunction.java:70)
at io.cucumber.core.resource.ResourceScanner.lambda$processResource$1(ResourceScanner.java:79)
at io.cucumber.core.resource.PathScanner$ResourceFileVisitor.visitFile(PathScanner.java:75)
at io.cucumber.core.resource.PathScanner$ResourceFileVisitor.visitFile(PathScanner.java:60)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2810)
at io.cucumber.core.resource.PathScanner.findResourcesForPath(PathScanner.java:53)
at io.cucumber.core.resource.PathScanner.findResourcesForUri(PathScanner.java:31)
at io.cucumber.core.resource.ResourceScanner.findResourcesForUri(ResourceScanner.java:61)
at io.cucumber.core.resource.ResourceScanner.scanForResourcesUri(ResourceScanner.java:134)
at io.cucumber.core.runtime.FeaturePathFeatureSupplier.loadFeatures(FeaturePathFeatureSupplier.java:62)
at io.cucumber.core.runtime.FeaturePathFeatureSupplier.get(FeaturePathFeatureSupplier.java:45)
at io.cucumber.junit.Cucumber.<init>(Cucumber.java:156)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:513)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
I have been doing many workarounds for couple of days but couldn't resolve this issue. Can anyone please help?
Below are the jars I used.
cucumber-core-7.10.1.jar
cucumber-expressions-16.1.1.jar
cucumber-extentsreport-3.1.1.jar
cucumber-gherkin-5.2.0.jar
cucumber-gherkin-messages-7.10.1.jar
cucumber-java-7.10.1.jar
cucumber-junit-7.10.1.jar
cucumber-jvm-deps-1.0.6.jar
cucumber-plugin-7.10.1.jar
cucumber-reporting-5.7.4.jar
datatable-7.10.1.jar
datatable-dependencies-3.0.0.jar
extentreports-3.1.2.jar
extentreports-cucumber7-adapter-1.2.0.jar
gherkin-5.2.0.jar
gherkin-jvm-deps-1.0.6.jar
hamcrest-2.2.jar
hamcrest-core-1.3.jar
junit-4.13.2.jar
selenium-java-4.7.2.jar
selenium-server-4.7.2.jar
tag-expressions-5.0.1.jar
This is my project folder structure
[folder-structure-image][1]
[1]: https://i.stack.imgur.com/abYF2.png
This is my runner file:
package com.qa.myrunner;
import java.io.*;
import org.junit.runner.RunWith;
import com.vimalselvam.cucumber.listener.Reporter;
import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(features = {"E:/Programming/LearnAutomation/SeleniumCucumberBDDV2/src/main/java/com/qa/features/SelectFlight.feature" },
glue = {"/SeleniumCucumberBDDV2/src/main/java/com/qa/stepDefinitions" },
monochrome = true,
dryRun = false)
public class SuiteRunner {
}
I upgraded ACS Commons version from 5.0.6 to 5.3.4 in my project and now can see most of the test classes failing with below error
org.junit.jupiter.api.extension.ParameterResolutionException: Failed to resolve parameter [io.wcm.testing.mock.aem.junit5.AemContext arg0] in method [void com.test.test.core.filters.LoggingFilterTest.doFilter(io.wcm.testing.mock.aem.junit5.AemContext) throws java.io.IOException,javax.servlet.ServletException]: Could not create io.wcm.testing.mock.aem.junit5.ResourceResolverMockAemContext instance.
at org.junit.jupiter.engine.execution.ExecutableInvoker.resolveParameter(ExecutableInvoker.java:232)
at org.junit.jupiter.engine.execution.ExecutableInvoker.resolveParameters(ExecutableInvoker.java:176)
at org.junit.jupiter.engine.execution.ExecutableInvoker.resolveParameters(ExecutableInvoker.java:137)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:118)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:184)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:180)
a
Caused by: org.reflections.ReflectionsException: Scanner TypeAnnotationsScanner was not configured
at org.reflections.Store.get(Store.java:39)
at org.reflections.Store.get(Store.java:61)
at org.reflections.Store.get(Store.java:46)
Please find below my test class. I am using JUnit version as below
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
<version>4.0.4</version>
<scope>test</scope>
</dependency>
Attaching the class below:
import java.io.IOException;
import java.util.List;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo;
import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest;
import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletResponse;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
import uk.org.lidalia.slf4jext.Level;
import uk.org.lidalia.slf4jtest.LoggingEvent;
import uk.org.lidalia.slf4jtest.TestLogger;
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
#ExtendWith(AemContextExtension.class)
class LoggingFilterTest {
private LoggingFilter fixture = new LoggingFilter();
private TestLogger logger = TestLoggerFactory.getTestLogger(fixture.getClass());
#BeforeEach
void setup() {
TestLoggerFactory.clear();
}
#Test
void doFilter(AemContext context) throws IOException, ServletException {
MockSlingHttpServletRequest request = context.request();
MockSlingHttpServletResponse response = context.response();
MockRequestPathInfo requestPathInfo = (MockRequestPathInfo) request.getRequestPathInfo();
requestPathInfo.setResourcePath("/content/test");
requestPathInfo.setSelectorString("selectors");
fixture.init(mock(FilterConfig.class));
fixture.doFilter(request, response, mock(FilterChain.class));
fixture.destroy();
List<LoggingEvent> events = logger.getLoggingEvents();
assertEquals(0, events.size());
}
}
Does anyone know why it is failing with the ACS Commons version change?
This is like breaking lot many junit test classes
I need some to help me with the below. I am having error each time i run this project. It launches the cmd but fail to run the test.
package Automation;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
public class FirstAppiumTest {
#Test
public void startappium () throws IOException, InterruptedException
{
Runtime.getRuntime().exec ("cmd /c start C:\\startappium.bat");
Thread.sleep(7000L);
File appDir=new File("src");
File app = new File(appDir,"app.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME,"Android Emulator");
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 100);
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver = new AndroidDriver (new URL ("http://127.0.0.1:4723/wd/hub"),cap);
driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
}
}
Here are the errors below.
FAILED: startappium
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;
at org.openqa.selenium.remote.ProtocolHandshake.streamW3CProtocolParameters(ProtocolHandshake.java:238)
===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
I appreciate your prompt reply. Thank you
I am new to Google app engine, and I'm working on a project. I just created an application and when I try to run it, it shows the error:
[ERROR] [ukstudentfeedback] Failed to load module 'ukstudentfeedback' from user agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2' at localhost:51937.
Below is a snap shot of my code:
package com.ukstudentfeedback.client;
import java.io.UnsupportedEncodingException;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
public class Ukstudentfeedback implements EntryPoint{
// ...
public void onModuleLoad()
{
java.lang.System.out.println("I finally worked!");
final Button sendButton;
final TextBox toField, fromField, subjectField, messageField;
sendButton = new Button("Send");
toField = new TextBox();
fromField = new TextBox();
subjectField = new TextBox();
messageField = new TextBox();
sendButton.addStyleName("sendButton");
toField.setText("Testing");
// Add the nameField and sendButton to the RootPanel
// Use RootPanel.get() to get the entire body element
RootPanel.get("sendButton").add(sendButton);
RootPanel.get("To").add(toField);
RootPanel.get("From").add(fromField);
RootPanel.get("Subject").add(subjectField);
RootPanel.get("Message").add(messageField);
// Focus the cursor on the to field when the app loads
toField.setFocus(true);
toField.selectAll();
sendButton.setEnabled(true);
// Create a handler for the sendButton and nameField
class MyHandler implements ClickHandler, KeyUpHandler {
/**
* Fired when the user clicks on the sendButton.
*/
public void onClick(ClickEvent event) {
java.lang.System.out.println("I have been clisked");
sendMessage();
}
#Override
public void onKeyUp(KeyUpEvent event) {
// TODO Auto-generated method stub
}
public void sendMessage()
{
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
/*
* Get all the user's inputs
*/
String to = toField.getText();
String from = fromField.getText();
String subject = subjectField.getText();
String message = messageField.getText();
try
{
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from, "Admin"));
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress(to, "Mr. User"));
msg.setSubject(subject);
msg.setText(message);
Transport.send(msg);
}
catch (AddressException e)
{
// ...
} catch (MessagingException e)
{
// ...
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
// Add a handler to send the name to the server
MyHandler handler = new MyHandler();
sendButton.addClickHandler(handler);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='ukstudentfeedback'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name='com.ukstudentfeedback.Ukstudentfeedback'/>
<!-- Specify the app entry point class. -->
<entry-point class='com.ukstudentfeedback.client.Ukstudentfeedback'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
</module>
Errors:
[DEBUG] [ukstudentfeedback] - Validating newly compiled units
[TRACE] [ukstudentfeedback] - Finding entry point classes
[ERROR] [ukstudentfeedback] - Errors in 'file:/Users/umajosiah/Programming/Java/eclipse/workspace/ukstudentfeedback/src/com/ukstudentfeedback/client/Ukstudentfeedback.java'
[ERROR] [ukstudentfeedback] - Line 8: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 9: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 10: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 11: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 12: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 13: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 14: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 80: Session cannot be resolved to a type
[ERROR] [ukstudentfeedback] - Line 80: Session cannot be resolved
[ERROR] [ukstudentfeedback] - Line 91: Message cannot be resolved to a type
[ERROR] [ukstudentfeedback] - Line 91: MimeMessage cannot be resolved to a type
[ERROR] [ukstudentfeedback] - Line 92: InternetAddress cannot be resolved to a type
[ERROR] [ukstudentfeedback] - Line 93: Message cannot be resolved
[ERROR] [ukstudentfeedback] - Line 94: InternetAddress cannot be resolved to a type
[ERROR] [ukstudentfeedback] - Line 97: Transport cannot be resolved
[ERROR] [ukstudentfeedback] - Line 100: AddressException cannot be resolved to a type
[ERROR] [ukstudentfeedback] - Line 103: MessagingException cannot be resolved to a type
[ERROR] [ukstudentfeedback] - Unable to find type 'com.ukstudentfeedback.client.Ukstudentfeedback'
[ERROR] [ukstudentfeedback] - Hint: Previous compiler errors may have made this type unavailable
[ERROR] [ukstudentfeedback] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] [ukstudentfeedback] - Failed to load module 'ukstudentfeedback' from user agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2' at localhost:51937
The problem is that you're trying to use unimplemented java classes on the client. The mailing needs to happen from the server, and the server can never pass back anything from the javax.mail classes.
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
None of this is serializable, and none of it can be turned to Javascript, because none of it is implemented by GWT. Read more about this here and here.
You can use only the classes that are emulated by GWT. Package javax.mail is not emulated.
You have to do this on the server.
[ERROR] [ukstudentfeedback] - Line 8: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 9: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 10: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 11: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 12: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 13: The import javax.mail cannot be resolved
[ERROR] [ukstudentfeedback] - Line 14: The import javax.mail cannot be resolved
Pls see link below:
http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html
I'm using iText library to work with Acrobat Forms. The servlet compiled without any errors. I imported the external jar files of iText. After compiling, i packaged and prepared an executable .war file (Main.war) and pasted it in the deploy folder of jboss. However, on executing, i get a ClassNotFoundException Error.
Here's the stack trace
java.lang.ClassNotFoundException: com.itextpdf.text.DocumentException from BaseClassLoader#955d1c{VFSClassLoaderPolicy#13ed0e{name=vfszip:/E:/jboss-5.0.1.GA/server/default/deploy/Main.war/ domain=Clas
sLoaderDomain#1074641{name=vfszip:/E:/jboss-5.0.1.GA/server/default/deploy/Main.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=ClassLoaderDomain#dc9766{DefaultDomain}} roots=[MemoryContextHandler#3161
723[path= context=vfsmemory://5c4o12z-o9ytfs-grndwcq5-1-grndwom8-1y real=vfsmemory://5c4o12z-o9ytfs-grndwcq5-1-grndwom8-1y], ZipEntryHandler#22421558[path=Main.war/WEB-INF/classes context=file:/E:/jbo
ss-5.0.1.GA/server/default/deploy/ real=file:/E:/jboss-5.0.1.GA/server/default/deploy/Main.war/WEB-INF/classes]] delegates=null exported=[] <IMPORT-ALL>NON_EMPTY}}
at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:422)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:258)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
And here's my servlet code -
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.AcroFields;
import com.itextpdf.text.pdf.FdfReader;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import java.io.*;
import java.net.*;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Main extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("application/pdf");
try{
FdfReader FDF = new FdfReader(request.getInputStream());
System.out.println("*************Recieved inputStream***********");
InputStream is = request.getInputStream();
PdfReader reader = new PdfReader(is, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfStamper stamper = new PdfStamper(reader, baos);
AcroFields fields = stamper.getAcroFields();
fields.setFields(FDF);
stamper.setFormFlattening(true);
stamper.close();
OutputStream os = response.getOutputStream();
baos.writeTo(os);
os.flush();
}
catch (DocumentException DE)
{
throw new IOException(DE.getMessage());
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
Can anyone tell me what's the problem????? Its urgent please..
Sameer
Looks like a DocumentException would be thrown, but the corresponding class can not be found by JBoss.
Are you sure that the iText .jar gets packaged with your webapp? Maybe have a look at the .WAR file you're deploying and check if the iText library is in there...
If not (or you don't want to) make sure to put it in the JBoss' lib folder. in /jboss-as/lib/ or /jboss-as/server/default/lib/.
Edit:
Your JAR should end up having a structure that looks about like this
.
|-- index.html
|-- META-INF
| `-- MANIFEST.MF
|
`-- WEB-INF
|-- classes
| `-- <your code is here>
|
`-- lib
`-- <here are your packaged .jar files>
[Mind, this is simplified and does not show all the files...]