difficulty in deploying struts 2 application - eclipse

I am a beginner with struts2 and I have few struts2 projects downloaded from a website, but they all are created as simple java projects and not as web-projects, so I am unable to deploy them on my Tomcat or JBoss AS server through Eclipse.
How can simple java projects be deployed on a Java EE server?

Your best bet is download sample applications from Struts2 official sites and deploy them on any of the server of your choice.
Those sample application comes with all required dependencies as well will give you idea about structuring of S2 application as well flow and configurations

I created a structure similar to the one shown on website and manually added all the files required and it worked.

Related

Maven archetype for java ee 6 and eclipse

I need to create a java ee 6 project which contains:
JSF
EJB
JPA
The Web-things should be compiled to a .war file, the ejb to the ejb-jar and overall into an ear file. The application will be deployed to a Glassfish v3.
I was looking for a maven archetype which I can use and integrate into Eclipse. However I haven't found one. Can you help me?
I consider Andy Gibson's Knappsack Archetype as a good starting point for what you are looking for. It gives you certain levels of working projects from a very basic setup to one filled with examples.
Alternatively, Adam Bien's Weblog is always a good place for finding simple solutions as for example a minimal project setup.
The Java EE MVC Security Archetype is a quickstart for websites that want user self registration and security configuration.
You can try it out on Openshift, though sometimes you have to wait a couple of minutes for openshift to load and start the application.
The archetype includes the following technologies:
Java EE MVC web application for Wildly 9 environment
JSF 2.2 and Bootstrap
JPA 2.1
H2DB (H2 Development Database)
JUnit/Arquillian/Drone/Graphene for testing
Java EE SecuritySupported by JBoss/Wildfly Database Module
Please note: This post is self-promotional.

How to run/debug java web service project in 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.

jBPM and JBoss web app

Ok I'm having quite some issues setting both jbpm and jboss working together...something as simple as running the jbpm process from a servlet is trunning to be a pain and all because jBoss can't find classes.
I made a Dynamic Web Project and didn't use Maven project so things are cleaner...and because it should work.
I just want to load a jbpmn2.0 from the repository in a servlet and run it using a WorkItemHanlder....but I get this:
java.lang.ClassNotFoundException: org.drools.runtime.process.WorkItemHandler
For some reason jBoss can't find a class from jBPM that should work on JBoss. What I did....and I think it's not the right solution...was add the knowledge-api.jar to the WEB-INF/lib. Although I can now deploy the app when I try to run it I get:
Error Unable to instantiate service for Class 'org.drools.builder.KnowledgeBuilderFactoryService'
I Honestly don't get why is it so hard to make a Jboss Web app using jBpm.
You need to make sure all dependencies are on your classpath, this is the same for all Java applications (not just jbpm) and application servers (not just JBossAS).
Which jars did you add? Depending on which features you are using, there could be quite a number of jars that you need to add. One option would for example would be to extract the jars in the jBPM runtime zip that is part of the jBPM downloads into your WEB-INF/lib.
If you use Maven, you would be able to automatically derive all required jars.
Kris

building development environment for GWT with JBoss

I am using eclipse IDE and want to build up a development environment for creating an app.
I have an EJB module on Jboss5 and would like to add a GWT project.
I could see that GWT during development is executed on it's development host mode, but the problem is that in this case I can not local EJB services deployed on my JBoss.
Is there anyway to overcome this challenge? how can I use the eclipse along with JBoss to develop, run and debug GWT application? I don't mind using ANT script in order to compile and deploy on JBoss, just need to know if this is possible (Also to debug the GWT application).
Thanks in advance.
Best regards.
There is a sample setup to use JBoss Tools with GWT and GWT Plugin. http://community.jboss.org/wiki/UseJBossToolsWithGoogleGWTPlugin
Strelok's sample page now recommends following the guidelines for creating a GWT project using a general Eclipse Web Tool Project approach.
https://community.jboss.org/wiki/CreateGWTProjectsWithJBossToolsAndEclipseWTP

Consuming Web Services in Netbeans

I've setup a project in Netbeans 6.5 with some web services that I've created myself and some web services that I've imported from WSDL files. I've setup a couple of desktop application through Netbeans in order to consume these web services. I'm not too sure where to go from here.
I have the GUI setup but not sure how to reference the web services so they can be consumed. I was wondering would anybody be able to guide me through this process or point me in the direction of a relevant tutorial. I'd also like to learn how to consume a web service through a JSP (also created in Netbeans) if possible.
Thanks.
You may find this tutorial useful:
http://netbeans.org/kb/docs/websvc/client.html, but since you are using Netbean 6.5 this may be the correct version:
http://netbeans.org/kb/61/websvc/client.html. As the steps show, it isn't difficult to build a jax-ws client using Netbeans.
But, it depends on what version of Java you are using also, most likely. You may want to download the latest version of jax-ws, if you get errors with your wsdl.
For a JSP, just create a custom tag to call the client.