Getting error on running the Tomcat server - java

I am learning about servlets and JSP files and following the tutorial in link to have at least a basic understanding. But I am stuck at the beginning of the tutorial when servlet has to be run on Tomcat. I am getting the following error:
Can anyone please tell if there is something I need to do to run Tomcat without this error?

I think you have not set up your environment correctly. I would suggest to use NetBeans IDE (with required services). While installing the IDE you will find option to install tomcat or glassfish server. After installing create a Java Web->Java Web Application project. All things should go perfect if you just run the project.

Related

Tomcat Not Running Fresh 'Hello World' Netbeans Web App - Stuck # 'Please Wait...'

I've just created a fresh web application in Netbeans. Project builds fine. However, once I hit run Tomcat starts up fine, but no browser window opens.
If I go under Services > Apache Tomcat or TomEE > Web Applications I can see 'Please wait...' where my project name should be.
Why isn't Tomcat running my project. If I go to localhost/port I can see that Tomcat is running fine but the project is stuck on 'Please wait...'.
I'm using Tomcat 9, Java 16, Java EE 8 Web, Netbeans 12, and Maven Compiler 3.1. If anything else is need to help then please leave comment or message me and I'll get right back
I can't seem to see any issue in the server logs either. What is the issue?
'Please Wait': https://i.stack.imgur.com/y3AOI.png
Server Log: https://i.stack.imgur.com/LT1dU.png
Can't embed images as I don't have enough rep.
Thanks
Not sure how to close the question so I'll answer it myself in case others run into same issue. Problem was simply that the version of Netbeans (12.0 LTS) I was using wasn't compatible with JDK 16 as #skomisa mentioned in a comment. Thanks.

Add native library to Neabeans REST project

I am developing a REST service that will work with ACRCloud, and for that I use the native library acrcloud_extr_tool, but when I call the service that will call ACRCloud, I have an error that appears:
(java.lang.UnsatisfiedLinkError) java.lang.UnsatisfiedLinkError: no acrcloud_extr_tool in java.library.path
I am working in the NetBeans IDE 8.2 and the REST service will be deployed on a TomCat server.
I found articles saying to add a link in the options for running the JVM but what I tried does not work ...
Does anyone know how to solve my problem?
Useful links:
How to add native library folder to existing project in Netbeans
giving 'java.library.path' in netbeans for .dll/.so files
I'm not really experienced with ACR but for what I've seen, there is a Java SDK so why not trying to use it instead of the native one?
If you try it, the steps are quiet good described (Eclipse only sorry :/) in the Github Repo (https://github.com/acrcloud/acrcloud_sdk_java).
Pay attention that you will need to install it on your Tomcat Server (as well as the correct version of vcredist) too in order to use it after deploying (unfortunatly I didn't find the package on Maven but maybe I'm wrong)
And maybe the easiest solution, if you don't need to many uncommon features, would be to call the webservice directly through HTTP request ? (https://www.acrcloud.com/docs/acrcloud/demos/web-api/)

How to create an enterprise application client with Netbeans 7.4 and JBoss 7?

I try to create an enterprise application client with JBoss by following this official tutorial (based on Glassfish):
https://netbeans.org/kb/docs/javaee/entappclient.html
but I get this error message: Error: Unable to access jarfile C:\EntAppClient\${client.jar}
As far as I know, Netbeans IDE supports JBoss 7 since its version 7.3 RC1 and I use Netbeans 7.4. This feature seemed already broken for a long time according to this thread:
http://forums.netbeans.org/topic40270.html
It is expected to work as Netbeans is intended to support other application servers. However, some Glassfish specific properties are hardcoded inside the Ant build scripts and the property client.jar is set if and only if j2ee.clientName isn't set which isn't my case (it's set to EntAppClient.jar).
When I set client.jar to ${dist.dir}/${j2ee.clientName}, I go a bit further but Netbeans doesn't find the JAR of the remote interface and the Glassfish specific agent class loader org.glassfish.appclient.client.acc.agent.ACCAgentClassLoader.
How can I make it work? I'm going to try to fix build-impl.xml to use the correct classpath and I hope to find a smarter solution.

Make .war file for Tomcat from a non-web intellij project

So I have a regular Intellij java project, now I was asked to create a .war from this so it can be deployed on a tomcat server. However, when I google this, every link assumes I have a web application but I don't. If anyone could help me out with this, it'd be greatly appreciated.
Either deploy the project as a jar, referenced from a web application, or else convert it to a web application. Tomcat doesn't have a lot of use for java code that isn't called anywhere.

Context failed to start when deploy web-service in netbeans to tomcat-apache

I try to follow the Getting Started with JAX-WS Web Services tutorial on the netbeans site. I create the web-service-app (Java EE 6 Web, Tomcat 7.0), when I add a web-service class netbeans asks for me if I want to use METRO (because the server does't JSR-109), so I say yes and it adds some metro libraries.
Now the webservice is using the javax.ejb.Stateless as I selected the "Implement Web Service as a Stateless Session Bean" checkbox, but no Library containing this class is added and I get an error in Netbeans:
import javax.ejb.Stateless;
...
#WebService(serviceName = "WebServiceTest")
#Stateless()
public class WebServiceTest {...}
"cannot find symbol: class Stateless"
ofcourse it can't. When I add the "Java EE Web 6 API Library - javaee-web-api-6.0.jar" the error is solved, but when I deploy the project I get an error thats a whole lot more difficult, and that error is the actual problem...
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Ftjen%2FAppData%2FLocal%2FTemp%2Fcontext6376466830057976095.xml&path=/CalculatorWSApplication
FAIL - Deployed application at context path /CalculatorWSApplication but context failed to start
[here a direction to the line of error]
The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:187)
[...a whole lot of red-collored stack-trace stuff]
BUILD FAILED (total time: 1 second)
at the following line:
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
I put the arguments over different lines like this:
<nbdeploy
clientUrlPart="${client.urlPart}"
debugmode="false"
forceRedeploy="${forceRedeploy}"
/>
Which didn't help me at all(but maybe it does help you), because the eror was at the line:
/>
Now if I comment out the Stateless usage, and remove the "Java EE Web 6 API Library - javaee-web-api-6.0.jar" library, there is no problem and it all works like a charm. (after a 'clean and build' otherwise it keeps going errored)
It doesn't matter which library i add, if I do, i get that same error. I can get the example working, but I would like to be able to add libraries without it crashing...
Hope to solve this mystery, Tjen
PS: some specs
Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_21; Java HotSpot(TM) 64-Bit Server VM 17.0-b17
System: Windows 7 version 6.1 running on amd64;
Tomcat 7.0.11
I do have jaxb-api.jar and jaxws-api.jar endorsed in the JDK 1.6 platform
This can be achieved by adding metro libraries to tomcat.
GlassFish has metro library inbuilt. In order to run web service on tomcat, Metro libraries have to be included.
please google how would you add library. best of luck
This is because you did not chose glassfish as web server, in creating the project you must chose glassfish as the web server and jdk 1.7 at least.
In my case I used glassfish from the start with jdk 1.7. I got the same error but then i changed my glassfish version to 3 instead of 3.1.2 in netbeans and it was fine.
It seems like it's a common issue between NetBeans and Tomcat.
To get around it, you need to log into Manager GUI through http://localhost/manager
Once you login, you will be able to deploy it using WAR file to deploy section where you can select it after you browse to it.

Categories

Resources