java.net.SocketException: Unexpected end of file from server - java

I am using a servlet which passes a String parameter to another Servlet in another remote system, to get xml response from that remote servlet.
This works fine when i tried to connect to that remote Servlet from my local PC.
But I am getting the error java.net.SocketException: Unexpected end of file from server when I execute same from another server.
Error:
2011-06-04 11:27:24,305 INFO [STDOUT] strURL in Inventry --> http://1**.1**.**.27:7777/GatewayServlet
/Status?Str=Inventory&PARTNUM=200A104%27%2C%27200A112%27%2C%27200A114%27%2C%27200A113%27%2C%27200A117%27%2C%27200A120%27%2C%27240A503%27%2C%27200A132%27%2C%27200A128%27%2C%27200A124
2011-06-04 11:28:06,243 ERROR [STDERR] java.net.SocketException: Unexpected end of file from server
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at com.cim.web.servlet.DBGatewayServiceServlet.processRequest(DBGatewayServiceServlet.java:52)
2011-06-04 11:28:06,243 ERROR [STDERR] at com.cim.web.servlet.DBGatewayServiceServlet.doGet(DBGatewayServiceServlet.java:113)
2011-06-04 11:28:06,243 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
2011-06-04 11:28:06,243 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2 011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
2011-06-04 11:28:06,243 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
Code in My Servlet (client):
if(queryString.equals("Inventory")) {
String partNum = (String)session.getAttribute("PARTNUM");
String locId = (String)session.getAttribute("locids");
strURL = strURL+"/InventoryStatus?queryStr=Inventory&PARTNUM="+partNum;
URLConnection dbGatewayURL = new URL(strURL).openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(dbGatewayURL.getInputStream()));//--This is line 52 Mentioned in Error above
StringBuffer responseData = new StringBuffer();
String line="";
while((line = in.readLine()) != null) {
responseData.append(line);
}
String result =responseData.toString();
request.setAttribute("inventryStock",result);
RequestDispatcher rd=request.getRequestDispatcher ("inventryStatus.jsp?resp=Yes");
rd.forward(request, response);
}

Try to telnet to the remote servlet from your server and see whether it connects as expected. If it is not, then that's a connectivity issue.
If it does, try to use a TCP Monitor to see the HTTP traffic that goes from your server to the remote server which has the servlet. http://ws.apache.org/commons/tcpmon/

try to wait() immediately after
URLConnection dbGatewayURL = new URL(strURL).openConnection();
It is possible the program moved to the next line before it was able to make the connection

There was nothing wrong with the code but the thing was the remote server wasn't listening to the connection from my server, hence i tried the same code but on another remote server this time and its working fine....! any body know the reason............?

Related

http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd returning 301

