I'm trying to use Hibernate with GWT (using Gilead) but I got the following error
[WARN] /hibernate/greet
java.lang.NoClassDefFoundError: Could not initialize class net.jaffa.hibernate.server.NewHibernateUtil
at net.jaffa.hibernate.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
[ERROR] 500 - POST /hibernate/greet (127.0.0.1) 3632 bytes
Request headers
Host: 127.0.0.1:8888
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://127.0.0.1:8888/hibernate/hosted.html?hibernate
X-GWT-Permutation: HostedMode
X-GWT-Module-Base: http://127.0.0.1:8888/hibernate/
Content-Type: text/x-gwt-rpc; charset=utf-8
Content-Length: 175
Pragma: no-cache
Cache-Control: no-cache
Response headers
Content-Type: text/html; charset=iso-8859-1
Content-Length: 3632
This is still a new project, just I'm trying to do proof of concept.
Thanks
Feras
java.lang.NoClassDefFoundError: Could not initialize class n.j.h.s.NewHibernateUtil
This error means that the class is found but its initialization failed. Possible causes include
some dependencies are unsatisfied ~or~
an exception is thrown when executing a static initialization block in the class.
In the particular case of a typical HibernateUtil class, I'd bet on the second option. Extract the code of the static initialization block and run it / debug it in a regular main, outside the container (and maybe try to improve the error reporting in case of problem).
java.lang.NoClassDefFoundError means the runtime could not locate the class in its classpath.
It seems you are missing a jar which contains the class net.jaffa.hibernate.server.NewHibernateUtil .
Related
I am new to GWT.
I have already generated first applications that worked and I stuck on another one - I cannot run.
I got in my browser status 503
Did I forget about something?
Everything in module section of Project Settings it the same as in other apps,
pom.xml is all the same
maybe I should all some changes to web.xml?
Finding some solutions of similar problem, I have deleted
in web.xml file this lines:
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>eu.mrndesign.matned.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/arkanoidgame/greet</url-pattern>
</servlet-mapping>
here is a stacktrace:
> Starting Jetty on port 8888
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload#3027a1f1{/,file:/C:/Users/matni/.IntelliJIdea2019.3/system/gwt/arkanoidgame.b9d5fc4/ArkanoidGame.513aa147/run/www/,STARTING}{C:\Users\matni\.IntelliJIdea2019.3\system\gwt\arkanoidgame.b9d5fc4\ArkanoidGame.513aa147\run\www}
MultiException[java.lang.RuntimeException: Error scanning file ArkanoidGame$1.class, java.lang.RuntimeException: Error scanning file ArkanoidGame$1MyHandler$1.class, java.lang.RuntimeException: Error scanning file ArkanoidGame$1MyHandler.class, java.lang.RuntimeException: Error scanning file ArkanoidGame.class]
at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:536)
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:447)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:479)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1337)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:898)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:705)
at com.google.gwt.dev.DevMode.main(DevMode.java:432)
Caused by: MultiException[java.lang.RuntimeException: Error scanning file ArkanoidGame$1.class, java.lang.RuntimeException: Error scanning file ArkanoidGame$1MyHandler$1.class, java.lang.RuntimeException: Error scanning file ArkanoidGame$1MyHandler.class, java.lang.RuntimeException: Error scanning file ArkanoidGame.class]
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:681)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:824)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.base/java.lang.Thread.run(Thread.java:834)
Suppressed: java.lang.RuntimeException: Error scanning file ArkanoidGame$1MyHandler$1.class
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:708)
... 10 more
Caused by: java.lang.UnsupportedOperationException: This feature requires ASM7
at org.objectweb.asm.ClassVisitor.visitNestHost(ClassVisitor.java:150)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:550)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:702)
... 10 more
Suppressed: java.lang.RuntimeException: Error scanning file ArkanoidGame$1MyHandler.class
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:708)
... 10 more
Caused by: java.lang.UnsupportedOperationException: This feature requires ASM7
at org.objectweb.asm.ClassVisitor.visitNestHost(ClassVisitor.java:150)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:550)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:702)
... 10 more
Suppressed: java.lang.RuntimeException: Error scanning file ArkanoidGame.class
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:708)
... 10 more
Caused by: java.lang.UnsupportedOperationException: This feature requires ASM7
at org.objectweb.asm.ClassVisitor.visitNestMember(ClassVisitor.java:236)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:660)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:702)
... 10 more
Caused by: java.lang.RuntimeException: Error scanning file ArkanoidGame$1.class
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:708)
... 10 more
Caused by: java.lang.UnsupportedOperationException: This feature requires ASM7
at org.objectweb.asm.ClassVisitor.visitNestHost(ClassVisitor.java:150)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:550)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:974)
at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:702)
... 10 more
2020-12-13 10:41:02.813:INFO:oejs.ServerConnector:main: Started ServerConnector#2f067ac5{HTTP/1.1}{127.0.0.1:8888}
2020-12-13 10:41:02.815:INFO:oejs.Server:main: Started #18361ms
Dev Mode initialized. Startup URL:
http://127.0.0.1:8888/ArkanoidGame.html
[ERROR] 503 - GET /ArkanoidGame.html (127.0.0.1) 305 bytes
Request headers
Host: 127.0.0.1:8888
Connection: keep-alive
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7
Response headers
Date: Sun, 13 Dec 2020 09:41:03 GMT
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 305
Upgrade the ASM or Jetty versions to the one which supports Java 11+ version. See https://github.com/eclipse/jetty.project/issues/2941
I am developing a web application and get this error but can't make sense of it (I've looked at similar questions but the answers there don't seem to apply to my problem)
Can anyone make sense of this?
Please help me.
[WARN] Exception while dispatching incoming RPC call
java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to java.lang.Exception
at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:177)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
at org.realityforge.gwt.cache_filter.GWTGzipFilter.doFilter(GWTGzipFilter.java:57)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at ... (more eclipse.jetty...)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)
[ERROR] 500 - POST /webproj/login (127.0.0.1) 57 bytes
Request headers
Host: (...)
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: text/x-gwt-rpc; charset=utf-8
(leaving some stuff out)
Connection: keep-alive
Response headers
Content-Type: text/plain
I am getting jackson deserialisation error when I upgraded spring cloud netflix from 1.3.0.M1 -> 1.3.0.RELEASE.
The Post request that I hit is
Received [POST /wms-mdm/catalog HTTP/1.1
Host: localhost:8093
Content-Type: application/json
Origin: http://localhost:8093
Accept-Encoding: gzip, deflate
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50
Referer: http://localhost:8093/wms-mdm/swagger-ui.html
Content-Length: 99
Accept-Language: en-us
With Data
{
"clientCatalogId": "7",
"shortDescription": "Dummy Catalog",
"longDescription": "Dummy Catalog"
}]
The error I am getting is:
com.fasterxml.jackson.databind.JsonMappingException: Could not find creator property with name 'id' (in class com.gor.platform.mdm.core.pojo.Catalog)
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.DeserializationContext.reportMappingException(DeserializationContext.java:1234) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.addBeanProps(BeanDeserializerFactory.java:551) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:226) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:141) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:403) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.deser.DeserializerCache.hasValueDeserializerFor(DeserializerCache.java:191) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.DeserializationContext.hasValueDeserializerFor(DeserializationContext.java:421) ~[jackson-databind-2.8.7.jar:2.8.7]
at com.fasterxml.jackson.databind.ObjectMapper.canDeserialize(ObjectMapper.java:2713) ~[jackson-databind-2.8.7.jar:2.8.7]
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canRead(AbstractJackson2HttpMessageConverter.java:162) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:195) [spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:150) [spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:128) [spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
When I downgrade netflix cloud to old version things works fine. Anyone can help?
Adding explicit dependency for jackson-databind 2.8.8 solved the issue. Looks like some problem with 2.8.7
Recently I got a requirement from one of our customer. They provided a WSDL to call their service. They are doing IP whitelisting for authentication. I gave my server public IP and it got whitelisted. First, I tested that service through SOAP UI tool and it got worked without any issues. Then I integrated through JAVA code and it got failed. I am getting an exception like
Unable to sendViaPost to url[https://apps.greystar.com/gsWebService/gsExtract.asmx]
org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.handleResponse(HTTPSenderImpl.java:343) ~[axis2-transport-http-1.7.1.jar:1.7.1]
at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:213) ~[axis2-transport-http-1.7.1.jar:1.7.1]
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:121) [axis2-transport-http-1.7.1.jar:1.7.1]
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:403) [axis2-transport-http-1.7.1.jar:1.7.1]
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:234) [axis2-transport-http-1.7.1.jar:1.7.1]
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431) [axis2-kernel-1.7.1.jar:1.7.1]
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399) [axis2-kernel-1.7.1.jar:1.7.1]
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225) [axis2-kernel-1.7.1.jar:1.7.1]
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150) [axis2-kernel-1.7.1.jar:1.7.1]
at com.reputation.r4e.integrator.greystar.ExtractDataStub.greystarExtract(ExtractDataStub.java:300) [classes/:na]
at com.reputation.r4e.integrator.recordreader.GreystarLocationImportRecordReader.getGreystarExtractResponse(GreystarLocationImportRecordReader.java:198) [classes/:na]
at com.reputation.r4e.integrator.recordreader.GreystarLocationImportRecordReader.process(GreystarLocationImportRecordReader.java:97) [classes/:na]
at com.reputation.r4e.integrator.impl.DefaultPipeline.flow(DefaultPipeline.java:33) [classes/:na]
at com.reputation.r4e.integrator.impl.DefaultPipeline.process(DefaultPipeline.java:52) [classes/:na]
at com.reputation.r4e.integrator.importer.NullImporter.process(NullImporter.java:38) [classes/:na]
at com.reputation.r4e.integrator.impl.DefaultPipeline.flow(DefaultPipeline.java:33) [classes/:na]
at com.reputation.r4e.integrator.impl.DefaultPipeline.process(DefaultPipeline.java:52) [classes/:na]
at com.reputation.r4e.integrator.IntegrationRunner$IntegrationRunnable.run(IntegrationRunner.java:87) [classes/:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
It's saying 401 unauthorised error. How it got worked through SOAP UI and why its not working through a JAVA client.?
I monitor http traffic through TCPMon and except headers all are same. So I added the headers which got from the SOAP UI tool to my JAVA Client but still no luck. I am getting the same 401 unauthorised error.
Here are the soap request of both SOAP UI and through JAVA Client.
SOAP UI Request:
POST https://apps.greystar.com/gsWebService/gsExtract.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8;action="https://apps.greystar.com/greystarExtract"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Content-Length: 692
Host: apps.greystar.com
Connection: Keep-Alive
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:apps="https://apps.greystar.com/">
<soap:Header/>
<soap:Body>
<apps:greystarExtract>
<apps:axmlVendorCode>VENDOR_CODE</apps:axmlVendorCode>
<apps:axmlToken>PASSWORD</apps:axmlToken>
<apps:axmlExtractType>PROPERTY_LIST</apps:axmlExtractType>
<apps:axmlFormat>XML</apps:axmlFormat>
<apps:axmlParameters></apps:axmlParameters>
</apps:greystarExtract>
</soap:Body>
</soap:Envelope>
JAVA CLIENT Request:
POST /gsWebService/gsExtract.asmx HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8; action="https://apps.greystar.com/greystarExtract
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36[\r][\n]
Connection: Keep-Alive
Host: apps.greystar.com
Transfer-Encoding: chunked
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header />
<soapenv:Body>
<ns1:greystarExtract xmlns:ns1="https://apps.greystar.com/">
<ns1:axmlVendorCode>VENDOR_CODE</ns1:axmlVendorCode>
<ns1:axmlToken>PASSWORD</ns1:axmlToken>
<ns1:axmlExtractType>PROPERTY_LIST</ns1:axmlExtractType>
<ns1:axmlFormat>JSON</ns1:axmlFormat>
<ns1:axmlParameters></ns1:axmlParameters>
</ns1:greystarExtract>
</soapenv:Body>
</soapenv:Envelope>
Note: I added JAVA Client headers by looking at the SOAP UI headers. The actual JAVA client headers are below
POST /gsWebService/gsExtract.asmx HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8;
action="https://apps.greystar.com/greystarExtract
User-Agent: Axis2
Host: apps.greystar.com
Transfer-Encoding: chunked
What could be the reason for failing this through JAVA client.? Can any one please answer my question because I stuck over here.
Thanks in advance,
Amar.T
I tried other third party libraries and its working as expected. I tried CXF and SOAP UI JAVA API and its working as expected. I don't know why its not working with APACHE AXIS2.
If anyone finds the answer why its not working with AXIS2 please post the answer.
Thanks & Regards,
Amar.T
I have created a webservice using jersey for my Jave EE web application created using servlets.I find that I get a 415 error code.
I usually either redirect to another servlet or to a jsp which is technically a servlet in my app.Which mime-type should I use?
SEVERE: A message body reader for Java class javax.servlet.http.HttpServletRequest, and Java type interface javax.servlet.http.HttpServletRequest, and MIME media type application/octet-stream was not found.
The registered message body readers compatible with the MIME media type are:
application/octet-stream ->
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.RenderedImageProvider
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
com.sun.jersey.core.impl.provider.entity.EntityHolderReader
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
This is the network tab in Google Chrome:
Remote Address:127.0.0.1:8180
Request URL:http://localhost:8180/GoogleMapsLoadingTest/MainService?
scenario=c&operation=1&objkey=000001&objtype=EQUI&gisuniqkey=fsfsfsfs2436353535
Request Method:GET
Status Code:415 Unsupported Media Type
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,en-AU;q=0.6,en-GB;q=0.4,te;q=0.2
Cache-Control:max-age=0
Connection:keep-alive
Cookie:JSESSIONID=6ECE1D6B441026B523FA64E66F869C55
DNT:1
Host:localhost:8180
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/34.0.1847.132 Safari/537.36
Query String Parametersview sourceview URL encoded
scenario:c
operation:1
objkey:000001
objtype:EQUI
gisuniqkey:fsfsfsfs2436353535
Response Headersview source
Content-Length:0
Date:Sat, 26 Apr 2014 10:48:33 GMT
Server:Apache-Coyote/1.1
UPDATE:
Removed all the annotations for the code and added the servlets to the web.xml file:
SEVERE: Servlet /GoogleMapsLoadingTest threw load() exception
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1274)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Is it even advisable to use my servlet package as the one with the web-service?
Add #Context attribute to the HttpServletRequest parameter of your service method