Using AWS Elastic Beanstalk with a Java/BlazeDS/Spring application - java

Is it possible to deploy my Spring/BlazeDS/Java application to elastic beanstalk? I'm using MyEclipse and built a Java Web Project with the required jar files etc. Do you need to specifically create an AWS Java Web Project - reason I ask is the options to include the BlazeDS files aren't there - so I'm wondering if Spring / BlazeDS is even supported? By default the turnkey blazeds runs through Port 8400 - so I imagine there are some additional tasks required to configure the endpoints to work through port 80?
Gracias!

Take a look at this example. Will be trying something similar over the next few weeks.
http://www.riaspace.com/tag/aws/

BlazeDS is not a standalone application, it consists from a bunch of jar files which should be added to your web application. You will also need to declare a servlet in the web.xml file. I wrote an article a couple of years ago how to add the blazeds jar files to a java web application (and what to configure), you can take a look here.

Related

Spring Boot microservices Embedded tomcat vs External tomcat

I am building microservices(approx 15 to microservices) project for huge organization, I wants to know is it recommended to go for external tomcat with war file or just use the embedded tomcat of spring boot with jar file. Also I am facing issue after building my project on jenkins how to copy the file from jekins server to my server and run the file there and create and automatic build and deployment pipeline i.e. everytime I push the code it should be automatically deployed.
You need to identify what compels you to go for external tomcat deployment. As SpringBoot provides out of box facility to deploy within the container, it is not required to go for external tomcat deployment.
Besides, if you are going for many microservices, it will be good to have with built in springboot with embeded tomcat. Springboot also provides the facility to use undertow or jetty. I would recommend to use SpringBoot with either embeded tomcat or undertow with docker container for more flexibility.
It will be good if you provide the issues you are facing.
You can check the below link for reference.
https://dzone.com/articles/spring-boot-with-external-tomcat
I didn't encourage until today companies using Spring Boot and deploying in an external Tomcat.
If there is no requirements from your Infrastructure department, I would go with the embedded tomcat.
JARs vs WARs
I think both have their use cases, like a car vs a truck.
Getting started with jar files is definitely easier, it's provided out of the box. However, using war files in a tomcat has a few perks too:
You can use the "manager" UI to update/redeploy a webapp easely
You can monitor server status, inspect sessions, basically have a look under the hood
You can deploy/update multiple wars independently, which might be handy for larger project
...but there is definitely some learning curve to set things up, and it feels a bit ...old. So it's up to you if you want an easy "jar car" or a whole "servlet container truck". ...or you can also have multiple cars. ;) Each has ups and downs.
Pipelines
Like for any other topic, there are very different ways to achieve this. If you use an extern tomcat, you may configure a "script" user and deploy it like this (or similar):
curl -u username:pwd -d path=/something -d war=file:target/someWar.war https://someurl.com/manager/deploy
...or you can go the other way round and create Docker images, or cloud-init VMs or whatever. Or just a shell script to stop it remotely, upload it and start it.
Depending on your situation, the know how of your team mates, etc, one or the other may be easier.

Deploy Angular 5 and spring boot applications on same tomcat at different ports

I am developing a small project where I have Springboot java application and
Anagular 5 application. I want to deploy them on one tomcat. running each on diffrent ports.
Application Flow should be like this:
1) Some external service calls Java application with some headers. Springboot java application should read the headers put them in cookie and forward the request to Angular application.
2)Angular application reads the headers from the cookie and communicates to another application(Hosted somewhere else) with API calls.
What I tried:
I am able to deploy Spring boot application on tomcat.
For angular deployment I am copy pasting the dist folder into webapp.
What is question about: I wanted them to run at a time on tomcat on defferent ports so.
external application --calls-> java application(say running on localhost:8080)-----redirect from localhost:8080 to ----> Angular application(say running on localhost:8081).
in moment your are delegating servlet container to a provided one, all spring properties concerning an "embedded" container will be simply ignored. This is the case of server.port property.
Maybe it's a client/company constraint BUT using Spring Boot project this way makes you loose big part of its benefits: Raising serverless apps ready to be horizontaly scaled :(
Spring Boot keeps the possibility to let your static resources in the apps whitout loosing the ability to run the embedded container; by building an executable war.
Tip: To do that, just change the packaging from .jar to .war.
Hope was helpful :)

Accessing external JAR library in Java EE Webservice with JSF and EJB

I just started developing with Java EE and JSF 2.x. Till now I'm very proud of my small applications with Connection to databases and ldap.
Now I need to connect to our Application API via some exteral jar libraries(C:\Program\A\lib1.jar, C:\Program\A\lib2.jar) so that I can add / change things / settings via JSF Webpages over Application API.
I have no idea how to solve this.
Any idea or helpful explanation or tutorial how to do that? (I'm using Wildfly 10.1) and I'm not using Maven.
Putting the jar files as dependency leads to a ClassNotFound exception.
It would be very helpful to get an example on how to add and accesses external jar libraries.

Apache and Tomcat Server Cross Domain

I have three distinct heavily coded web-projects; two of them (new) is newly developed with Java/Script, the other (old) one with PHP. All of these three project has some common resources like HTML containers, Element classes etc. Moreover, one of the Java project is Main Project that call the other two projects.
The issue is that Java projects run on a Tomcat Server, PHP needs to run on Apache Server. And PHP project has some location paths for resources like "../SomeResourceFolder/somePage.php". However, when I run Main Project (Java) on Tomcat Server which has "localhost:8080" I could not reach PHP project which is run on Apache Server with "localhost:80", even if I accomplish to reach PHP project, PHP one fails to reach common resources in Tomcat.
I solve the issue a little bit unconvincing way with JavaBridge and Quercus; they help to run PHP on Tomcat Server. However, again I have some path problems.
Actually these projects runs on production with load-balancer which direct request to related server. I try to simulate this or at least run PHP on Apache, Java on Tomcat and connect them somehow. How can I construct this kind of structure without cross domain problems?
I solve the issue by using "Tomcat Connector". It connect Apache and Tomcat by defining Tomcat as worker, and send HTTP request with given path configuration.
You can follow guide given by Nanyang University. In guide Tomcat 6 and Apache 2.2 are used but I used Tomcat 7 and Apache 2.4 with the same directions.

Spring project deploy on real server

I have a Spring MVC project running locally on tomcat right now. What I need to do to be able to run it on my linux server? How can I deploy it? Before I used firezilla(running usual jars) to connect to server using ssh. Please help me by writing easy steps on how to run web application on server, thank you.
There are a lot of answers to this just have to google (i found about 10 in first couple pages that were good).
It all varies based on your environment, build setup etc.
Here is example of deploying with maven to tomcat
http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/
and another
http://bitbybitblog.com/deploy-to-tomcat/
Some IDEs also have inbuilt functions that take care of this for you as well.

Categories