I want to use Jetty to upload file to my server I have tried the example from the Jetty documentation, but it doesn't work. It throws an exception:
java.lang.ClassNotFoundException: org.mortbay.servlet.MultiPartFilter
Since you say your using Eclipse Jetty the correct class package is:
org.eclipse.jetty.servlets.MultiPartFilter
Note that using the filter is not recommended for jetty-8 since the Servlet 3.0 spec added an alternative way to access this sort of information through the servlet API.
Related
Currently working an application that is moving from JBOSS 4 (java 6) to JBOSS 7.1 (Java 8). It had no REST WS - only SOAP and worked with Servlets.
I added my WAR containing a basic REST Service (ApplicationPath class with 1 resource class and a web.xml (empty since I'm using RESTEasy implementation which should scan my classes)) to the main EAR.
During deployment, I see no errors in my logs and it says my .war has been deployed and my web context registered.
However, whenever I call one of my resource's endpoint I get the default JBOSS response for Error 404 Not Found (the url is correct though) and when I try to call the same URL but by using PUT or POST I get the message "Http Method POST is not supported by this URL" which is typically an error from Custom Servlets.
Is it possible that another Servlet is listening to my path or taking over things? Even if outside of my web context? How could I investigate/debug this?
The problem came from the old RESTeasy Version - 3.0.7-Final that was being used, which has some known bugs with the #ApplicationPath annotation and web.xml configuration. After using the provided version of RESTeasy from the JBOSS 7 (version 3.6.1-SP2), everything worked like a charm.
I am using Google App Engine STANDARD (SDK 1.9.62) and have set my appengine-web.xml to use java8 runtime and trying to get a simple servlet example. Works as expected in local dev server but gives me a 404 error in the google cloud. I WANT to use the Google App Engine standard environment (not flex). Is there a yaml entry or xml entry I need to turn on for this to work? How can I be sure that GAE is using the 3.1 servlet spec and not 2.5?
App Engine Standard uses appengine-web.xml, whereas Flexible uses app.yaml.
Now, this Java-docs-sample us using the pom.xml to set dependencies. you can see the versions of the dependencies set there.
In this case, that sample can be deployed with mvn appengine:deploy and the endpoint serving in App Engine would be /requests. i.e https://project-name.appspot.com/requests which should return a "hello, world"
Ok. Mystery solved. I had two versions running in deployment and an original java7, servlet 2.5 api version was handling all traffic. My INTENDED version, which was a java8, servlet 3.x was sitting idle and getting 0% traffic. Once I used the version migration function in google's cloud console, the servlets annotated with servlet 3.x annotations started working.
I am having a WAB application which is just having only one html file, and its working fine. the code is available on the below git link
https://github.com/vineethvnair0/Karaf/tree/master/first-wab
Now I want to define a rest service in the wab, with the same context root as my web app for example like below.
http://localhost:8181/first-wab/rest/hello
Please let me know how can i do it?
Simply add a CXF servlet to the web.xml. The exact solution depends on how you expose your Rest endpoints. Do you plan to use spring?
I am trying to implement a code in our application which needs to monitor the existing registered resources in Jersey and then make decisions accordingly. I know that Jersey provides an application.wadl file which consists of all its resources at runtime.
My question is there a way to look at this file physically? Does Jersey create this file and store it somewhere in the app directory or is it in memory?
Is it possible to call any Jersey api internally on server to get the same info if this particular file is not available like that?
We are using the application class or runtimeconfig. Jersey auto discovers our resources marked with #Path annotation and we are running on Weblogic and Jersey 2.6.
Any help would be appreciated.
Thanks
No WADL file is created on disk. It is created dynamically upon URL request.
http://[host]:[port]/[context_root]/[resource]/application.wadl
E.g.:
http://localhost:8080/rest-jersey/rest/application.wadl
Also, I've found it very useful to inspect the WADL with the SoapUI tool, which can read your WADL from a URL and parse the resources into a tree format. See pic below.
i followed this article: http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/
so i have:
HelloWorld http://pastebin.com/BJ3QA7pR
HelloWorldImpl http://pastebin.com/RM5SBZ5C
HelloWorldPublisher http://pastebin.com/H525WevK
which serves as the endpoint.
on the other side i have the client which i generated with wsimport:
HelloWorld http://pastebin.com/g07H1exf
HelloWorldImplService http://pastebin.com/f0YWMiYt
this runs fine in eclispe without alfresco being involved. however, i want to call the webservice from alfresco (from java backed web script for example)
i tried to copy the client side stuff to my amp file and calling it from a webscript but it fails!
Caused by: java.lang.IncompatibleClassChangeError: Class com.ibm.wsdl.DefinitionImpl does not implement the requested interface javax.wsdl.extensions.AttributeExtensible
Webscript http://pastebin.com/7JksRdtU
1 - is there a more elegant way to configure the access to the wsdl by defining a spring bean (spring-ws) or such
2 - why is it not working? full trace: http://pastebin.com/ak1qzygA
using alfresco community 5.0.a
thanks
You will see IncompatibleClassChangeError usually when the dependancy/library jar has changed. Hence the method/code dependant on the library has to be recompiled against the changes.
Guessing the problem here has much to do with some dependancy jar being mispicked or an older version of jar present or one jar prioritized over the other. A look into the jars containing 'com.ibm.wsdl.DefinitionImpl' class in your classpath should be of some help.