IntelliJ restarts server when updating resources - java

I ran into this problem at work, where we have a Spring boot Application and deploy the war exploded via a WebSphere.
When I change some static files like the html or JS and try to hotswap the changes via the update resource option, IntelliJ stops the application and deploys it again.
Now I was able to reproduce this problem at home but I still have no idea why this is happening.
I set up a new project with maven and added this example: https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-web-static
I downloaded the latest WebSphere and added the maven-war-plugin into my pom and finally deployed the whole thing.
When I change one line of code in the html and try to update the resources which usually should not be a problem the server stops and redeploys the application.
I am using the latest IntelliJ version 2017.2.3 and Maven 3.5.
Does anybody else have this issue or is it something I am missing in my set up?

So I got a response. The whole thing is a bug and will be fixed some time next week. Here is the issue they opened up: https://youtrack.jetbrains.com/issue/IDEA-178845

Related

MyEclipse 2016 Debugger Using Wrong Version of Code

I just updated to MyEclipse 2016, and I am having some issues getting my code to debug.
I wrote some changes in a java file and am trying to debug them on my websphere application server, but I noticed the debugger wasn't following the code at all. After a little investigation it turns out that I'm on V5 of the code, but the debugger is running V4 of the code.
I've tried going into the menu at
Run -> Debug Configurations... -> (Select My Server) -> Source
and changing the sources listed in here to just the workspace projects, but the debugger still goes through the old version of the code.
I'm at a loss and don't know what to do to get the debugger to pick up the right code. Does anybody have any suggestions I could try to get my debugger to pick up the new version of my code?
Edit: Forgot to include, Project --> Build Automatically is checked in the menus, and I have tried manually cleaning this a few times myself as well.
From your last comment, this means that the V4 code is actually executing on the server. The debugger is not executing anything; it is the server that is executing the code. So you have the wrong version deployed, somehow. Try a clean on the server, to remove any deployments and then re-deploy your project.
Given what everybody had said I checked into the deployment to the server. Looks like I had a WAR deployed to my server, when there is actually an EAR I can deploy to the server which includes the WAR I had deployed. Apparently doing just the WAR broke things, but deploying the EAR seemed to fix it all. Thank you all for the input though, definitely helped me get to the root of the issue!

Minecraft server clear already loaded .class files from JAR plugin

So my minecraft server has an economy plugin I've been working on. After battling a couple of days, I realised this is a common problem with Java that it won't unload the classes which are already loaded. So when I tried the plugin on a fresh server instance, it was working correct.
My question is how can I fix the original server? I tried deleting the updated JAR file from that server, ran and stopped the server as a guess that it'd remove the pre-loaded classes but instead that generated the files related to the previous version of plugin, even though the plugin's JAR wasn't in the directory.
First, what is not working? If it's crashing, please edit this and add a bit of the console log where the error is happening.
If it's working properly on another server make sure the JARs are all compiled from the latest source.
There could also be a conflict with another plugin. Try disabling all other plugins and see if it works than.

ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer

