How to run servlet Java on Tomcat server via Eclipse? - java

I created a test application with two files for educational purposes: mypage.jsp and mypage2.jsp. At the same time, the comLogin servlet class was created. The bottom line is that on a local server, a user visits the site, enters his name (say, Andrey) and receives a page with a greeting: Hello Andrew.
The server is starting. However, when I try to open a website with two pages via Run As, I get a system freeze and an error:
Loading descriptor for MyWeb has encountered a problem. An internal error occurred during "Loading descriptor for MyWeb"
The screenshot shows that the server is running. The screen also demonstrates the web download descriptor web.xml: it is in the project structure, although for some reason with a red cross (see the Project Explorer window on the left). What's the trouble then?

Related

jdeveloper deployment issue on oracle weblogic server

I am working on an oracle product Identity Management (IDM).
Initially when I wrote a separate program using Java (JDeveloper) it's worked fine.
Users are created in IDM using that java API.
But when I changed that program with the idea of the Web interface java code is even not able to deploy on
oracle WebLogic server.
Work Flow of Pages
index.html (this page has 4 options on menu 1. create user 2. delete user 3. disable user 4.enable user)
When a user clicks on option 3. disableuser.html page is called
On disableuser.html there are only 2 controls, a textbox and a button. In the text box the user provides user name whom he
wants to disable and then he will click on submit button. This submit button will call
operations.jsp
this operations.jsp code will call java class (oimuser.java)
Problem:
When I try to deploy this code on Oracle WebLogic Server it's unable to be deployed
When I changed the machine and used my friend's machine the code is deployed and executed but it's not calling the Java code
means user is not disable (even environment is not created)
Note: unable to deploy.. with below error code
java.lang.ClassNotFoundException: com.vaau.rbacx.api.service.RbacxServiceException
For case 1) the problem is a missing library containing the mentioned class. You need to deploy the jar containing the class with your application onto the server.
For the second case, I can't tell as you have not given details.

Tomcat server won't start if my servlet references another project

I currently have 2 java projects that should be working together. The first project, Controllers, contains classes that should establish a connection to my database and communicate with it.
The second project is a dynamic web project with a servlet and 2 jsps(LoginPage and Welcomepage). The servlet uses the objects in the controller project to connect to the database, verify that a user's username and password are correct, and send them to a welcome screen.
Here's where it gets weird. As soon as I attempt to declare an object defined in my cotrollers project, my server refuses to start. It gives no error other than "Server Tomcat v9.0 Server at localhost failed to start." I have verified that my server works, I have checked that the build path is configured correctly, I have even commented out all the code in the controller object being defined. It's as if the mere act of declaring an object from another project causes the error, but I don't see how that would prevent the server from starting.
Any ideas what I could be missing?

Web application running without a name

I just made a simple web application (using java and jersey as i want to start making a rest endpoint). I am working on intelliJ idea
I used this tutorial to build it.
I gave the project a name, group id and artifact.
Now when i run it in my local tomcat server, it runs successfully but does not show me the name of my web application in URL. It only shows localhost:8080 as can be seen in the screen shot below.
Why is it displayed like that? How can i give my application a name/URL?
Basically, you need to watch this video first: Domains and the Domain Name System and then fully understand what the following paragraph means. Then your question will solve itself. Good luck! :D
localhost is the IP address of the server where the tomcat (which is an application server) is running. 8080 is the port. The localhost maps (from Windows hosts file) to 127.0.0.1 and this is a loopback IP address (meaning that it is, in fact, yourself).
p.s. that's what about the name in the URL. About the actual browser tab name, it's the <title> HTML tag.
How can i give my application a name/URL?
You need to buy a domain name.
So what i was looking for was to set the application context in tomcat server.
Here is how i did it: On IntelliJ idea, clicked on 'Edit configuration' -> than on 'Deployment' tab.
There is an option for "application context' there. I give it the name of my application(or any name that i like) and click 'apply' and restarted the server.
Here is how it appears in the browser now:

Deploying example application

I am trying to deploy the example form based authentication application to my glassfish server, but everytime I launch the application, I am redirected to yahoo, saying that
The requested URL "http://localhost:8080/com-byteslounge-jaas/" cannot be found or is not available. Please check the spelling or try again later.
Anyone have any ideas? I downloaded the source straight from here:
http://www.byteslounge.com/tutorials/jaas-form-based-authentication-in-tomcat-example
You can also launch Server Domain Console (http://localhost:4848 by default) and there, in Applications section, You should have Your app listed. You can see the URL to Your app either by clicking it's name or by clicking Launch link on the right.
The example in your linked article describe the URL is http://localhost:8080/com-byteslounge-jaas-1.0-SNAPSHOT, have you ensured you deploy the app to the same context path you're requesting? Check glassfish log to see what context path your app is deployed as

Execute an eclipse web project in the console only?

I am currently developing a web server. I am at a stage where 99% of the work is building the business logic, data logic and running tests. In other words, I have no need for the project to run in tomcat.
Right now, I created a test class that runs a mixture of the current code I am working on and prints info to the console. I have to restart the web server each time I make a change, which wastes a few minutes each time. Then I have to GET the localhost:8080 and wait for the page to load before I can read the printed output to the console.
Is it possible to run a Main type function that simply prints to the console without having to run trough tomcat.

Categories