I'm using Spring Boot to deploy a webbased app (services on the backend, SPA app for the front end).
I'm not using Eclipse to edit my html-related files.
If I put those files under "resources", when using Eclipse to debug the app, any changes (to the html-related files) made using the other editor is not picked up by the "embedded" tomcat, unless I refresh the file in Eclipse too.
Everything works great if I put the html-related files in webapp/: I don't have to refresh the files in Eclipse; but then the files are not picked up by the jar maven build (because spring boot jar is not supposed to pick them by design...)
How do you usually work with html-resources?
I don't want to use Eclipse to edit my html-related files, and I don't want to use nodejs/other proxy-style server tool (I have a capable webserver called "tomcat", I don't see the need to have yet another tool to install/configure/update etc)
Related
I have built my jhipster application in production version(frontend app), it did minify all the javascript files and html files, I can see that inside the war, and I run the application in production version too as after completely starting it says jhipster started and the profile has swagger, prod. But when I access my application there is little source folder that gets created and that exposes all of my javascript code as javascript is not minified, over there.
what is this folder?
Why does this folder exists?
how do I disable this folder?
Link to the screenshot
You should probably disable source maps in gulp/build.js also gulp-uglify uses default options which you may want to change.
Can anyone tell me..while running servlets iam using apache tomcat. But everytime i make changes to my web application..I have to export the war file and put into the webapp directory again and again..it is too much time consuming and very hectic. For even small changes i have to export war file and then put in my webapp directory. I cant run my web application without doing this..i mean new changes are not reflected till then..
Isn't there any other method..i think auto deploy should do..and however it is set to true in my web application. but it is not doing it..I have been searching on the net since 2 days..but didn't got any solution..please help..
A WAR file is basically just a .zip with the respective webapp contents. Instead of deploying a WAR, you can deploy an "exploded WAR", being the contents of your webapp. Various build tools support doing this, for example, Maven supports the dir packaging in the assembly plugin. Then, you can for example configure your project to build classes directly to your WEB-INF/classes directory of your "exploded WAR".
EDIT: In case it wasn't clear - you just put the exploded WAR within a directory in the webapps directory where you normally put the WARs - so instead of application.war, you just put an application directory containing the webapp.
Most popular IDEs like Eclipse, IntelliJ or Netbeans provide web testing and publishing tools for users, it's a very basic feature.
In case you're using Eclipse, navigating to Web Tools Platform User Guide > Using the server tools in help page, should be sufficient for you to set up the environment.
Here's online help document for Eclipse Mars, for your convenience.
IDE
You can develop with IDEs like Eclipse or Netbeans. It will be easy to develop and auto-deploy will be taken care by themselves. It will save much time. And completely developed final product can be exported at final stage.
As mentioned, the IDEs nowadays can do some rapid redeployment or hot-swapping of classes. This can work for some scenarios but not all.
JRebel
For even more advanced hot-swapping in more scenarios, consider the commercial tool JRebel by ZeroTurnAround.com.
I'm building a project on java, using jersey.
In program I need to connect to database MySql. I have download driver (*.jar file), and have put it to dir WEB-INF/lib (to other jersey libs), also I have added it in build path. If i'm creating war file and uploading it to tomcat server, than everything is ok. But if i'm trying to run it from eclipse with "Run On server", application can't find that driver. If i'm creating a small class with main method for testing that driver, and running that class as Application everything is ok.
So where I should put that lib, so my application can see it when I'm running it with eclipse.
PS Also can you recommend me some article about how best to structure project with jersey. Because I don't what to do. when I have some big peace of page written on html to do. Should I copy its content to java file and return it, or should I upload that file and read it in my class or maybe exist some other solutions?
Use Maven to handle dependencies. For servlet/HTML mapping use a MVC framework such as Spring or Struts.
I come from an Asp.Net development background and am very comfortable there. I was asked to support an existing Java Web Application w/ struts and am able to figure most of it out with my Asp.Net knowledge and my android development experience. However, I'm having a really simple but stupid problem.
All i have is the website as it exists on the server, no source project to work from. The folder on the server contains both .java and .class files, but the folder doesn't just import into netbeans as a recognized project.
What's the easiest way to get the site imported into some sort of IDE (I can work w/ eclipse too if netbeans isn't recommended), and get it to compile so I can deploy some updates.
It will not be easy to answer fully to your question here. But we should be able to achieve that by steps :)
Here i will speak for eclipse. But it is only because i'm not familiar with netbeans.
First of all create a clean "dynamic web project" under eclipse (using a J2EE enabled eclipse http://www.eclipse.org/downloads/).
Then :
copy your sources files in "Java Resources"
copy the rest of your application (without the class files) in WebContent
In order to test your application localy you will need a local server. Tomcat can be integrated easily in eclipse.
Usually you shouldn't have to (re)construct a project from a deployed web-app; the project should have been kept in version control. Source code isn't usually deployed to the server, either, but if it's been done in this case, you're in luck.
I would just make a new web project in NetBeans and manually move the .java files into it, along with the other resources (except for the .class files).
If you can use eclipse, and the source files are already in the war file as you say. You can import the war file directly into eclipse as project.
file -> import -> war file or existing project into workspce or filesystem (Several other options exists)
I earlier got to create a simple RESTful webservice on my localhost using Eclipse IDE, Tomcat, and JAX-RS libraries.
I am now trying to move the same on to a different unix server which has Tomcat installed. I am not knowing how to get started as in what is equivalent to creating a "Dynamic Web Project" that I do in Eclipse. Do I need to just create a directory myself with all the sub-directories as created by Eclipse? Should this directory be placed in webapps folder in Tomcat container. Should META-INF and WEB-INF also be created by myself?
Where should I put my Java classes?
Can somebody please clarify this or direct me to any documentation about the same.
You need to package your application in a WAR file.
The Sun Java EE 6 Tutorial has a chapter deciated to packaging.
It's pretty easy to export a web application as a war in Eclipse.
Dynamic Web Project (right click) => Export => Web =>war file =>war export dialog
Creation of web application archive - WAR is the solution for your problem,
but take care about all libraries that you need there.
You can easily extract (unzip) WAR file content
and check your project structure and libraries needed
and they will be in WAR's WEB-INF/lib.
Make sure that both Tomcats are set same way,
make sure your code is all OS friendly (users, file paths, permissions)
Always write some test simple code that will run up on app start,
and check all dependencies and libs, system clock, outside world network communication, so you can trace it in web app console or logger easily.
regards