Developing on a local Java server with Netbeans [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I've been developing Java with Netbeans and have been using the "Run" command on my project to initialize my testing. I'm using Windows 7. Is it possible for me to run a Java server isolated from Netbeans and use it for my testing so I can learn the basics of a Java server not tied to Netbeans? If so, what should I google?

The simplest server to start with is Jetty , as it's 100% java and embedded easily with no platform specific dependencies. To install jetty, you need only unzip the download.
Once you run a simple jetty tutorial, use netbeans to create a war file - and you can then easily deploy your web application in jetty by just dragging the war to the appropriate folder in jettys home directory.
Now --- To learn about how java web servers work , you can read the terminal logs that jetty produces, which are quite informative** - you can watch as it decompresses and deploys your .war file, etc... And use any old java profilers to monitor its memory/cpu usage.

NetBeans "Run" command works with both local and remote servers. Beyond transfer time, the two are basically indistinguishable, save the NetBeans can not start a remote server -- you have to do that yourself.
As far as working with a server that's "isolated" from NetBeans, there's no reason to even change servers. Simply don't start the server from NetBeans. Start it by hand and use whatever mechanism you like for deployment. Tomcat has a UI you can use, or you can plop the webapp in to the webapps folder and let it auto deploy, Glassfish you can use the UI, or asadmin, or the autodeploy folder.
The only other magic the NetBeans may do, especially for Glassfish, is that it may auto-deploy resources like connection pools and what not. You can easily mimic this by firing up your existing server and simply removing those resources before you deploy, and then learn how to recreate them by hand.
If you're using Glassfish, you don't have to play with your existing domain, you can create a brand new one on your existing server. Give it different ports, if you like, etc. It's straightforward and easy to do. If you have no port conflicts (and the memory), you can bring the two different domains up and down simultaneously.
Deploying a WAR or EAR is pretty easy with most of the containers. It's important you learn the details just do you can move projects to production, but it's really not a big deal -- especially if you don't have a lot of container configuration to do (shared libs, custom security realms, connection pools, etc.)

Related

Is embedded Tomcat a good choice for deployment to production [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 months ago.
Improve this question
Conventionally, a Servlet Maven project is deployed to Tomcat production server by deploying a generated war to the - webapps - directory of Tomcat. However, Spring-Boot, as a practical trend, recommends jar over war. This preference has no problem for testing, but in case of deployment to an existing Tomcat server in Production, AFAIK, only a war is accepted. So my solution would be:
Generate a corresponding war by modifying the Maven's pom.xml, i.e. set the value of packaging element as war as such: <packaging>war</packaging>. But this is manifestly an extra step
Deploy the project in Production as a running Java program with the embedded Tomcat, meaning there is no normal Tomcat Server at all in production. But is the embedded Tomcat as stable in production as the normal Tomcat server?
In case of deploying a Spring MVC project (no Spring Boot!) to an existing Tomcat server, I tried to use Tomcat Maven plugin in the testing phase instead of using Eclipse with Tomcat server configuration as the Tomcat server should be installed locally as a prerequisite.
Question: Are the solutions above OK? or are there any other better solutions of deployment to production? In case of the third solution, there is only Tomcat7 Maven plugin according to my knowledge, what if I only want to test with Tomcat 8 or Tomcat 9? I tried to use a main class to start up an embedded Tomcat, but it is superb difficult to deal with the dependencies.
I think yes for cloud environment that manages replicas for you as docker containers.
If you deploy as WAR then for the sake of HA you should run multiple aplication server nodes and thus embedded tomcat is not needed.
At the end, it matters the most on how your environment looks right now. With embedded server you loose some features of separate server instances but if you plan to use something like AWS for automatic tasks then it should suffice.
Overall, I think embedded should be ok. You are right that there is a term
make JAR, not WAR
but only drawback of WAR is that using spring boot you cannot use reactive programming I think. Packaging does not matter in your case. It matters in cloud environment because you ensure HA using replicas and for the best as docker containers.

Good Development setup for Spring-MVC/Hibernate/MySql [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm staring a new project using Spring3-MVC w/ Hibernate and MySql and am envisioning the following development setup:
Maven
Eclipse IDE (Having used netbeans in the past, I want to give Eclipse a run)
Tomcat
Questions:
What will be the life-cycle of development?
I've developed struts2 applications with the GF application server and Netbeans IDE in the past. The setup and lifecycle of making a change has been quite slow. Making change to java code, netbeans building code, deploying to GF. I understand these are common points of working with java and webapplication unless I go the Grails way. However, now since there are a few container-less solutions for java web apps - does it make the process a bit fast/east?
Should I use the embedded Tomcat plugin?
In netbeans there is a way to add servers and start a maven project by associating the project with the server. Is there something similar in Eclipse?
Which version of Eclipse should I be downloading?
There seem to be so many I downloaded the javaEE version but it didn't have a way to start a maven project.
You can use embedded tomcat plugin, if you are going with Maven, go with maven tomcat plugin. And deploy your application with:
mvn tomcat:run
In netbeans there is a way to add servers and start a maven project by
associating the project with the server. Is there something similar in
Eclipse?
Yes you can add tomcat server in eclipse, and start/stop tomcat within eclipse, it also allows you to debug easily, by just adding the source projects.
Which version of Eclipse should I be downloading?
Latest :) Eclipse Juno 4.1 I believe.
For starting on maven project, check the maven getting-started guide
Also, you can use maven plugin for eclipse m2eclipse
If starting from scratch I'd recommend using spring boot.
Regarding eclipse, you should get the version 'for java developers' but not the EE version unless you plan on using glassfish or JBoss or some other EE container. Even if you did need the EE version I'd download and use it separately.
It has been a decade since Microsoft ASP.NET has conquered the entire web application development community.A latest alternative have been developed which is known as ASP .Net MVC development. Model View Controller (MVC) is the new thing in the present era that has caught the fancy of many web development companies.

Alternatives to Java Web Start? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
We're having huge issues with Java Web Start in production. We're afraid to release because every time we do, help desk gets calls from 1/3 users getting an "unable to launch" error. It's hard to tell whether it's because of user error, cancellation in the middle of download, poor network connection or anything. But the bottom line is:
We find it terribly unreliable.
What are the alternatives for deploying and updating a rich Swing application? Either free or commercial, I'm more interested in features and robustness.
Reliability is key, but I would also like to have the following:
Install once, update automatically from a simple HTTP hosting like JWS
Differential updates
Support for multiple configurations (think of 30 instances which may have different versions of the application or different launch parameters - would be nice not to build 30 artifacts each time)
Win / Mac / Linux support. Hopefully one that does not mean I have to maintain 3 builds for each instance.
I feel your pain, the biggest issue I've had with JWS is visibility, that is, what is it doing and why is it doing it. Most of our issues were related to internal proxies (Java seems to really not like authenticating proxies) and the wrinkles seem to be ironed out for the moment. Nevertheless, I did consider simply writing a replacement. This is not as crazy as it sounds, JWS does an awful lot of stuff that I don't really care about, namely, integrating with the web browser and checking JVM versions. Consider the following scenario:
You launch a Java application (the launch app). This application takes a single parameter which is a URL of a JNLP file.
The launch app hashes the URL and uses this as the basis for a local folder (repository) in which to store any downloaded jars for the app. If the repository doesn't exist, it will create it.
The launch app attempts to download the JNLP pointed to by the URL. If it can't download it, it will just launch whatever is in the repository (maybe warning the user)
If it can download the JNLP, parse it and list any jars that need downloading. If you already have the jars, use something like Apache HttpClient in order to determine whether the server has a newer version and download if required. The important point is that any downloads should be stored in a temporary folder. Once ALL of the downloads have succeeded, you can apply these to the local repository. Ideally, you will back up what is already there in order to allow some sort of rollback procedure.
This should provide some very significant advantages over regular JNLP:
Visibility, you can log exactly what is happening
Much better failure modes: if the download gets interrupted just launch the version that's already there (obviously, this won't work if the interrption occurs on the first download), if you feel like telling the user about it then do so.
By running as a local app you should avoid running into issues with signing of jars, I honestly don't understand the Java Web Start security model with respect to signed jars but it seems that if different classloaders are involved, JWS will complain about it (I think)
Sadly, I'm not in a position to fire you over a working version of the above, I did start a prototype but suspended it. I may have to return to it in future in which case, I'll be happy to share the finished version.
Cheers,
Phil
Currently we are using GetDown to handle distribution of our swing applications. We use Tomcat to distribute updates and GetDown to download those updates. It's really flexible and powerful, and much better than java WebStart and because it produces check sum for changes it saves bandwith and downloads just changed files.
A good tutorial : http://www.hascode.com/2012/05/creating-updatable-java-applications-using-getdown-and-the-getdown-maven-plugin/
You could use an installer: for example Install4j.
You can find a list of installers here: What are good InstallAnywhere replacements for installing a Java EE application?
With Java Web Start being deprecated by Oracle, we are considering using Microsoft's .NET Click Once to download and launch our Java application.
We will have a Click Once .application file run a little MS program that detects Java, downloads our latest jar files and then launches our Java program using the detected version of Java and the Jar files.
Of course, this is only a solution for Windows machines, but we are customers are exclusively on Windows, so this works in that environment.
MS's Click Once: https://learn.microsoft.com/en-us/visualstudio/deployment/clickonce-security-and-deployment
You could also give Zero Install a try. It's cross platform (Linux, Win, Mac), offers jrd download and auto update and has a nice system integration.
Drawback in my eyes that its not easy to handle..
http://0install.net/

What is the typical Java (Java EE) development environment in Software Companies? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have been a project manager so far in a small company that focuses on PHP and .NET Development. No Java Development.
I learnt Java and J2EE 4 years back. I know things changed radically now. I would like to dive back to Java Enterprise Development. Can you guys tell me what the typical Development Environment is like in the big / small companies for Java / Java EE? Lot of friends who are in Java Development says, they use Spring and Hibernate.
What I would like to know is things like this...
Eclipse or NetBeans IDE or some proprietary IDE? Do we get to choose the one we are comfortable with?
Local or Remote Web and App Servers?
I see that when I create a simple Java Project using eclipse, it adds some eclipse related tags / classes in the config files. Is this acceptable?
And so on...
Hope my question makes sense...
Please shed some light. Thanks in advance!
Eclipse or NetBeans IDE or some proprietary IDE?
IntelliJ from JetBrains is the best Java IDE out there. That's what my team uses.
Do we get to choose the one we are comfortable with?
Depends on where you work. I think it makes sense to allow the workman to choose his/her tools.
Local or Remote Web and App Servers?
We use Spring, so developers use Tomcat to deploy locally. The web servers exposed to the outside world are maintained by others; usually IIS or Apache. The app servers are JBOSS 5.
I see that when I create a simple Java Project using eclipse, it adds some eclipse related tags / classes in the config files. Is this acceptable? And so on...
Your IDE should not add anything that you don't want. I personally don't care for Eclipse.
Eclipse or NetBeans IDE or some proprietary IDE? Do we get to choose
the one we are comfortable with?
It depends. In a company I last worked for, they loved NetBeans while I preferred Eclipse (more configurable than NetBeans IMHO). NetBeans, however, is now owned by Oracle (formerly Sun) and thus comes with integrated Java EE packages to start with Development right away (includes GlassFish and Tomcat bundled). Eclipse Java EE doesn't include a webapp server.
Local or Remote Web and App Servers?
That totally depends on the company.
I see that when I create a simple Java
Project using eclipse, it adds some
eclipse related tags / classes in the
config files. Is this acceptable? And
so on...
These config files doesn't affect your project when exporting it to JARS/WAR/EAR, etc. Those config (.project, .classpath) are basically your project information Eclipse uses. NetBeans does the same. If these do affect your project when exporting, rather use Ant/Maven to build your project.
You'll get as many answers as there are software companies.
I'll speak for mine:
Eclipse
Tomcat for local and remote
I'm not sure what you mean here. Eclipse will definitely need .project and .classpath files if you want to share project, but I am not sure that it adds tags to config files.
Definitely look into maven for builds, using it makes your projects ide-agnostic, and you can have people using eclipse or netbeans or whatever is their favorite and still be able to contribute.
The ones that are used in the Java shops around here are mostly Eclipse, with the latest version of Netbeans gaining popularity. Personally I find Eclipse to be decent and meets my needs, but YMMV

Beginning GWT and Java - which is the best route when coming from LAMP background? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I've worked a lot with php/mysql on Linux servers, including frameworks, orm etc.
Now I want to give GWT and Java a try!
Installing GWT SDK, Eclipse plugin etc and running a "Hello world" is no problem. The server is running automagically in the background, taken care of by Eclipse. But when it comes to setting it up my self, there seems to be confusingly many options. Jetty? Tomcat? Glassfish? How are those related/combinable to/with Apache?
Are there any good resources or tutorials for setting up java development and server environments suited for one like me with PHP background? Maybe pointing out the possibilities of running PHP and Java on the same server?
Jetty, Tomcat and Glassfish are all Servlet containers (well, Glassfish is much more but in the context of a GWT application, it is). They deal with running your GWT application's backend (the server endpoint of RPC calls).
What you call "Apache" is probably Apache's HTTP Server. Tomcat is also produced by Apache. It is not uncommon to want both running on the same server, with the HTTP Server serving up mainly static or non-Servlet content and Tomcat handling servlet requests. This seems to be a good lead: Tomcat-Apache HOWTO
Becoming more familiar with Java is always a good step - especially if your experience is only/mainly with PHP - while learning the syntax might not be that hard, the framework take a bit longer
GWT can be used purely on the client side of things if you want (i.e. only in the client browser - with other web frameworks running on the server) so replacing your PHP knowledge on the web server side is not required
A nice place to start (with setting up your environment) would be with Eclispe and the GWT plugin for it. This allows you to run your app from within Eclipse without having to setup a full application server or having to initially worry about stuff like Tomcat
I'd like to add something to the above answers - you don't need a Java server to work with GWT. It's only required if you use GWT-RPC for communication with server. If you want to use, say, JSON via PHP scripts, no problem - you can just use Apache/httpd for that.
Either way, I'd recommend using an external server over the one included with GWT, since it's a custom version of Jetty and from my experience it tends to get moody when it comes to some more advanced stuff.
Just my 2 cents :)

Categories