I've Googled how to but I can't seem to find a step-by-step guide for a beginner. I just want to make sure a class is working and printing fine. A lot of tutorials said to just put the URL in the browser but I don't even know how to get the URL of my web service.
What I've done so far:
1. Created a WAR file out of the project
2. Deployed the WAR file on Tomcat
By default, the path will be based on the name of your WAR file, but can be easily configured.
see this response: How to set the context path of a web application in Tomcat 7.0
Related
I have got a webService without ui. It simple jax-ws app that will allow to manage users via soap requests. I tried to deploy it on websphere. It was deployed, But! my app doesn't appear in Service Providers and i can't get access to wsdl file via url that i pass in wsdlsoap:aderess location. It haven't got any servlets and other stuff. I create my app using template that deploy with success, it appear in Service Providers. I research all internet, but idk what go wrong.
P.S: Template project was eclipse project. I just add maven and has no idea why it wouldn't work.
The fact that your web service hasn't appeared in the Service Providers section means you've deployed it the wrong way.
Check whether you've selected the "Deploy web-services" option during deployment.
You probably got an issue in your trace.log file which possibly references to the ffdc, check it to investigate the problem.
You also haven't mentioned if you using servlet or EJB-based web services.
I am trying to deploy a simple java rest service using webapp-runner in heroku, i follow the instructions in documentation and everything perfect, i run my app and is working cause i can see my html welcom page, the problem is that i cant access to my rest resources with the path i provided even in a local deploy http://localhost:8282 this is the path when i open my app, http://localhost:8282/wr/test and this should show a simple get method, but doesn't work neither local with webapp-runner nor remote in heroku, this is the link https://appbergas.herokuapp.com/ , what am i doing wrong? which should be the complete uri i thought https://appbergas.herokuapp.com/wr/test
im using javax ws rs,also when i deploy it in glassfish everything goes great.
Well,I'm working on an Eclipse Dynamic Web Project under Tomcat.
I'm trying to make a web application/site.In a jsp/html page,there is a form where a user can upload a photo.
I handle then this action from a servlet that has to store this image/file somewhere so as to make it possible the image appears whenever I want on the site.
Here is the problem.I started by storing it on my file system,(path in a database) but when I wanted to retrieve it the page didn't appear.
I guess the reason is here:
Why can't I do <img src="C:/localfile.jpg">?
Then,I tried to store the file in the eclipse project folder(WebContent/folder) where I've stored manually some images that do appear.
File folder=new File("/TED/res/img");
File file=new File(folder,fileName);
System.out.println(file.toPath());
Files.copy(fileContent, file.toPath());
But this exception happens:
java.nio.file.NoSuchFileException: /TED/res/img/2017-08-13-123524.jpg
It's one the line of files.copy command which means that
new File(folder,fileName) that I tried failed
What should I do? From what I've read,I understood that also saving file in the IDE's project folder is also wrong but what other choice do I have?
Ultimately, the project will be deployed to a server. As such, there are three distinct issues:
Uploaded user content location: content like images should be uploaded to a folder outside your web app (project). Images inside the web app (project) should be those that are necessary for the application and provided by the developer, not user-generated.
In Eclipse, during development and testing, you will want to serve these images through Tomcat. There are many ways to do this. Tomcat configuration is probably not the best for this - please read the answer and discussion here: Simplest way to serve static data from outside the application server in a Java web application
Once the application is deployed to the server, Tomcat will most likely run behind a Web server like Apache or Nginx. In this case, the external image folder and its contained files can be served directly by the Web server. Even if you implemented a servlet in (2) for local testing with Eclipse and this servlet is part of the code that is deployed, it will not be invoked as the URL will be intercepted by the Web server before it reaches Tomcat. For example, if your uploaded image folder is C:\images on your development environment, it can be served by the servlet using the technique in (2) as /images/*. When deployed to a server, the Web server can be configured to servet /images/* from /srv/content/images and this request will never reach Tomcat.
Basic question.
I've compiled and deployed to a local tomcat the war file that gets created in the sample cxf project java_first_spring_support (I followed the tutorial given here but using latest versions from cxf site : http://cxf.apache.org/docs/writing-a-service-with-spring.html ) but can't figure out how to test if it's working? my tomcat manager list apps page says it's running but not sure what to do beyond that.
Can I hit it with a http request via the browser to see the wsdl? If so what url should I use beyond my 'http://localhost:8080' url?
Is there no wsdl with this project and I should just craft my own soap request? and if so what should the structure be and what url should I use?
Well, figured it out. Went back to web.xml 101 and found my answer.
The generated wsdl is available from :-
http://localhost:8080/JavaFirstSpringSupport/services/HelloWorld?wsdl
Context of the app was : 'JavaFirstSpringSupport' (got this from my apps list page in tomcat) Got the services part by refering to the url pattern element in the deployed web.xml
I have created a jsp file which will give an output in JSON format using java class and servlet, i am new to java and i don't have idea about the deployment of jsp file. Can anyone suggest me how to do it? I used to develop an asp.net web application in which there was a specific option available which called " publish project", but i cant find in eclipse.
I already have a php server in which i have uploaded few php files, can i use the same server to upload this file?
Currently, my application is running fine on localhost.
Please help me with this matter and thank you for your time.
To publish your project in Eclipse:
Right click your project
Export
Under Web > Choose WAR
Then just follow the instructions and your good to go.
It is done as a component of a WAR (Web Application Archive) file.
Upon deployment, JSP files are processed by the Servlet container. The processing effectively turns them into Servlets, such that the plain text of the JSP becomes println statements in the response of the Servlet, and the embedded Java code in the JSP becomes regular Java code in the Servlet.
The packaging details are covered in detail in the JEE7 tutorial, although earlier tutorials don't differ much in the details.
i assume you are using tomcat in your php? you can use tomcat or glassfish server to deploy your application. you just need the .war file of your application and upload it to the admin page of tomcat or glassfish server.
It should be in .war file format
Here are few links which can help you in building it from eclipse, link1, link2.
For deployment, there should be a server -- tomcat / glassfish / jboss which can provide platform to execute .war files.
IDEs and .war files are great productivity tools, but I'm of a mind that you need to understand how these things work from the command line. I'm using Apache Tomcat running on a Raspberry Pi as a development server. I developed my .jsp and then just copied to where it needed to be. In this example login.jsp needs to be in the root folder of an app called SEM. So, just copy it there and access it via its URL.
sudo cp login.jsp $CATALINA_BASE/webapps/SEM
http://localhost:8080/SEM/login.jsp
Didn't even have to restart Tomcat. :)