I've never worked with Java EE before. I'm trying to learn both Java EE and linux environment.
I wrote a really simple web server and using tomcat to serve it. Everything works perfectly on my Windows machine. I'm trying to run the server on a linux machine.
I created a .war file using maven and I'm pulling that file from git to the linux machine.
The problem starts here.. when I put that file to tomcat7/webapps it only shows me the front-end but back-end doesn't work (get requests return nothing). So I figured I need to run the server separately. I'm trying to use "java -cp war_file.war test.getSomething" but it says "Error: Could not find or load main class test.getSomething"
Apparently I'm doing something wrong but I cannot figure that out. I appreciate any help, Thanks!
Related
I am developing my first web application with EJB, JSF and JPA. I use rational developer for developement and test, and our server is an iSeries with websphere 8. I do not have access to the test and production server, i can only manage the one I locally installed for developement purpose.
So now, my web application is working perfectly on my local installation, but I can't make it work on the production or test server. I produce the EAR with Rational Developer, our sysadmin publishes it on the server, the logs show no error (everything seems fine), but when I then try to reach the application via browser, i get the message
404 not found: requested url was not found on this server
In locale, i have the application installed under
http://localhost:9080/<contextroot>/pages/login.jsf
I tried several different urls but I always get that error message:
http://<production_server_url>/<contextroot>/pages/login.jsf
http://<production_server_url>:80/<contextroot>/pages/login.jsf
http://<production_server_url>:9080/<contextroot>/pages/login.jsf
http://<production_server_url>/<contextroot>/
I asked the sysadmin to send me the screenshots of the steps he goes through when installing the app on the server to see if there was some difference in the configuration, but everything is the same. The contextroot is correct.
We have other web applications that run on the servers, but those are simple .war files, this is the first EAR we try to deploy (i.e. as such, websphere incapuslates war files into ear projects in order to run them)
We have no idea what to do, can anyone help?
What bothers me the most is that the deploy itself goes well, the app is installed and running, I just cannot reach it
Thanks
Solution: The application server was running on a different, non-standard port. As suggested by #Jarid i found the correct port under
<profile_config>/cells/<cellname>/nodes/<nodename>/serverindex.xml
at endpoint WC_defaulthost. I can access the application at
http://<production_server_url>:>WC_defaulthost_port>/<contextroot>/pages/login.jsf
The default for Eclipse EE seems to be to build java code in build/classes not in WEB-INF/classes or WEB-INF/lib/my.jar. I can create a .war file which has the entire project, but then every time I build, I have to manually generate the war file. My current setup which has the WebContents directory symbolic linked to /var/lib/tomcat7/webapps/ROOT, in which case all the web pages are by definition in the right place, but the code is not there.
I'm willing to take a suggestion on how to get this to happen automatically, but I would like to know WHY there should be the need in the first place? Why would I want to have my build directory for a web application anywhere other than the directory where it should be executed? Is there any way to get eclipse to build the !%*#% class files in a sane place, or is there in fact a reason why an EE app would have code that does not go on the server? Is there something simple that I can add to trigger a rule in ant or mvn to move the code to the right place?
Compounding this problem, I am switching over to Ubuntu (Not that this works under windows at the moment either).
I was getting weird errors, and it turns out I didn't have jdk7 installed.
So I installed it, but how do I even know what java is being used to run tomcat and eclipse? How do I know it will use jdk7 and not the one that was used before? On windows, when I tried to run Eclipse, it gave a straightforward error when Java wasn't installed so this never happened.
I type javac -version and get the correct one, but this does not guarantee that some service like tomcat7 will use the same one.
The error (same on Windows)
An error occurred at line: 3 in the jsp file: /demos/post.jsp
ReadBody cannot be resolved to a type
1: <%# page import="org.adastraeducation.liquiz.servlet.*" %>
2: <%
3: ReadBody b;
4: %>
5: <html>
6: <body>
The current (ridiculous) way to stop this error is:
cd build/classes
jar -cf my.jar org
sudo mv my.jar /var/lib/tomcat7/webapps/ROOT/WEB-INF/lib
sudo service tomcat7 restart
Eclipse Web Tools can manage building and packaging a web-app (WAR) and automatically running it on a local server of your choice. This includes re-deployment when changes are made, debugging, etc. But you have to create or configure your project as a Dynamic Web project for Eclipse to know to do that for you.
For starters, you'll need to either download the Eclipse IDE for Java EE Developers package or use the Eclipse Installer to get it. Then you can peruse the Web Tools help (for example, start here).
I have a SAML web application. I have put its war in a tomcat, and can run it. It works perfectly locally, the endpoint is set to localhost. However, when I copy the entire tomcat directory to another machine, it does not work.
Essentially, I am asking what could vary between 2 machines that would affect tomcat.
I worked it out - I needed to install the Java Cryptography Extension on my computer. (Best solution is to install it into ALL of your JDKs/JREs and that way it will definitely work).
I made a Java Web Application with Netbeans. I used JSF, PrimeFaces and the Glassfish Server. Now I want to put my application in a server but i just dont have idea of how to do that. I think fist of all have to install Glassfish in the server. How do I do that? The server i will be using has Windows Server 2008 Enterprise. Do I have to look for a .exe to install Glassfish? The same to do with Java? I have already done the connection to the SQL Server database so that part must work. So please explain me step by step what i have to have, how to install and configure everything and how to try if everything worked please.
Thanks for Your answers! :)
Depending on what your web application requires you will need to install more than just the glassfish server.
You need to install:
-Java jdk (required)
-Glassfish server (required)
-Database (if using one)
-Apache (if needed)
After you install everything, you need to deploy the war file of the application to the glassfish server. To do this you must first create a war file by 'cleaning and building' the app (option in netbeans). The war file will be located in one of the folders in the project.
Then you must log in to your glassfish admin console (located at http://localhost:4848 if run on localhost) and click on one of the options in the left menu that lets you manage the applications on the server. There will then be an option that lets you add war files to the server.
I don't know how to turn the question so that it can have a single response. Basically I own a static internet website (pure rest/json/javascript) that I need to be served, and I am looking for an http server where I could just put the files and have it up and working.
I am running on solaris with no administration rights, so I'd rather if it was easy to install with no compilation, so basically I think an http server written in java would perfectly fit.
I think Apache would have been a perfect choice, and it is already installed on solaris, but I don't have the administration privileges I would need to activate it.
Thanks you
Quick and dirty:
Wrap the static website in a WAR archive (I just unpackaged and repackaged the sample.war they provide as a demo for tomcat)
Download a version of tomcat appropriated for the installed version of java and deploy the war into it.
Not very elegant nor performant, but does the job. I am staying with this for the time being.