My application is running on java 7/ jboss 5.2.
I am using drools 5.3 and loading my rules from guvnor 5.3.
Starting this morning I am getting an error loading a ChangeSet from guvnor, confirmed the application was working fine yesterday.
The changeset XML is loading fine but I believe the schema validator is trying to load the schema. Which has the XSD URL http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd.
This URL is returning a 301 status code and Location header of
Location: https://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd.
The https url load fine in a browser but I believe the code is ignoring the redirect and trying to load the XSD from the response and throwing a org.xml.sax.SAXParseException: Premature end of file as the response body is blank.
I was able to work around the problem using -Ddrools.schema.validating=false but I could not find much documentation on this option and what it is doing.
Is there a way to get the XML parser to follow the redirect or a change I can make to guvnor to use the correct XSD?
Stack Trace:
10:28:16,573 ERROR [STDERR] java.lang.RuntimeException: Unable to parse ChangeSet
10:28:16,574 ERROR [STDERR] at org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:432)
10:28:16,574 ERROR [STDERR] at XXX.interactive.rules.RuleAgentManagerGuiImpl.createKnowledgeAgent(RuleAgentManagerGuiImpl.java:192)
10:28:16,574 ERROR [STDERR] at XXX.interactive.rules.RuleAgentManagerGuiImpl.init(RuleAgentManagerGuiImpl.java:131)
10:28:16,574 ERROR [STDERR] at XXX.RuleAgentManagerGuiImpl.initialize(RuleAgentManagerGuiImpl.java:70)
10:28:16,574 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:28:16,574 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
10:28:16,574 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.__invoke(DelegatingMethodAccessorImpl.java:25)
10:28:16,574 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
10:28:16,574 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
10:28:16,574 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:344)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:295)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:396)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
10:28:16,574 ERROR [STDERR] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:638)
10:28:16,575 ERROR [STDERR] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942)
10:28:16,575 ERROR [STDERR] at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:482)
10:28:16,575 ERROR [STDERR] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java)
10:28:16,575 ERROR [STDERR] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
10:28:16,575 ERROR [STDERR] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
10:28:16,575 ERROR [STDERR] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
10:28:16,575 ERROR [STDERR] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
10:28:16,575 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389)
10:28:16,575 ERROR [STDERR] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313)
10:28:16,575 ERROR [STDERR] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145)
10:28:16,575 ERROR [STDERR] at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
10:28:16,575 ERROR [STDERR] at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122)
10:28:16,575 ERROR [STDERR] at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
10:28:16,575 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:28:16,575 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
10:28:16,575 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.__invoke(DelegatingMethodAccessorImpl.java:25)
10:28:16,575 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
10:28:16,575 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
10:28:16,575 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
10:28:16,575 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
10:28:16,575 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
10:28:16,575 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
10:28:16,575 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
10:28:16,575 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
10:28:16,575 ERROR [STDERR] at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
10:28:16,575 ERROR [STDERR] at com.sun.proxy.$Proxy39.start(Unknown Source)
10:28:16,575 ERROR [STDERR] at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
10:28:16,575 ERROR [STDERR] at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
10:28:16,576 ERROR [STDERR] at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
10:28:16,576 ERROR [STDERR] at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
10:28:16,576 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:460)
10:28:16,576 ERROR [STDERR] at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
10:28:16,576 ERROR [STDERR] at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
10:28:16,576 ERROR [STDERR] at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1225)
10:28:16,576 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
10:28:16,576 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
10:28:16,577 ERROR [STDERR] at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789)
10:28:16,577 ERROR [STDERR] at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
10:28:16,577 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
10:28:16,577 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
10:28:16,577 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
10:28:16,577 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:778)
10:28:16,577 ERROR [STDERR] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:543)
10:28:16,577 ERROR [STDERR] at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
10:28:16,577 ERROR [STDERR] at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
10:28:16,577 ERROR [STDERR] at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
10:28:16,577 ERROR [STDERR] at org.jboss.Main.boot(Main.java:229)
10:28:16,577 ERROR [STDERR] at org.jboss.Main$1.call(Main.java:561)
10:28:16,577 ERROR [STDERR] at org.jboss.Main$1.call(Main.java:557)
10:28:16,577 ERROR [STDERR] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
10:28:16,577 ERROR [STDERR] at java.util.concurrent.FutureTask.run(FutureTask.java:138)
10:28:16,577 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
10:28:16,578 ERROR [STDERR] Caused by: org.xml.sax.SAXParseException: Premature end of file.
10:28:16,578 ERROR [STDERR] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.xs.opti.SchemaDOMParser.parse(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(Unknown Source)
10:28:16,578 ERROR [STDERR] at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
10:28:16,579 ERROR [STDERR] at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:293)
10:28:16,579 ERROR [STDERR] at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:172)
10:28:16,579 ERROR [STDERR] at org.drools.xml.XmlChangeSetReader.read(XmlChangeSetReader.java:65)
10:28:16,579 ERROR [STDERR] at org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:430)
10:28:16,579 ERROR [STDERR] ... 102 more
I can't comment so I'll have to put it in an answer.
We had the same exception with our reference to the schema being in a Spring XML configuration file. It seems the underlying Java stream reading the file is unable to follow the redirect. Our solution was simply to use HTTPS instead of HTTP in the XSD URL thus avoiding the redirect.
It made me aware that relying on external resources like this for a production application should maybe be reevaluated.
The reply I got from redhat support was:
"
The change was intentional, for security reasons.
Workarounds for code that doesn't understand redirects:
- change the xsd reference from http to https
- disable xsd validation (code specific, I believe Drools has a system property to do this)
"
I disabled the validation. I have not found a way to update guvnor to change the XSD within the XML it produces, I did not really try to find it.

Java getPart() throwing null pointer exception

