Page 1 of 2
String index out of range
PostPosted:Wed Nov 10, 2010 2:43 pm
by shirkavand
Hi,
I have downloaded OpenKM 5.0 beta. I'm trying to connect via web services from C#, when i try to execute:
documentService.create(token, miDoc, content);
alwas get the next error with the content parameter:
String index out of range: -1
Any idea?
Cheers
Re: String index out of range
PostPosted:Wed Nov 10, 2010 9:53 pm
by jllort
You're doing something wrong.
Try looking in our source code for MSOpenKMCore module ( these are the libraries that're used by ms office addins via webservices ).
Re: String index out of range
PostPosted:Thu Nov 11, 2010 6:32 pm
by shirkavand
Hi There,
Thanks for your fast reply.
OK i have read and used the code you suggested me. And i got the same error. I am using a very simple code based on "create" and "readFile" functions that i found on OpenKM's sourceforge repository, as follows:
Code: Select all // create document
private void create(String localFileName, String docPath, String username, String password)
{
String token = "";
OKMAuthService authService = null;
OKMDocumentService documentService = null;
// Init services
authService = new OKMAuthService();
documentService = new OKMDocumentService();
// OpenKM authentication
token = authService.login(username, password);
// create document
document doc = new document();
doc.path = docPath;
documentService.create(token, doc, readFile(docPath + localFileName));
// Logout OpenKM
authService.logout(token);
token = "";
}
// Read the local file
private byte[] readFile(string filePath)
{
byte[] buffer;
FileStream fileStream = null;
try
{
fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
int length = (int)fileStream.Length; // get file length
buffer = new byte[length]; // create buffer
int count; // actual number of bytes read
int sum = 0; // total number of bytes read
// read until Read method returns 0 (end of the stream has been reached)
while ((count = fileStream.Read(buffer, sum, length - sum)) > 0)
sum += count; // sum is a buffer offset for next reading
}
catch (Exception e)
{
throw e;
}
finally
{
if (fileStream != null)
{
fileStream.Close();
}
}
return buffer;
}
And i got the same error
String index out of range: -1 Any idea?
Cheers
Re: String index out of range
PostPosted:Thu Nov 11, 2010 7:58 pm
by jllort
Could I see all stack trace ?
Re: String index out of range
PostPosted:Fri Nov 12, 2010 3:04 pm
by shirkavand
HI there,
Here is all the error info i got:
OpenKM cmd windows console:
Code: Select all08:51:37,749 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at java.lang.String.substring(String.java:1904)
at es.git.openkm.module.direct.DirectDocumentModule.create(DirectDocumentModule.java:302)
at es.git.openkm.ws.endpoint.OKMDocument.create(OKMDocument.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.wsf.container.jboss42.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:102)
at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:221)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
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:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:619)08:51:41,454 INFO [MultiIndex] Unable to delete obsolete index: _f
VS Stacktrace (Exception e.stacktrace)
Code: Select all at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at CRM_OpenKM.OKMDocument.OKMDocumentService.create(String arg0, document arg1, Byte[] arg2) in D:\Projects\CRM+OpenKM\CRM+OpenKM\Web References\OKMDocument\Reference.cs:line 278
at CRM_OpenKM._Default.create(String localFileName, String docPath, String username, String password) in D:\Projects\CRM+OpenKM\CRM+OpenKM\Default.aspx.cs:line 52
VS Error message
String index out of range: -1
BTW, i am using VS 2008, windows XP SP3, OpenKm 4(and OpenKm 5 too - i am testing both versions)
Hope it helps,
Cheers
Re: String index out of range
PostPosted:Fri Nov 12, 2010 7:55 pm
by jllort
The webservices from 4.x are not the 5.x ( are not compatible, has minimal changes, not in logic, but you'll neet to re-create for 5.x ). Except it consideration I can see any error in logic. You're using OpenKM 4.1 ? or 4.0 ?
Can you test the word addins for version 4.x or for version 5.x depending with OpenKM version are you testing... are running right ?
It's the same OpenKM - jboss donwloaded ?
Re: String index out of range
PostPosted:Mon Nov 15, 2010 3:17 pm
by shirkavand
HI there,
I have downloaded "OpenKM-4.1_JBoss-4.2.3.GA" from "
http://sourceforge.net/projects/openkm/files/". For running the app i just go to "Bin" folder and clicked "run.bat" it shows 2 errors during the startup of the app, not suer how critical are these error, because finally i always can login to the app, i'll post you the errors, so youy can give some advice:
The first one:
Code: Select all09:02:04,242 WARN [ServiceController] Problem starting service jboss:service=W
bService
java.lang.Exception: Port 8083 already in use.
at org.jboss.web.WebServer.start(WebServer.java:233)
at org.jboss.web.WebService.startService(WebService.java:322)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcer.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvokerjava:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControler.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at org.jboss.system.ServiceController.start(ServiceController.java:435)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpljava:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcer.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvokerjava:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:304)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpljava:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcer.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercepor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvokerjava:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:508)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.jboss.web.WebServer.start(WebServer.java:226)
... 50 more
then i got this second one too:
Code: Select all09:11:22,232 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss:service=WebService
State: FAILED
Reason: java.lang.Exception: Port 8083 already in use.
I Depend On:
jboss.system:service=ThreadPool
Depends On Me:
jboss.ejb:service=EJBDeployer
ObjectName: jboss.ejb3:service=EJB3Deployer
State: CONFIGURED
I Depend On:
jboss.aop:service=AspectDeployer
jboss.ejb:service=EJBDeployer
jboss.ejb3:service=JarsIgnoredForScanning
Depends On Me:
jboss.ws:service=DeployerInterceptorEJB3
ObjectName: jboss.ejb:service=EJBDeployer
State: CONFIGURED
I Depend On:
jboss:service=TransactionManager
jboss:service=WebService
Depends On Me:
jboss.ejb3:service=EJB3Deployer
jboss.ws:service=DeployerInterceptorEJB21
ObjectName: jboss.ws:service=DeployerInterceptorEJB21
State: CONFIGURED
I Depend On:
jboss.ejb:service=EJBDeployer
ObjectName: jboss.ws:service=DeployerInterceptorEJB3
State: CONFIGURED
I Depend On:
jboss.ejb3:service=EJB3Deployer
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss:service=WebService
State: FAILED
Reason: java.lang.Exception: Port 8083 already in use.
I Depend On:
jboss.system:service=ThreadPool
Depends On Me:
jboss.ejb:service=EJBDeployer
09:11:22,403 ERROR [Server] Root deployment has missing dependencies; continuing
Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss:service=WebService
State: FAILED
Reason: java.lang.Exception: Port 8083 already in use.
I Depend On:
jboss.system:service=ThreadPool
Depends On Me:
jboss.ejb:service=EJBDeployer
ObjectName: jboss.ejb3:service=EJB3Deployer
State: CONFIGURED
I Depend On:
jboss.aop:service=AspectDeployer
jboss.ejb:service=EJBDeployer
jboss.ejb3:service=JarsIgnoredForScanning
Depends On Me:
jboss.ws:service=DeployerInterceptorEJB3
ObjectName: jboss.ejb:service=EJBDeployer
State: CONFIGURED
I Depend On:
jboss:service=TransactionManager
jboss:service=WebService
Depends On Me:
jboss.ejb3:service=EJB3Deployer
jboss.ws:service=DeployerInterceptorEJB21
ObjectName: jboss.ws:service=DeployerInterceptorEJB21
State: CONFIGURED
I Depend On:
jboss.ejb:service=EJBDeployer
ObjectName: jboss.ws:service=DeployerInterceptorEJB3
State: CONFIGURED
I Depend On:
jboss.ejb3:service=EJB3Deployer
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss:service=WebService
State: FAILED
Reason: java.lang.Exception: Port 8083 already in use.
I Depend On:
jboss.system:service=ThreadPool
Depends On Me:
jboss.ejb:service=EJBDeployer
at org.jboss.deployment.MainDeployer.checkIncompleteDeployments(MainDeployer.java:1385)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:785)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:508)
at java.lang.Thread.run(Thread.java:619)
After that, i just go to "
http://localhost:8080/OpenKM/es.git.ope ... /index.jsp" and login to OPenKM just fine. Any idea?
Cheers
Re: String index out of range
PostPosted:Tue Nov 16, 2010 7:57 am
by jllort
The server indicates that there's other application binding in port 8083, stop the application that's using this port ( you can not got two jboss started at same time executing default run )
Code: Select all09:02:04,242 WARN [ServiceController] Problem starting service jboss:service=W
bService
java.lang.Exception: Port 8083 already in use.
at org.jboss.web.WebServer.start(WebServer.java:233)
execute it:
Re: String index out of range
PostPosted:Tue Nov 16, 2010 6:37 pm
by shirkavand
Hi,
Ok, i can not shutdown the app in 8083. So i have followed this link, in order to change the startup port of jboss:
http://forum.openkm.com/viewtopic.php?f=3&t=2724
I have change it to 8084, 8085 etc but seems that it do not recognize the changes, still get the same error:
Code: Select all09:02:04,242 WARN [ServiceController] Problem starting service jboss:service=W
bService
java.lang.Exception: Port 8083 already in use.
at org.jboss.web.WebServer.start(WebServer.java:233)
Am i missing something here?
Cheers
Re: String index out of range
PostPosted:Wed Nov 17, 2010 7:55 am
by jllort
you must change the port in jboss-service.com server/default/conf ( for jboss special characteristics better taking a look at jboss forum )
Re: String index out of range
PostPosted:Thu Nov 18, 2010 10:28 pm
by shirkavand
Hi there,
ok now the server starts OK, without any error. I am using version 4.1 of OPenKM. I have tested again the code, and still the same problem. Just wondering could be some incompatibility with "sbyte" and "byte" types between c# and java?
Cheers
Re: String index out of range
PostPosted:Sat Nov 20, 2010 11:25 am
by jllort
Try using our C# webservice classes not yours ( checkout from source forge ) and then we'll be sure you're nearly our WS implementation.
Re: String index out of range
PostPosted:Thu Dec 02, 2010 6:38 pm
by roycal93
Hi Sr, would you tell me where exactly is this C# code? I have checked all the folders in the source forge repository but could not find anything. Thanks in advance.
BTW: I am continuing shirkavand's work.
Re: String index out of range
PostPosted:Fri Dec 03, 2010 9:30 am
by jllort
The module is called MSOpenKMCore there's some ws folder
Re: String index out of range
PostPosted:Thu Dec 09, 2010 10:05 pm
by roycal93
Sorry I ask again, but I was unable to find this code. Could you explain to me how to find it? Maybe I am missing something.
Thanks.