I downloaded Eclipse Luna and Tomcat 8.0.24 some months ago but I started using it. I've been creating a web app without Maven. I downloaded manually Jersey 2.23, Jersey media moxy 2.23, java-son 1.0 , jdbc mysql 5.x and sql2o 1.5.4. I'm starting to learn Angular and I successfully created one page without any issue.
I remember have added my jars manually in the Build Path of my project and I was forced to add them in the Deployment Assemblies also. Fine.
Since 2 weeks I didn't shutdown my laptop, just in sleep mode. But yesterday I did shutdown. Since then I suffered to make it work again. I use postman chrome to test my restful services and I received after the shutting down the 404 error.
I realized that I started to see the exception in the console:
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
I deleted my folders of tomcat and eclipse to start again from scratch desperately. However, I got the same issue. The last thing that I remember I was playing with, were these modified options.
Double click in server from servers tab
Change from Use workspace metadata to Use Tomcat installation
Properties in Server
Switch Location from metadata to localhost.server
It was thanks to these questions that I solved my issue:
org.glassfish.jersey.servlet.ServletContainer ClassNotFoundException
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
Now, after "reinstalling" eclipse and tomcat, when I add the jars in the library tab, they are now added in deployment assemblies automatically. (Surprised)
According to the previous attached questions, I added all the jars in WEB-INF/lib from my workspace as also in the tomcat/wtpwebapps/myproject/WEB-INF/lib. If I don't do this, I won't be able to make it work. Postman finally gives me the desired output.
Nevertheless, I realized when I copy the jars manually through windows explorer, the console in Eclipse displays the tomcat restarting again. BUT I still see the exception: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer. At least I can run my project in the browser or in postman without any issue. Very strange.
I want to add a new User Library in Windows > Preferences > Java > Build Path > User Libraries, but my list is EMPTY!!! So...
Finally, my questions:
What's going on with Eclipse?
Why am I not able to see my user libraries previously added?
Why do I still see the exception of glassfish.jersey in the console if I added the jars in the web-inf folder which makes it work apparently.
Why do I need to add the jars in web-inf, if when I see all the jars included in the Tomcat library all my jars are there because I forgot to mention that I added a folder called External in lib of my Tomcat folder.
For all these changes, I restarted Eclipse
Instead of adding jars manually, use maven and let the maven manage dependency of jars.
ClassNotFoundException occurs when you don't have a jar in the classpath. Maybe the package you are deploying on the server is not bundled correctly. Make sure you have jar bundled in your package or present in the classpath.
Another reason could be you have duplicate class files in two jars and the class your programme picking is not suitable.

Netbeans IDE 8.1: The module has not been deployed

I'm using Netbeans 8.1 with Apache 1.7.1. I've been working on the project for more than a year now, on and off. It's been working perfectly more or less. The majority of project libs are inside server lib folder.
All of a sudden it is decided to remove rich faces libs from the server on Production and include them inside of the project - not my idea, but here we are. So I remove the libs from server on my machine, include them in project libraries, and the aforementioned error appears just like that:
...\build-impl.xml:1066: The module has not been deployed.
See the server log for details.
But the server log is clean and without errors.
I tried restarting server, Netbeans, pc and whatnot, but to no avail. I decided to take a step back: remove libs from project, copy them back to sever. But the problem remains.
I've tried solutions from at least three topics here: disabling network, cleaning Netbeans cache, ending Java task and others, but the problem still remains. Is there anything else that can be done?

How to deploy the war file generated by maven on tomcat using eclipse?

I have got a war file generated using Maven and it works perfectly fine when i manually deploy it on the tomcat server.
However, the war file was generated using Maven on eclipse and when i try deploying this on the server using eclipse, it just doesn't act. The tomcat server starts perfectly fine. What I do is : Right click on the Tomcat Server 7.0, then Add/Remove Project and add it to the server.
The problem is when I deploy and publish it on the server and nothing happens after that.
On trying to access it, it says - The required resource is not found
Eclipse doesn't deploy the WAR. Instead, it knows how Tomcat works and deploys the exploded WAR.
The next step is to look into the webapps/ folder of Tomcat to make sure Eclipse really has deployed something.
If that looks ok, you need to look into the Tomcat log to see why it doesn't like the deployed web app.
Most of the time, there is old code which is somehow stuck in Tomcat, so Tomcat can't undeploy the old version. If that's the case, stop Tomcat, delete the app manually and try again.
There were certain jars required in specific versions for the application to work. I was usin the maven supported versions. I have got it to work adding them directly in Tomcat's lib folder for time being and the application now works. (Anyways i need to look to get them configured now on the maven)
Also, i guess installing the plugin for m2e - eclipse.org/m2e-wtp helped as well. Thanks #Aaron Digulla for the inputs.

Categories