In the following code:
public void onButtonClick(ActionEvent actionEvent) {
webView.getEngine().getLoadWorker().
stateProperty().addListener(new ChangeListener<Worker.State>() {
#Override
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
if (newValue == Worker.State.SUCCEEDED)
webView.getEngine().executeScript("window.scrollTo(0,document.body.scrollHeight);");
}});
webView.getEngine().loadContent("some content");
}
This code works just fine, the problem is that this line:
webView.getEngine().executeScript("window.scrollTo(0, document.body.scrollHeight);");
is creating an infinite loop thread which does not terminate when the application terminates, hence producing this Exception:
java.lang.IllegalThreadStateException
at java.lang.ThreadGroup.destroy (ThreadGroup.java:778)
at org.codehaus.mojo.exec.ExecJavaMojo.execute (ExecJavaMojo.java:328)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
I know it is that line the one that produces this Thread with name "Watchdog-Timer-1", because without executing that line, this Thread is never started and the app closes normally.
Any ideas why this might be happening?
Related
I'm trying to call a uri named ant/talk with post method in Angular.js.
In my code, I called using $http.post method in javascript with data.
$http.post('ant/create', {
content : $scope.content,
type : chatType,
point : point
}).then(function(response) { /* if successful request */ }
However, in spring controller just told me MissingServletRequestParameterException
#Controller
#RequestMapping("/ant/*")
public class AntTalkCont {
....
#RequestMapping(value = "/create", method = RequestMethod.POST, produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
#ResponseBody
public String createProcess(HttpServletRequest request, Locale locale, Model model
, #RequestParam("content") String content) {
String content2 = request.getParameter("content");
logger.debug("content = {}", content);
logger.debug("content by request = {}", content2);
....
But I declared #RequestParam in java controller above, the spring controller throwed that exception. Though I removed RequestParam annotation and used request.getParameter also got null value.
I can append content on url like this ant/create?content='+$scope.content but the $scope.content can be longer than 512 bytes so I want to use data object in post request.
In spring controlller, how can I fix it properly?
Here is full stacktrace
16:59:17.546 [http-apr-30802-exec-80] DEBUG
o.s.w.s.m.m.a.ServletInvocableHandlerMethod - Error resolving argument
[3] [type=java.lang.String] HandlerMethod details: Controller
[kr.stocktalk.webchat.cont.AntTalkCont] Method [public
java.lang.String
kr.stocktalk.webchat.cont.AntTalkCont.createProcess(javax.servlet.http.HttpServletRequest,java.util.Locale,org.springframework.ui.Model,java.lang.String)]
org.springframework.web.bind.MissingServletRequestParameterException:
Required String parameter 'content' is not present at
org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodArgumentResolver.java:195)
~[spring-web-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:104)
~[spring-web-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)
~[spring-web-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:161)
[spring-web-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:128)
[spring-web-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
[servlet-api.jar:na] at
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
[spring-webmvc-4.3.0.RELEASE.jar:4.3.0.RELEASE] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
[servlet-api.jar:na] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
[catalina.jar:8.0.24] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
[catalina.jar:8.0.24] at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
[tomcat-websocket.jar:8.0.24] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
[catalina.jar:8.0.24] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
[catalina.jar:8.0.24] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
[catalina.jar:8.0.24] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
[catalina.jar:8.0.24] at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
[catalina.jar:8.0.24] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
[catalina.jar:8.0.24] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
[catalina.jar:8.0.24] at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
[catalina.jar:8.0.24] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
[catalina.jar:8.0.24] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
[catalina.jar:8.0.24] at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
[tomcat-coyote.jar:8.0.24] at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
[tomcat-coyote.jar:8.0.24] at
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503)
[tomcat-coyote.jar:8.0.24] at
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492)
[tomcat-coyote.jar:8.0.24] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[na:1.8.0_65] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[na:1.8.0_65] at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[tomcat-util.jar:8.0.24] at java.lang.Thread.run(Thread.java:745)
[na:1.8.0_65]
Having issues using the JasperCompileManager.compileReport(myReport); when having a Simple Spring MVC Application deployed in Tomcat8.
Including the following dependencies :
....Spring Dependencies 4.1.6 Release...
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler-jdt</artifactId>
<version>5.5.15</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.6.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
I have a controller endpoint calling the following code in a Service class. (The code passes Unit & Integration Tests outside of the web app.)
public JasperReport getJasperReport(String filePath)
{
try {
// File f = new File(filePath);
File tmpFile = new File("C:\\myReport.jrxml");
return fromFile(tmpFile);
} catch (JRException ex) {
log.error(MyAppService.class.getName(),ex);
}
return null;
}
private JasperReport fromFile(File f) throws JRException {
JasperDesign jd;
JasperReport jr = null;
jd = JRXmlLoader.load(f);
jr = JasperCompileManager.compileReport(jd);
return jr;
}
Getting the following Exception when calling the endpoint.
java.lang.ArrayIndexOutOfBoundsException: -2
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeBinaryExpression(Parser.java:1325)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:5961)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8491)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8656)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8621)
at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:7420)
at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:289)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:315)
at net.sf.jasperreports.engine.design.JRJdtCompiler.compileUnits(JRJdtCompiler.java:167)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:354)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:614)
at com.mvcapp.web.controller.MvcAppAccessController.fromFile(MvcAppAccessController.java:190)
at com.mvcapp.web.controller.MvcAppAccessController.convertFileToByteArray(MvcAppAccessController.java:168)
at com.mvcapp.web.controller.MvcAppAccessController.uploadFileHandler(MvcAppAccessController.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2407)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2396)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
20-Aug-2015 12:12:02.850 SEVERE [http-apr-8080-exec-12] com.mvcapp.web.controller.MvcAppAccessController.convertFileToByteArray null
net.sf.jasperreports.engine.JRException: Error compiling report design.
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:242)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:354)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:614)
at com.mvcapp.web.controller.MvcAppAccessController.fromFile(MvcAppAccessController.java:190)
at com.mvcapp.web.controller.MvcAppAccessController.convertFileToByteArray(MvcAppAccessController.java:168)
at com.mvcapp.web.controller.MvcAppAccessController.uploadFileHandler(MvcAppAccessController.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2407)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2396)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -2
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeBinaryExpression(Parser.java:1325)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:5961)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8491)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8656)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8621)
at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:7420)
at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:289)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:315)
at net.sf.jasperreports.engine.design.JRJdtCompiler.compileUnits(JRJdtCompiler.java:167)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)
... 44 more
Any help would be appreciated! Thanks
If you have aspectjtools.jar in your classpath, can you try compiling it by removing it from the classpath?
I'm having a spring boot application. I am trying to figure out the type of the device the request has been instantiated.
I have added the spring mobile device as an jar in pom.xml
pom.xml :
<dependency>
<groupId>org.springframework.mobile</groupId>
<artifactId>spring-mobile-device</artifactId>
</dependency>
ControllerConfig:
#Configuration
public class ControllerConfig extends WebMvcConfigurerAdapter {
#Bean
public DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver() {
return new DeviceHandlerMethodArgumentResolver();
}
#Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new ServletWebArgumentResolverAdapter(
new DeviceWebArgumentResolver()));
argumentResolvers
.add(new SitePreferenceHandlerMethodArgumentResolver());
}
}
I have a controller class that uses the device as the request parameter.
Controller.java :
#RequestMapping(value = "/device",method=RequestMethod.GET)
#ResponseStatus(HttpStatus.OK)
public ResponseEntity<byte[]> getDeviceInfo(Device device){
if (device != null && device.isNormal()) {
System.out.println("*******normal******");
}else if(device != null && (device.isMobile() || device.isTablet())){
System.out.println("*******mobile******");
}
}
When I run this code, I get the following error:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.mobile.device.Device]: Specified class is an interface
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[javax.servlet-api-3.1.0.jar:3.1.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) ~[undertow-core-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) ~[undertow-core-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) ~[undertow-core-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) ~[undertow-core-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) ~[undertow-servlet-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) ~[undertow-core-1.1.1.Final.jar:1.1.1.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.1.Final.jar:1.1.1.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.mobile.device.Device]: Specified class is an interface
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:101) ~[spring-beans-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:140) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:79) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:106) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:129) ~[spring-web-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) ~[spring-webmvc-4.1.4.RELEASE.jar:4.1.4.RELEASE]
... 32 common frames omitted
Is there any way to resolve this error.?
Although you have declared a DeviceHandlerMethodArgumentResolver bean, you have not added it as a required resolver in addArgumentResolvers. Your code should be:
#Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(deviceHandlerMethodArgumentResolver());
argumentResolvers.add(new ServletWebArgumentResolverAdapter(new DeviceWebArgumentResolver()));
argumentResolvers.add(new SitePreferenceHandlerMethodArgumentResolver());
}
You should also consider declaring SitePreferenceHandlerMethodArgumentResolver and ServletWebArgumentResolverAdapter as beans.
I am trying to use Stanford POS Tagger in Java servlet. I created Dynamic Web Page project in J2EE and included build path of jar files by following this tutorial.
http://www.galalaly.me/index.php/2011/05/tagging-text-with-stanford-pos-tagger-in-java-applications/
If I create a separate java file, I am able to get POS Tagger working as shown below.
public static String tagger(String sample) throws IOException, ClassNotFoundException {
// Initialize the tagger
MaxentTagger tagger = new MaxentTagger("models/english-left3words-distsim.tagger");
// The tagged string
String tagged = tagger.tagString(sample);
// Output the result
return tagged;
}
public static void main(String[] args){
try {
System.out.println(tagger("This is a sample."));
} catch (ClassNotFoundException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Which means POS tagger works in main method of simple Java class which I named Taggers.java. But when I try to instantiate the object of Tagger.java class in servlet, I can't get it working. The following code is a servlet in which I am trying to instantiate the object of Tagger.java.
/**
* #see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
*/
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
try {
out.println(Tagger.tagger("This is a sample sentence."));
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
When I run the above servlet on tomcat-8, it shows following exceptions.
SEVERE: Servlet.service() for servlet [com.exp.pkg.ExpServlet] in context with path [/webProj1] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: edu.stanford.nlp.tagger.maxent.MaxentTagger
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
at com.exp.pkg.Tagger.tagger(Tagger.java:17)
at com.exp.pkg.ExpServlet.service(ExpServlet.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
After I set classpath=".;..;C:\Users\Faisal\workspace_EE\webProj1\tagger\english-left3words-distsim.tagger;C:\stanford-postagger-2015-01-29\stanford-postagger-2015-01-30\stanford-postagger;C:\apache-tomcat-8\apache-tomcat-8.0.20\lib\servlet-api"
The stack trace is as follows:
SEVERE: Servlet.service() for servlet [com.exp.pkg.ExpServlet] in context with path [/webProj1] threw exception edu.stanford.nlp.io.RuntimeIOException: Unrecoverable error while loading a tagger model at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:769) at edu.stanford.nlp.tagger.maxent.MaxentTagger.(MaxentTagger.java:297) at edu.stanford.nlp.tagger.maxent.MaxentTagger.(MaxentTagger.java:262) at com.exp.pkg.Tagger.tagger(Tagger.java:17) at com.exp.pkg.ExpServlet.service(ExpServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: Unable to resolve "tagger/english-bidirectional-distsim.tagger" as either class path, filename or URL at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:463) at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:764) ... 27 more
You need to make sure your classpath is correct.
From your updated post, it looks like you don't have the right model path on your classpath. You shouldn't add the .tagger file directly to your classpath; add the directory which contains the tagger folder. If your file setup looks like this:
C:\mystuff
tagger\
english-left3words-distsim.tagger
english-bidirectional-distsim.tagger
then you should put the directory C:\mystuff on your classpath.
You need to make sure your classpath is correct.
From your updated post, it looks like you don't have the right model
path on your classpath. You shouldn't add the .tagger file directly to
your classpath; add the directory which contains the tagger folder. If
your file setup looks like this:
C:\mystuff
tagger\
english-left3words-distsim.tagger
english-bidirectional-distsim.tagger then you should put the
directory C:\mystuff on your classpath.
According to the instructions at the link I have posted earlier, I created folder named tagger inside the project's root folder such as (C:\Users\Faisal\workspace_EE\webProj1\tagger), where I put the model "english-left3words-distsim.tagger" with it's .props file as directed on the tutorial link.
Now as you suggest to add only the folder to the classpath so my classpath becomes "C:\Users\Faisal\workspace_EE\webProj1\;C:\stanford-postagger-2015-01-29\stanford-postagger-2015-01-30\stanford-postagger;C:\apache-tomcat-8\apache-tomcat-8.0.20\lib\servlet-api"
This time, I got the following stack trace:
SEVERE: Servlet.service() for servlet [com.exp.pkg.ExpServlet] in context with path [/webProj1] threw exception
edu.stanford.nlp.io.RuntimeIOException: Unrecoverable error while loading a tagger model
at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:769)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:297)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:262)
at com.exp.pkg.Tagger.tagger(Tagger.java:17)
at com.exp.pkg.ExpServlet.service(ExpServlet.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Unable to resolve "tagger/english-bidirectional-distsim.tagger" as either class path, filename or URL
at edu.stanford.nlp.io.IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(IOUtils.java:463)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:764)
... 27 more
I am creating a web application using Ebay Java SDK. I have created a code to get session id using credentials. now it is working file if I run the java file. but if I want to call it from Servlet and deploy it on JBoss, then the same method stop working and give the parse stream exception nested by character conversion.
Regarding code following is the code I am using.
ApiContext apiContext = new ApiContext();
ApiCredential cred = apiContext.getApiCredential();
ApiAccount apiAccount = cred.getApiAccount();
apiAccount.setApplication(LabelConstants.PROD_APP_ID);
apiAccount.setCertificate(LabelConstants.PROD_CERT_ID);
apiAccount.setDeveloper(LabelConstants.PROD_DEV_ID);
apiContext.setApiServerUrl(LabelConstants.PROD_API_URL);
apiContext.setRuName(LabelConstants.PROD_RU_NAME);
GetSessionIDCall gsic = new GetSessionIDCall(apiContext);
gsic.setRuName(apiContext.getRuName());
try {
sessionId = gsic.getSessionID();
System.out.println(sessionId);
} catch (ApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SdkException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
17:22:23,255 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-localhost-127.0.0.1-8080-1) Interceptor for {urn:ebay:apis:eBLBaseComponents}eBayAPIInterfaceService#{urn:ebay:apis:eBLBaseComponents}GetSessionID has thrown exception, unwinding now: java.lang.RuntimeException: Couldn't parse stream.
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1178)
at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:104)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:795)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1493)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1401)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:648)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:461)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:364)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
at com.sun.proxy.$Proxy44.getSessionID(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_67]
at com.ebay.sdk.ApiCall.callSOAP(Unknown Source) [ebaysdkcore.jar:]
at com.ebay.sdk.ApiCall.executeByApiName(Unknown Source) [ebaysdkcore.jar:]
at com.ebay.sdk.ApiCall.execute(Unknown Source) [ebaysdkcore.jar:]
at com.ebay.sdk.call.GetSessionIDCall.getSessionID(GetSessionIDCall.java:76) [ebaycalls.jar:]
at com.ba.label.conf.GetApiContext.getSessionId(GetApiContext.java:73) [classes:]
at com.ba.label.servlet.AuthServlet.doGet(AuthServlet.java:43) [classes:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)
at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:536)
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585)
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:610)
at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:316)
at __redirected.__XMLInputFactory.createXMLStreamReader(__XMLInputFactory.java:139) [jboss-modules.jar:1.1.1.GA]
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1176)
... 42 more
Caused by: java.io.CharConversionException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)
at com.ctc.wstx.io.UTF8Reader.reportInvalidInitial(UTF8Reader.java:303)
at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:189)
at com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:250)
at com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:133)
at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531)
... 47 more
Can anyone explain how can I run the Ebay SDK on Servlet and container?
I had the same issue
yourcall.setEnableCompression(false);
worked for me