How to run/debug java web service project in eclipse - eclipse

I have a Java Web Service project which was just handed over to me by a colleague who just resigned (no one is assisting me in my new company). Im new to Java (J2EE) and my background is .Net + frontend + azure so I am pretty much very confused with setting up and running the java project. Also, Since my background is .Net Im referencing everything with how things work in Visual Studio from running a project, setting up a project to setting up and debugging a WCF project which I realized now is very different from eclipse + java.
I would really appreciate if someone could explain to me how I can run this project which is supposedly a java web service (as I was told)?
First I have a project that is like this:
Im assuming that the project boxed as blue is the webservice (and the rest are just libraries)? Is this correct? if so how do I run and debug the project using eclipse
Second when I click on debug as -> debug on server this is all I see:
Another colleague told me to install JBOSS (I haven't installed a server in eclipse) because that is what they used. Is there good documentation (step-by-step guide) on how to install JBOSS to run in eclipse. Im assuming that JBOSS + eclipse is like IIS express + Visual studio. Are there also other alternatives to JBOSS + eclipse like perhaps tomcat + ecplise that I can configure.
I really really find it hard to setup the java web service project in eclipse I have little to no prior experience with java j2ee programming especially with web services so any clarifications with my questions would be much appreciated. To sum up:
How would I really know that the project is a java webservice?
If so, how do I run the project and host the project using debugging in eclipse with tomcat or jboss?
I would appreciate if anyone can point me to the right direction of figuring out the source code

From here we can only guide you, you will have to go through some tutorials to understand how java projects work.
Your project is a webservice project according to your web.xml file because its having context params for rest.
the context param sets a front url to your webservice which in this case is gametime.
Check these tutorials and you will understand how it works
http://www.mkyong.com/tutorials/jax-rs-tutorials/
Create simple examples given in the above tutorial and then you can execute your's program
Jboss is a application server which we use to run our app.
You can install jboss in eclipse or you can use it externally also.
To install eclipse and jboss you can follow the link
http://theopentutorials.com/tutorials/java-ee/installing-jboss-tools-in-eclipse/
The other option is to download eclipse and jboss seperately
and use them.
Go to jbosshome/bin
If you download both of them seperately
then in that case for jboss
Invoke the add-user.sh or add-user.bat script. ...
Choose to add a Management user. ...
Choose the realm for the user. ...
Enter the desired username and password. ...
Choose whether the user represents a remote JBoss Enterprise Application Platform 6 server instance. ...
Enter additional users. ...
Create users non-interactively.
After this go to eclipse and follow steps of below link to add jboss to eclipse
http://www.mastertheboss.com/eclipse/jboss-eclipse/jboss-and-eclipse

A Java web application among other things has a predefined directory structure including folders named WEB-INF, WEB-CONTENT etc.
On how to deploy a web application to Tomcat via Eclipse you can follow the steps in this tutorial.

Related

Integrating JBOSS and Eclipse

I have JBOSS server. I used to make web applications using just notepad++. I used to create the necessary folders like web-inf and files like web.xml. For larger projects doing all this and manually compiling has become cumbersome. I want to use eclipse for that. I saw this tutorial - http://www.eclipse.org/webtools/community/tutorials/BuildJ2EEWebApp/BuildJ2EEWebApp.html . But I don't understand how to make a server. I already have a server. What I want to do is write JSPs and Servlets in eclipse and the build should automatically be deployed in jboss server.
How to to this?
Install JBoss Tools
After that follow the instructions from here to get started and deploy apps to JBoss Server.
To automatically deploy apps after the build you could use a build tool such as ANT or Maven.
I wrote a tutorial for this some time ago: Setting up web development environments with Eclipse
It shows how to setup JBoss within Eclipse (in addition, it also shows how to setup Tomcat and Weblogic), and also shows how to build a simple sample Servlet to verify the proper installation.
If you already use JBoss on the server side, then have a look at the client side as well: http://www.jboss.org/developer
(I haven't tried it myself, but...)
Just open eclipse then go to:
"Help-> Check For Updates" It will check for eclipse updates and installs new availables.
Now "Help -> Eclipse Market Place" Search for "Jboss tools" from search result select one(as your eclipse version) and install it. It will add adapter for new jboss versions.
Now add new server from server view select Jboss version then next add your Home directory of jboss. Then finish.
Step 1 is optional but it sometime it helps.

Ejb with NetBeans

I am very new in Ejb and with very few knowledge about it. I have download NetBeans (7.01) and GlassFish and run a sample program. But, as I have no idea about Ejb, I can't understand how to run this program on NetBeans. Can anybody help me by giving steps how to run this program. Thanks in advance.
NetBeans installs on default GlassFish web application server, which deploys your enterprise projects. To ensure that server is registered in the IDE, go to Services -> Servers inlay and look for "GlassFish Server 3.x". If you found it, open projects properties inlay: right click on your enterprise project -> Properties -> Run and make sure, that "Server" is set to "GlassFish Server 3.x". Then you can deploy you enterprise application: right click on project -> Deploy. IDE should start application server and deploy your application. To run your deployed project right click -> Run or type in the browser address, given in your tutorial, which is mapped to your resource (e.g. http://localhost:8080/book). In this way GlassFish doesn't require additional settings files except persistence.xml in your ejb project and web.xml in the web project.
In case you don't have GlassFish server installed, you can download it here. Make sure you don't have it already installed separately from NetBeans.
If you want to deploy your app on JBoss application server (instead of GlassFish), you should first download it from official site and install. After you've done it, you can set it as server in NetBeans: Services -> Servers -> Add server. Then you can deploy your project as was described above.

Cannot find OpenPortal Portlet Container 2.x when creating a new server runtime environment in eclipse

I just started learning portlet and got stuck in the first place. I have installed JavaEE 6 SDK, Eclipse Helios and GlassFish Server 3.0.1. I also successfully configured OpenPortal Portlet Container (OPC) for GlassFish by running command:
java -jar portlet-container-configurator.jar
The problem come up when I wanted to create a new server runtime environment of OPC, there was no "OpenPortal Portlet Container 2.x" node like the tutorial said. I googled and found that I needed to install Eclipse Portal Pack but the link was dead.
Any suggestion, please?
Best Regard.
If you want to develop portlets, I strongly recommend downloading Apache Pluto instead of using the open portlet container; you can download a version of Tomcat bundled with Pluto from their site: http://portals.apache.org/pluto
Actually, Pluto has a few quirks that you need to get past (for example, it wants you to run an 'assembly' step to add some entries to your web.xml) but once you do it is probably the best way. You could also try Liferay or JBoss' GateIn for development, but if you are ultimately targeting a vendor supplied platform like WebSphere, you might find that these actually have features that aren't as portable, whereas Pluto is really just a simple implementation of the portlet spec.
I have found the .jar file on Internet. Thanks for watching.

Tomcat issues inside eclipse

I am very new to Tomcat and web development in general and apologize for what may be a very silly question.
Consider 2 situations:
1.
I start Tomcat outside of Eclipse.
I use eclipse to create a war file.
I deploy it via admin console.
All is ok
2.
I start Tomcat via Eclipse
I can't access admin console
http://localhost:8080/manager/html greets me with 404 error
Same page is behaving properly when Tomcat is started outside of Eclipse
Please advise
Why might the issue be?
Why might the issue be?
You need to configure Eclipse to take control of your Tomcat installation. To do so:
double click on the Tomcat Server in the Servers view
under Server Locations, select Use Tomcat installation
This is illustrated on the screenshot below:
Eclipse creates a new Tomcat configuration separate to your Tomcat installation, in the 'Servers' project. This allows Eclipse to deploy webapps without interfering with anything you've done in your installation (via the manager app or by editing config files manually).
You can reconfigure Eclipse so that it uses the config from your Tomcat installation (see Pascal's answer), or to re-enable the manager app - but read the WTP Tomcat FAQ first as there are good reasons for it working the way it does. I don't recall ever needing to do this - the 'Servers' tab in Eclipse lets you deploy/start/stop/debug/configure apps as required.

How to redeploy the web app using the Eclipse IDE

Im new to Eclipse. I use Tomcat as my run time server, but every time I modified the jsp pages, Eclipse was still displaying the older one. Just wondering how to redeploy the application so the changes can be reflected.
Eclipse: Eclipse IDE for Java EE Developers 1.2.1.20090918-0703
Tomcat: Tomcat 6.0
Thanks
Doubleclick the server instance in question in the Servers view to open its configuration. Now, in the right top you should see a section called Publishing. Open it to verify and configure autopublishing settings.
Eclipse should do that automatically for you.
Otherwise, on the Servers view (Menu Window->Show View->Servers), you can right click on your Tomcat instance and hit "Publish" or "Restart"
Make sure you have the "JST Server Adapters" ("Web, XML and Java EE Development category") feature installed.
Eclipse's publishing functionality requries the project to be a "web project", and in some cases requires additional configurations.
Go to Windows > Preferences > Server > Runtime environments and add your tomcat
Either try using publishing, or (better I think) use the FileSync plugin. There you can tell which folders from your project should be copied (live) to what directory on your machine (the tomcat/webapps/yourapp). With a little more effort the filesync configuration can be made machine independent (only using one parameter as TOMCAT_ROOT), in case you want to check-in the project to a repository where others will use it.
Get the Tomcat plugin. It was nice because you can install Tomcat on your system and then associate your web app with that instance of Tomcat. The plugin will let you stop/start Tomcat and define a server such that when you do a build it knows how to deploy the changes. There may be some newer plugin but the Tomcat plugin worked for me and was fairly simple to install and use. Here is a page from IBM on using Eclipse and Tomcat. Inside that page it points you to the following: http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/