I am getting a null pointer exception when trying to use getPart() and I cannot understand why this is throwing an exception rather than just returning null. Here is my form in jsp:
<form onsubmit="return check()" method="post" enctype="multipart/form-data" action="/TrainingServlet">
<input id="hotel_file" type="file" name="hotel_file" size="30">
</form>
Then in my servlet, I have the following code:
public void doPost(HttpServletRequest req, HttpServletResponse resp) {
try {
Part filePart = req.getPart("hotel_file"); //this line throws null pointer exception
getServletContext().getRequestDispatcher("/import.jsp").forward(req, resp);
} catch(Exception e) {
e.printStackTrace();
}
}
After reading this SO post, I added the #MultipartConfig annotation to the servlet class and I am still get NPE at the req.getPart() line. Also I am running the servlet on JBoss 6. Any insight appreciated!
Here is the stacktrace
16:50:15,227 ERROR [STDERR] java.lang.NullPointerException
16:50:15,228 ERROR [STDERR] at org.apache.catalina.connector.Request.getPart(Request.java:3225)
16:50:15,228 ERROR [STDERR] at org.apache.catalina.connector.RequestFacade.getPart(RequestFacade.java:1102)
16:50:15,229 ERROR [STDERR] at com.lanyon.training.javaproj.servlets.TrainingServlet.doPost(TrainingServlet.java:96)
16:50:15,229 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
16:50:15,230 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
16:50:15,230 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)
16:50:15,231 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
16:50:15,231 ERROR [STDERR] at com.lanyon.ghotel.common.pagination.web.PaginationFilter.doFilter(PaginationFilter.java:77)
16:50:15,232 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274)
16:50:15,232 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
16:50:15,233 ERROR [STDERR] at com.lanyon.common.serverobjects.UTF8EncodingFilter.doFilter(UTF8EncodingFilter.java:33)
16:50:15,233 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274)
16:50:15,234 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
16:50:15,235 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
16:50:15,235 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
16:50:15,236 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
16:50:15,236 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
16:50:15,236 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)
16:50:15,237 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
16:50:15,237 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
16:50:15,238 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
16:50:15,238 ERROR [STDERR] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
16:50:15,239 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
16:50:15,239 ERROR [STDERR] at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
16:50:15,240 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
16:50:15,240 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
16:50:15,241 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
16:50:15,241 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
16:50:15,242 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
multipart gives you a byte stream.
you have to convert it into a file.
you can also use transferTo() method of multipart

Invalid version or the data in not in 'javabin' format

