I was wondering how can you deploy a Jar file that contains a self-contained app (grizzly) with Jersey framework to AWS Elestic Bean, I've been trying to deploying it by choosing the genereated jar file. But Beanstalk always throws an error. I haven't been able to make it work on AWS. I'm compiling the example that comes with the artifact jersey-quickstart-grlizzly. Any guide of how to do it will be more than welcome!
What i've done so far
Create an instance of AWS Beanstalk.
Set as platform JAVA.
Choose as source a JAR generated by maven build
Deploy.
Once it finishes, it says that the health has been changed to Degraded. That's all.
Update:
Looking for the error 502 I found a suggestion that says that I should run it by command prompt and see what happens. I have forgotten to add the main class attribute in POM. However, it's still showing the same message.
Perhaps, do you have any example of a working example with grizzly that I can deploy to AWS and use for getting started?
After some research I finaly found that the problem was the Port. Perhaps, someone else face this issue because the lack of experience with Java an those frameworks which is my case.
Build your jar as usual an then:
Go to beanstalk.
In the beanstalk intance where select the environment.
Click on the configuration section and edit "Software"
Add a property called SERVER_PORT with value 5000*.
This will redirect to the right port.
Related
I'm trying to migrate some legacy GWT applications from eclipse to IntelliJ. Oh man, what a nightmare. I've come very near to a dead end with my research. I'm at the point where there is simply no related page or documentation that I have not seen, not to mention the information on this topic is very, very sparse.
My setup is as follows:
IntelliJ IDE
GWT 2.9 plugin
Jetty Runner that is using Jetty v11.0.7
Here are my GWT and Jetty debug configuration settings:
When I navigate to the jetty server URL I always get "Error 404 Not Found" message.
Now, when I navigate to the "Debug" directory that is specified in the GWT configuration I do see that there is no RSS.html which is a problem but even the "blank.html" is not able to be navigated to. One potential issue is maybe I am somehow not compiling the debuggable version of the GWT application correctly?
My other guess is that I have to somehow point to an actual .war file. I do have an ant build script that works just fine and generates a .war that works correctly in production. Below is a screenshot of the generated war file as well as the directory used to build the war archive.
In summation, how do you correctly debug a GWT application in IntelliJ using the GWT configuration with a Jetty Runner server?
I can promptly provide any additional info that I may have left out.
EDIT
I would like to add that this How to get GWT Super Dev Mode to work with IntelliJ question is very similar to what I am asking here and it was never edited with the correct answer, also since this was posted super dev mode was added. It would be great to get a clear solution documented for myself and others. To reiterate the answer needs to achieve these three things,
Use a Jetty Runner configuration (to enable use of different Jetty versions as there can be a cascade of conflicts depending on your codebase)
Use a GWT configuration to run a code server with the Jetty Runner instance so debugging is possible.
Use IntelliJ IDEA
i am still a beginner with spring boot, and i have a bunch of questions.
First of all, do i have to download maven in my pc and add it to my pc path envirement to make spring boot work correctly ?
Secondly, Spring boot wasn't able to work, was doing a hello world app and there were lot of errors on the console one of them is "SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".. why that ? i looked for the error and followed some mvn command line steps "mvn dependency:purge-local-repository", and my app finally worked.. but do i have to run this command everytime i create a spring boot app ? isn't everything supposed to be alright since it's only a hello world app ? ..
Thank you
Yes, you need to have installed maven or gradle in order to run your application. And it needs to be reachable, so you have to configure your system variables accordingly.
You can find more details here.
As per the maven error, maven keeps all the artifacts you need to run your application in a shared folder with all versions, sometimes maven could have corrupted files or a mismatch in version so you need to purge the repository and download artifacts again.
You can find a more detailed answer here.
Even when you are coding a simple application, spring-boot bring up a lot of code for supporting operations you may require, such code is self configured and hidden.
my application is running in eclipse but i want to run it on tomcat .i want to run my spring application in tomcat server and don't want to use eclipse or any other tool, so how can i do that and where do i put my various files basically the directory of it, and the complete procedure to do that.
main problem is in the directory structure and the path to be put in the tomcat server to run that application. i tried but it gives the 404 error file not found ,as i am new to the spring framework explain in detail
You are asking a very broad question. But, in an attempt to point you in the right direction please see this article. The link given provides insight into the directory structure of your application.
Now as far as running "outside of eclipse" you should be able to export your project from the "File" menu as a "Web Application Archive" or "WAR" file. This file can then be placed under ${CATALINA_BASE}/webapps and be launched when you start your container.
If you are using a stock configuration and you have an archive named "myapp.war", you can access it on
http://localhost:8080/myapp
I hope this information helps you get to where you need to go.
First export the war file using eclipse as you are using eclipse.
Then follow the procedure
How to deploy a war file in Tomcat 7
I have a problem in deploying the war file in Jboss7.0.2. when i deployed first time. it worked fine. i made few more changes(added one more end point) and after that i was not able to deploy the war. NO ERROR. but the new service is not getting deployed. But I am able to hit the old services.
steps i followed to deploy it,
1.stop the server
2.Remove the war file from
jboss-as-web-7.0.2/domain/servers/server-one/deployments/
3. Copy the new war file in to the same location.
4. Start the server.
do i need to do anything other than that? Please help me.
Instead of deploying by copying and pasting war files back and forth, use the native interface (CLI) or the http interface (admin-console). The deployment works differently in the domain mode.
I love the CLI interface to deploy files quickly. Example of deploying using the CLI in domain mode.
Make sure that jboss is running (domain.sh was executed)
Go to $JBOSS_HOME/bin.
run ./jboss-admin.sh -c (or ./jboss-cli.sh -c if 7.1 or later)
then run the following command in the CLI prompt:
4.1 To deploy: deploy <war_file> --server-groups=server-one
-->you should see a success/failure message
4.2 To undeploy: undeploy <war_file> --server-groups=server-one
-->you should see a success/failure message
For further reading please see here.
Hope this helps!
If you are binding to a specific ip address (or all ips) rather than localhost then
$ JBOSS_HOME/bin/jboss-cli.sh
The you will see
[disconnected /]
Type connect
you are no ready to deploy or undeploy
I have run into these issues at times and I suspect this is happening in development ONLY as you would put unstable code at times. steps I follow to clear the "bad" deployment
1) clear standalone/tmp
2) clear standalone/data
3) open standalone.xml - go to the end and clear and then restart Jboss. All your old deployments will be cleared.
Also as CoolBeans suggests above you would try to use the Admin console or the CLI.
If you are using Maven why not use Cargo plugin for Jboss and that will do a seamless deployment without you to manually copy to deployments - ofcourse unless you want to deploy in exploded format.
Sorry for this simple questions but i am too much confused with how to run java application. Whenever i ask some each one tells his own tools to proceed and i have learn that thing.
So provided i have simple basic eclipse with no plugin and i have downloaded the sample web application which uses spring , hibernate , mysql ,
The folder structure of app is
.setting
src--main,test
target
.classpath
.project
Now i want to run this using localhost in browser
what thing i need to do. i will tell from my knowledge and u guys can correct it
i don't want to use STS or install any plugin in eclipse.
I imported the project from eclipse
menu and i appeared on left window
As it uses spring do i have to add
the spring jar files in build path
of spring. or anything else
Same for hibernate jar files
Fior simple java app i used to
compile the class which contain the
void main function but i have no
idea which file to compile to run
this app
I added the mysql connector in build
path to connect with mysql in simple
java app. will same thing work here?
I knoow we need web server for that.
so if i want to install glass fish
server then how will i connect it to eclispe or that app. will tomcat be
ok than glass fish??? i know tthere
is eclispe ide with embedded glass
fish but i want integrate evrything
myself
IN browser i which url i need to use
to see that app
I don't know how did maven , appfuse fit in here. Can i run app without maven if yes then what does maven really do , i mean does it compile the java files or what. If i require maven then
Do i need to install it separately i
mean exe file or jar file
how to link with eclipse
I have read about building with
maven , what will ahppen after
building i mean what is the result
of building , will i see browser
after building or after building
there are some steps further. do
maven needs to link with web server
installed
sorry for basics questions but i am confused with all new trminology
Building a webapp is complicated. I will try and address your specific questions.
Utimately you don't need Maven or Appfuse, both can be very helpful.
Maven is a build tool. Maven and Eclipse do some similar tasks. Both can compile your code and manage a classpath. Maven handles a lot of things out of the box that Eclipse can't do by default. Maven can manage dependencies (i.e. download the spring jars for you) and create complex build processes.
If you are unfamiliar with Maven and creating a build file from scratch then it probably won't be much help. If you have a pom.xml (Maven build file) from somewhere else then Maven can be a big help. The result of Maven depends on how your build file is structured. The result is most often either a .war file (described below as step 5) or that your application is deployed directly to your web server (described below as step 6).
Appfuse is also not mandatory but can be useful. Appfuse will create a skeleton project for you. When it does this it will create a pom.xml (Maven build file) to automatically build your project. Appfuse by itself doesn't do anything other than help get projects started. Most people don't start building web apps from scratch anymore since getting the directory structure right and creating the build file can be a lot of work and it's easy to make mistakes. A tool similar to Appfuse is Spring Roo.
Tomcat, Glassfish, Jetty, and JBoss are web servers. They are also often called Servlet Containers which is just another name for a web server that hosts servlets in a certain fashion. Any of them will work for your project, they all have different learning curves. Integrating them into Eclipse may work for you, when I got started I found it was easier (although a little slower) to keep them separate.
In the JDK there is an interface named javax.servlet.Servlet. This is the interface that the entry class of your web application must implement. In particular the method service(ServletRequest req, ServletResponse res) is called every time there is a request for a URL. If you want your web application to respond to HTTP it may be simpler to extend the abstract class HttpServlet (which implements Servlet) instead. Most libraries (i.e. Spring web framework) have their own implementations of Servlet that are the entry point to the library.
I will now describe the basic process for building a web application. This is a complicated process and most people eventually automate it with Maven. I do not suggest trying to manually walk through the process yourself it can be very complicated but you can if you want. I am going to assume that you are placing all of your built files in a folder named $BUILD
Compile your source code. The compiled classes need to end up in a folder called $BUILD/WEB-INF/classes
Place all your jar files (external libraries) in a folder named $BUILD/WEB-INF/lib
Create a deployment descriptor, this is a file that tells your web server how to deploy your code. The most important thing in this file is a mapping from URLs to Java classes that implement Servlet. It should be named web.xml and put in $BUILD/WEB-INF
jar up the all this code with the root of the jar being at $BUILD. You could call this code application.jar
Rename the jar file extension to war. A war file is simply a jar file that has the required WEB-INF directory inside of it.
Deploy this war file to your web server (Tomcat/JBoss/Jetty/Glassfish/etc.), the process for doing this is different for each web server
That is the basics of web application deployment. Your web server will extract the war file and load all of the jars in the lib folder into the classpath. It will then take any URL requests it receives and send them to the appropriate Servlet implementations declared in your deployment descriptor.
As you can see this is not a simple process. This is the reason tools like Appfuse and Roo exist. They try and give you a starting point which does all of this basic stuff for you. If you are having trouble I would suggest trying again from scratch with Appfuse/Roo. As you start to get the hang of things I would also suggest learning more about Maven (or Ivy+Ant) to handle dependencies for you.
You should download the Java EE edition of Eclipse - it contains the code needed to work with enterprise applications.
You will also need an enterprise server (like JBoss or Glassfish) and the corresponding server adapter, which is a bit much for a beginner.
The easiest way to get started is to download Netbeans with Glassfish and use that instead - at least for now - as everything is configured correctly and it is very fast to get started! When you are more familiar with the way things work, you can switch back to Eclipse if you want to.