I'm trying to write a simple java applet program, but it seems that I'm missing the javax.servlet.* class definitions.
Using:
apple snow
eclipse Java EE ide
Do I need to add a specific JAR file to my project and if so, which one?
I have Macports installed in case something from the ports might be helpful.
This is all result of misconceptions (Applets have nothing to do with the actual problem) and ignorance about Eclipse (if offers builtin ways to seamlessly integrate and link the one and the other, the Java EE variant has already a Tomcat plugin, you just have to integrate the server and associate it with the web project).
In the future you should be more precise and detailed about the problem (and thus not telling like "...it seems that..."). Post the relevant code snippet which caused the problem. Post the actual error message (with stacktrace, if any). Post the steps to accomplish to reproduce the problem. Also see: How To Ask Questions The Smart Way.
I've answered several times before how to get started with Eclipse+Tomcat+Servlets, you may find it useful as well:
Question about installing Java EE locally?
Tomcat servlet problem - class not found
CLASSPATH, Java Buld Path (eclipse), and WEB-INF\LIB : what to use, when, and why?
Thank for all of your helpful comments.
I installed tomcat 6 and it contains the missing jar in order to compile the project.
Nice plug-in to load tomcat applications :
Sysdeo Eclipse Tomcat Launcher plugin - http://www.eclipsetotale.com/tomcatPlugin.html
Using Netbeans i was able to properly compile tomcat applications just by creating a new java web application. for now i'll stick to netbeans, it also has a nice gui for connecting to the server and seeing the installed applications and their status.
Related
I'm trying to migrate some legacy GWT applications from eclipse to IntelliJ. Oh man, what a nightmare. I've come very near to a dead end with my research. I'm at the point where there is simply no related page or documentation that I have not seen, not to mention the information on this topic is very, very sparse.
My setup is as follows:
IntelliJ IDE
GWT 2.9 plugin
Jetty Runner that is using Jetty v11.0.7
Here are my GWT and Jetty debug configuration settings:
When I navigate to the jetty server URL I always get "Error 404 Not Found" message.
Now, when I navigate to the "Debug" directory that is specified in the GWT configuration I do see that there is no RSS.html which is a problem but even the "blank.html" is not able to be navigated to. One potential issue is maybe I am somehow not compiling the debuggable version of the GWT application correctly?
My other guess is that I have to somehow point to an actual .war file. I do have an ant build script that works just fine and generates a .war that works correctly in production. Below is a screenshot of the generated war file as well as the directory used to build the war archive.
In summation, how do you correctly debug a GWT application in IntelliJ using the GWT configuration with a Jetty Runner server?
I can promptly provide any additional info that I may have left out.
EDIT
I would like to add that this How to get GWT Super Dev Mode to work with IntelliJ question is very similar to what I am asking here and it was never edited with the correct answer, also since this was posted super dev mode was added. It would be great to get a clear solution documented for myself and others. To reiterate the answer needs to achieve these three things,
Use a Jetty Runner configuration (to enable use of different Jetty versions as there can be a cascade of conflicts depending on your codebase)
Use a GWT configuration to run a code server with the Jetty Runner instance so debugging is possible.
Use IntelliJ IDEA
I am trying to run a deployed .war made with the zk framework and Java, in a Debian server with tomcat 10 but it doesn't work. When I checked the log in the file /opt/tomcat/logd/localhost.2021-xx-xx.log, an error message appeared as follows:
java.lang.ClassNotFoundException: org.zkoss.zk.ui.http.HttpSessionListener
Then, I made some research on the internet and I found a possible solution on this link https://forum.zkoss.org/question/97112/javalangclassnotfoundexception-orgzkosszkuihttphttpsessionlistener/ and I did what is suggested. However, the error continues to appear. It seems that there is a conflict between the zk framework and the server.
I see two potential issues that could cause this.
First:
Tomcat 10 implements Jakarta servlet (instead of java servlet).
When building your application, make sure that you are using the proper ZK version.
The last ZK release has two versions:
9.6.0 : Java EE (tomcat 9 and below)
9.6.0-Jakarta : Jakarta EE (tomcat 10 only)
See the configuration guide here.
Caveat on that, if you are running the Java EE version of ZK in tomcat 10, I'd expect you to get:
[org.zkoss.zk.ui.http.HttpSessionListener]
java.lang.NoClassDefFoundError: javax/servlet/ServletRequestAttributeListener
which is located in the same place as your current issue, but is not quite the same :D
Second: If you are resolving your dependencies through a dependency management tool such as maven or graddle, it is possible that you are resolving the wrong dependencies.
I'd recommend doublechecking the resolved depencies to make sure that every single one of the ZK jars are resolved in the same version.
You may have a ZK version coming from your main declaration, and a different one coming from a plugin (such as Keikai, ZK spreadsheet, or ZK charts)
From maven for example, running the dependency tree command is a good way to know what is resolved.
I am new to Java EE. Recently I had to implement an opensource balanced score card system for one of my clients. I stumbled upon BambooBSC. I successfully configured the project on a VM with the help of a VDI file (available on their github page).
Now I want to setup this project on my local machine. Since this project is based on J2EE platform, I already installed Apache Tomcat and Netbeans IDE on my local machine.
I cloned their repository on my system. And tried importing the project in my Netbeans IDE. Now the IDE shows me something like this.
I don't know what to do next. Seems like some external dependencies need to be provided to the project. But I am unable to figure it out. Please help me setup and run this project on my local machine. Will be deeply appreciated.
Thanks.
Do you absolutely need/want to work with Netbeans IDE?
Otherwise, you may consider using Eclipse IDE.
And follow this dedicated official documentation.
Anyway, you can notice the information about core-web, core-base and gsbsc-standard projects.
Let me know if you need further help.
the problem below is fixed and the server runs now. However it keeps printing red messages but then it deletes them and runs... is that normal? Is there any need for fixing it - if so, what?
When I created a Dynamic Web Project in Eclipse and tried to run my Apache Tomcat v9.0 Server in which I made all the .sh files executable, it still gave me this error:
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
-Djava.endorsed.dirs=/Users/my_name/Desktop/tomcat/apache-tomcat-
9.0.10/endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
In all the tutorials and forums I have looked, none of the proposed solutions have helped me. How can I fix this problem and make my server run properly?
Thanks!
What JRE are you using? The error you're getting seems to indicate that there is an incompatibility between the JRE versions. As mentioned in Tomcat's docs https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html the 'endorsed' feature is not support in Java hence it means that something keeps adding this up to your configuration.
This seems to be an issue with eclipse (or at the least the way it's setup at your system). Try having a look at this eclipse bug link as it may provide so more information about the problem you're dealing:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=507338
I'm trying to learn Tomcat but the problem for me is the that the Tomcat server has to be restarted each time I make changes to the code.
Is there any way to make Tomcat pick up changes to the code without having to restart the server?
Maybe an IDE (Like Eclipse or NetBeans) can be somehow used to develop for Tomcat and test all the changes right there in the IDE?
Well if your putting your latest compiled files(classes/resources) under WEB-INF/Classes or lib folder you dont have to restart the server. You can can configure IDE's like Eclipse to configure this way where they can put latest compiled files under right target folder. Rcent Eclipse version comes up plugin where you can configure it to use existing tomcat server. You can also explore Mongrel Plugin which also serves the same purpose .
Please have a look at "DCEVM". It's a Java runtime environment alternative that works just like a normal JRE but is able to reload class changes in almost all situations. Very cool, and it's free.
http://dcevm.github.io/
Installation is very straightforward, see explanation on the site.