I am currently integrating from solr 1.4 to solr 3.4. After executing the codes, I got the following error message.
15:56:09,575 ERROR [STDERR] [SolrServerException] QueryResponse SOLRSearchWorker. generateResponse(SolrQuery, SolrServer, SolrRequest.METHOD) message:
15:56:13,150 ERROR [STDERR] org.apache.solr.client.solrj.SolrServerException: java.lang.RuntimeException: Invalid version or the data in not in 'javabin' format
15:56:13,152 ERROR [STDERR] at org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:217)
15:56:13,152 ERROR [STDERR] at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
15:56:13,153 ERROR [STDERR] at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:122)
15:56:13,153 ERROR [STDERR] at org.cambridge.ebooks.production.solr.util.SOLRSearchWorker.generateResponse(SOLRSearchWorker.java:153)
15:56:13,154 ERROR [STDERR] at org.cambridge.ebooks.production.solr.util.SOLRSearchWorker.searchCore(SOLRSearchWorker.java:58)
15:56:13,155 ERROR [STDERR] at org.cambridge.ebooks.production.solr.util.EBookSearchWorker.searchBookCore(EBookSearchWorker.java:161)
15:56:13,155 ERROR [STDERR] at org.cambridge.ebooks.production.ebook.EBookWorker.getQuickSearchResult(EBookWorker.java:113)
15:56:13,156 ERROR [STDERR] at org.cambridge.ebooks.production.ebook.EBookManagedBean.doSearch(EBookManagedBean.java:248)
15:56:13,156 ERROR [STDERR] at org.cambridge.ebooks.production.ebook.EBookManagedBean.getInitBooks(EBookManagedBean.java:163)
15:56:13,157 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:56:13,157 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
15:56:13,158 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
15:56:13,158 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
15:56:13,159 ERROR [STDERR] at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
15:56:13,159 ERROR [STDERR] at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
15:56:13,160 ERROR [STDERR] at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:71)
15:56:13,160 ERROR [STDERR] at org.apache.el.parser.AstValue.getValue(AstValue.java:118)
15:56:13,161 ERROR [STDERR] at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
15:56:13,161 ERROR [STDERR] at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
15:56:13,162 ERROR [STDERR] at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
15:56:13,162 ERROR [STDERR] at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
15:56:13,163 ERROR [STDERR] at javax.faces.component.UIOutput.getValue(UIOutput.java:164)
15:56:13,163 ERROR [STDERR] at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
15:56:13,164 ERROR [STDERR] at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:351)
15:56:13,164 ERROR [STDERR] at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:160)
15:56:13,165 ERROR [STDERR] at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
15:56:13,165 ERROR [STDERR] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
15:56:13,166 ERROR [STDERR] at javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
15:56:13,166 ERROR [STDERR] at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
15:56:13,167 ERROR [STDERR] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1643)
15:56:13,168 ERROR [STDERR] at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
15:56:13,168 ERROR [STDERR] at com.sun.faces.application.view.JspViewHandlingStrategy.doRenderView(JspViewHandlingStrategy.java:427)
15:56:13,169 ERROR [STDERR] at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:229)
15:56:13,169 ERROR [STDERR] at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
15:56:13,170 ERROR [STDERR] at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
15:56:13,171 ERROR [STDERR] at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
15:56:13,171 ERROR [STDERR] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
15:56:13,172 ERROR [STDERR] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
15:56:13,172 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
15:56:13,173 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
15:56:13,173 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
15:56:13,174 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
15:56:13,174 ERROR [STDERR] at org.cambridge.ebooks.production.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:62)
15:56:13,175 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
15:56:13,175 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
15:56:13,176 ERROR [STDERR] at org.cambridge.ebooks.production.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:69)
15:56:13,177 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
15:56:13,177 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
15:56:13,178 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
15:56:13,178 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
15:56:13,179 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
15:56:13,180 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
15:56:13,180 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
15:56:13,181 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
15:56:13,181 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
15:56:13,182 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
15:56:13,183 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
15:56:13,183 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
15:56:13,184 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
15:56:13,184 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
15:56:13,185 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
15:56:13,185 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
15:56:13,186 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
15:56:13,186 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
15:56:13,187 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
15:56:13,188 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
15:56:13,189 ERROR [STDERR] Caused by: java.lang.RuntimeException: Invalid version or the data in not in 'javabin' format
15:56:13,189 ERROR [STDERR] at org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:99)
15:56:13,190 ERROR [STDERR] at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39)
15:56:13,190 ERROR [STDERR] at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:466)
15:56:13,191 ERROR [STDERR] at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243)
15:56:13,191 ERROR [STDERR] at org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:205)
15:56:13,192 ERROR [STDERR] ... 65 more
Then, I tried to debug and found out that the Query response is returning null because of this java bin format. I need help to fix this code, I tried all the possible solution I found in internet, but no luck. Anyone can help?? this is for my major release of project in my company.
Thanks!
This is usually related to either a version difference in Java itself between the server and the client, but more often it's caused by the server throwing an error and the application container returning an error page instead of the expected javabin formatted response.
Check the server log to see if it's not throwing an exception, and then attempt the same request in your browser (the server should have a log of the query and the parameters included) to see what the server actually responds with.

LiveCycle / JBoss JNDI error : Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory

I have Adobe LiveCycle ES4 Server running on an older version of JBoss on a Windows 7 machine. On another Windows machine within the same network, I set up a client also running on JBoss, but a newer version (7.1.1). Using sample code provided by Adobe, I am trying to test my connection over RMI, but I am running into errors. Here is the stack trace:
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
Here is my code:
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();
}
}
Does it work using SOAP?
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "http://113.252.20.43:80");
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_SOAP_PROTOCOL);
I personally have not had success calling an EJB endpoint on a remote LiveCycle server. Would like to see your solution if you get it worked out.
Hope this helps.
There is ni problem just include jboss-client classes to to your classpath. In jboss 5 vs jboss 4x there are plenty of them. But IT works. My configuration LC es4 on Linux and jboss 5.2, calling remote from jboss 6 with the client classes from jboss 5 using the Java api

Unable to make a JAX-RPC web service call from client

