Developing for Splunk Enterprise

How can i solve this problem "Precondition for readText is getEventType() == START_ELEMENT"

shipment777
New Member

I Have met this error

javax.xml.stream.XMLStreamException: Precondition for readText is getEventType() == START_ELEMENT

 [exec]     at weblogic.xml.stax.XMLStreamReaderBase.getElementText(XMLStreamReaderBase.java:285)
     [exec]     at com.splunk.AtomObject.createReader(AtomObject.java:100)
     [exec]     at com.splunk.AtomEntry.parseStream(AtomEntry.java:55)
     [exec]     at com.splunk.Job.refresh(Job.java:937)
     [exec]     at com.splunk.JobCollection.create(JobCollection.java:92)
     [exec]     at com.splunk.JobCollection.create(JobCollection.java:62)
     [exec]     at kr.hrdkorea.ncs.common.api.controller.CMApiController.restApi01(CMApiController.java:426)
     [exec]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [exec]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     [exec]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [exec]     at java.lang.reflect.Method.invoke(Method.java:606)
     [exec]     at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
     [exec]     at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
     [exec]     at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
     [exec]     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
     [exec]     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
     [exec]     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
     [exec]     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
     [exec]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
     [exec]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
     [exec]     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
     [exec]     at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
     [exec]     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
     [exec]     at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
     [exec]     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     [exec]     at egovframework.rte.ptl.mvc.filter.HTMLTagFilter.doFilter(HTMLTagFilter.java:51)
     [exec]     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     [exec]     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
     [exec]     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
     [exec]     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     [exec]     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
     [exec]     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
     [exec]     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     [exec]     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
     [exec]     at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
     [exec]     at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
     [exec]     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
     [exec]     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
     [exec]     at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

==============================================================
When this Method Call "Job job = service.getJobs().create(host);"

this my source

Map connectArgs = new HashMap();
try{

        connectArgs.put("host", "server ip");
        connectArgs.put("username", "login id");
        connectArgs.put("password", "login passwor");
        connectArgs.put("port", 8089);
        connectArgs.put("scheme", "http"); 

        service = Service.connect(connectArgs);

    }catch(Exception e){
        e.printStackTrace();
    }

String host = "search host=\"{hostname}\" ";
Job job = service.getJobs().create(host); <--------------- this line is problem i guess

TEST java version : 1.6.0.45/ 1.7.0.80
SDK JAR : splunk-sdk-java-1.6.2.jar
splunk version : enterprise(7.0.0 )
WAS : weblogic 10.3

more info :
i can't use "splunk-sdk-java-1.6.2.jar" file as it is, because java version, so i nuinstall "splunk-sdk-java-1.6.2.jar" .
and then copy all *.java file to "myProject" after that i Can use.

Tags (2)
0 Karma