I just need a little hint in what direction my research should go.
Because currently I have a spring standalone jar project (spring-context, spring-data-jpa and hibernate entitymanager. Everything set up without xml files).
Now I want to run this application on two computers inside a network. Both should be able to send objects over the network. But I want to accomplish this without a web server (so no tomcat or glassfish).
Is this even possible? and how is this called?
I have problems finding something close to this plan. Most of the time I find tutorials and threads for sending objects with tomcat. But I more or less only need a open port that listens to incomming objects.
EDIT
Later I also want to put a third player in the communication process: A website. So then two standalone jar programs and one website will pass objects around. That's why I hope spring mvc will work for a stanalone solution as well.
(I know that this question will get tagged down, but it's ok, as long as I get some designations I can use to research better, so thanks ...)
You have many specifications. ProtoBuf seems to be interesting https://github.com/google/protobuf/tree/master/java
Without having server it would be a pain for you as you will have to implement concurrency, security and this kind of stuff.
Does Spring Boot work for you? Server is embeded ;-)
What about use normal java sockets? There is plenty information if you google it. If you need help with this just let me know and I can send you some java application. Just type Java Sockets and lets learn!
Alvaro.
Related
I'm sure this is very obvious, but I'm new and just trying to wrap my head around this. And googling this question isn't helping, because I think the answer is just so obvious... but I'd really appreciate an answer.
First of all, there are many modules Spring provides for a variety of applications. For applications like job scheduling, console applications, batch or stream processing, serverless applications, etc. you don't require any kind of server or browser.
But, when it comes to a web or enterprise application, you definitely need a web container. Spring comes with a built-in server of its own, i.e Tomcat (though there is also an option for Jetty and UnderTow, etc.). This is basically a container that handles the dynamic requests coming from the clients. But, you can have your own configuration by modifying the default one to meet your custom requirements. Like say, for example, Usually, it runs on port no.-8080 you can change it to say, 8081 by simply mentioning 'server.port=8081' in the application property of your application.
Now, coming back to your question any Spring/Spring Boot application runs on servers as a whole and sole application.
I tried to understand this several times allready, but still have not found out how this should be done.
I want to create a web interface for some existing console or swing application. Something like the web interface SABNzb offers (I know, it's Python – it's just an example).
I have looked at several technologies allready, like creating web services using a tomcat server, or java server pages/faces, but all the tutorials that I found so far start with "Create a new Web Project..." at wich point I stop because this is not what I want! I have a finished an application in which I want to integrate a web interface, not some web service that instantiates my program as a local variable and uses its code. So basicaly it feels like all the tutorials I find are the wrong way around.
The core procedure of this is clear, the application should listen for http requests on a port I choose and answer with a created html code to it. So basicaly I could open a port using a socket and write an html page to its output on connect. But this rather feels like inventing the wheel all over again, also I'm not sure how an interactive web page would work this way.
Maybe I am thinking somewhat strange here or did not understand how some of these things work, but I am pretty unexperienced with web technologies, so grasping the concept is rather hard at the moment. Can anyone point me to a tutorial that shows how this might be done, or some other source of information on it?
You don't need JSP or JSF; all you need is a servlet. It's an HTTP listener class. You can do REST with that.
The moment you say that you have to deploy your servlet in a WAR on a servlet/JSP engine. Tomcat is a good choice.
Google for a servlet tutorial and you'll be on your way.
My First Tomcat Servlet
Ok, thanks to duffymos answer and comments i realized i was actualy searching with the wrong keywords.
Embedded web server is the thing i was looking for.
Like Simple or build in HTTPServer class in java.
currently we are developing a JAVA APP that runs on TOMCAT and uses POSTGREE SQL
And we have an introducting website (JOOMLA 2.5 based) that explains the app, and also have a register module, that runs on APACHE PHP, on a different server.
Our goal is that the clients enter direct to our website JOOMLA, register there and then they can go directly to the web-app.
Very like to www.tiendanube.com or shopify.
The java-app has a login as well as the joomla website.. We need to unify those process, we cannot find a form to achieve this.
The problem is also that Joomla cannot run in the same server as the web-app.
Is there any way to interconnect both the web-page and the app (which runs in differents server) to make then look as one ?
So we thinked that when the user register in the joomla it also has to be saved in the same POSTGREE SQL of the java app. Since the java app is running in a different server we cannot access postgree SQL of the java app
That can be a solution, still we are pretty sure it has to be a easy solution or a more powerful and better solution for this.
Also been the 2 services in differents servers, it seems that we are not able to mantain the same domain for both.
We will really appreciate some help
Thanks very much
Facundo
You have at least two ways to do it.
Use a LDAP, GMail authentication or equivalent. Easy, Joomla already have it
Do in a manual way with "Single Sign On across multiple domains". Will have to undestand how session cookies works and avoid avoid some problens.
Please read my recent answer on implementing SSO across subdomains in joomla
I am trying to develop a simple chat application with tomcat 7. Every client will be put in a Map of users and on getting a new message from a client, all users will invoke the Map.
That works fine on ONE Server. But how can I use this scenario on 2 or more instances? Is there a way in Tomcat 7 to inform all instances?
Thanks for help!
I think using JMS is quite appropriate here.
There are other many other ways to do it even better but it's usually more complicated, this solution is easy and clean for your needs.
Some years ago I made a Swing application that uses a MySQL database. Now I must change this app to work through Internet.
I can connect directly to a MySQL server through Internet, but I think that it's insecure, so I'm thinking about using webservices.
I know I must change lots of code in my current application, and I don't worry about that. But my problem is that I have never used webservices nor server side technologies in Java, and I don't know where to start.
Do you know any good "webservices for dummies" tutorial? I need authentication (and ACL or similar) and database access.
Thank you!
Easiest adaptation: have a look at apache axis2, it has everything you need for webservices. That would offer to extend you current applicatino by webservices functionality.
If you need to re-engineer everything, either spring or Java EE should be your friend.
Adding web services won't make it any more secure. The best you can do is to enable SSL with JDBC.
Take a look at the core servlets site. There is an EJB tutorial and an AXIS tutorial. As mentioned by Andreas_D, spring and Java EE are both options. I suspect you want a simple REST implementation, in which case, spring is a good option.