I am using Jboss 5.0.1 server and trying to make a webservice JAX-RPC call to one of the EJB in our application. I downloaded and Copied the following three jars from JBOSS_HOME\server\default\lib to JBOSS_HOME\lib\endorsed
jboss-jaxrpc.jar
jboss-jaxws.jar
jboss-saaj.jar
I am unable to make a webservice client call, when made this exception is thrown:
**11:54:33,995 ERROR [CommonClient] Exception caught while (preparing for) performing the invocation:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at org.jboss.ws.core.client.EndpointInfo.lowerCaseProtocol(EndpointInfo.java:114)
at org.jboss.ws.core.client.EndpointInfo.<init>(EndpointInfo.java:49)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:335)
at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:516)
at org.jboss.ws.core.jaxrpc.client.CallImpl.invoke(CallImpl.java:275)
at org.jboss.ws.core.jaxrpc.client.PortProxy.invoke(PortProxy.java:154)
at $Proxy106.checkPlanData(Unknown Source)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
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:662)
11:54:34,307 ERROR [STDERR] java.rmi.RemoteException: Call invocation failed; nested exception is:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
11:54:34,323 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:535)
11:54:34,323 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.CallImpl.invoke(CallImpl.java:275)
11:54:34,338 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.PortProxy.invoke(PortProxy.java:154)
11:54:34,338 ERROR [STDERR] at $Proxy106.checkPlanData(Unknown Source)
11:54:34,354 ERROR [STDERR] at org.apache.jsp.index_jsp._jspService(index_jsp.java:88)
11:54:34,354 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
11:54:34,370 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
11:54:34,370 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
11:54:34,385 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
11:54:34,401 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
11:54:34,401 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
11:54:34,417 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
11:54:34,417 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
11:54:34,432 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
11:54:34,432 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
11:54:34,448 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
11:54:34,448 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
11:54:34,463 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
11:54:34,463 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
11:54:34,479 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
11:54:34,495 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
11:54:34,495 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
11:54:34,510 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
11:54:34,510 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
11:54:34,526 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
11:54:34,526 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
11:54:34,542 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
11:54:34,542 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
11:54:34,557 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
11:54:34,557 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
11:54:34,573 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
11:54:34,588 ERROR [STDERR] Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
11:54:34,588 ERROR [STDERR] at java.lang.String.substring(String.java:1937)
11:54:34,604 ERROR [STDERR] at org.jboss.ws.core.client.EndpointInfo.lowerCaseProtocol(EndpointInfo.java:114)
11:54:34,604 ERROR [STDERR] at org.jboss.ws.core.client.EndpointInfo.<init>(EndpointInfo.java:49)
11:54:34,620 ERROR [STDERR] at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:335)
11:54:34,620 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:516)
11:54:34,635 ERROR [STDERR] ... 30 more**
I am not know what could be the problem, Please help me The client code is as follows:
<%#page import="java.util.Hashtable"%>
<%#page import="javax.naming.*,com.test.*,javax.xml.rpc.*,stub.*"%>
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>JSP
Page</title></head><body>
<h1>Hello World!</h1>
<%
try{
InitialContext ic = new InitialContext( );
CarrierWS service = (CarrierWS)ic.lookup("java:comp/env/service/CarrierWS");
out.println("======================="+service.getCarrierWSSEIPort().checkPlanData("2007-01-01"));
}
catch(Exception e)
{
out.println("Exception occurred : " + e.getMessage());
e.printStackTrace();
}
%>
</body>
</html>
Thanks in advance
Senthil
Have you configured your endpoint correctly?
The contents of the method EndpointInfo.lowerCaseProtocol suggests that you got this wrong.
private String lowerCaseProtocol(String targetAddress) {
int colonIndex = targetAddress.indexOf(':');
String lowerCasedProtocol = targetAddress.substring(0, colonIndex).toLowerCase();
return lowerCasedProtocol + targetAddress.substring(colonIndex);
}
There doesn't appear to be a ':' in your endpoint which means that your endIndex in the substring method is smaller than your beginIndex and thus the StringIndexOutOfBoundsException
Check your configuration and try again.
The error you get: StringIndexOutOfBoundsException means that somewhere in the code you are trying to get an item in a collection but that collection dont have the index you are trying to get.
So, for example:
//lets say myList contains 10 items
List myList = new ArrayList();
myList.get(10) // will throw StringIndexOutOfBoundsException since there is no index 10
Since in the jsp code i don't see any use of collection, I'm guessing the problem is in the service/EJB itself.
I got this problem, the issue is that I copied WRONG version of jars in endorsed folder.
The solution is to copy
jboss-common-core.jar
jboss-logging-spi.jar
jbossws-native-jaxrpc.jar
jbossws-native-jaxws.jar
jbossws-native-jaxws-ext.jar
jbossws-native-saaj.jar
from \client folder to endorsed folder. This solves my problem

Categories