Ray Jender wrote:
Tim Holloway wrote:1. Did you configure Tomcat to listen on port 5443?
Yes. I thought I mentioned that?
2. Did you setup an SSL keystore and define certs?
I'm not sure what that exactly means?
Until you do that, no URL path will work.
Again, like I said. This app works as designed, using https!
I am simply trying what should be an easy modification that I cannot get to work!
Tim Holloway wrote:1. Did you configure Tomcat to listen on port 5443?
Yes. I thought I mentioned that?
2. Did you setup an SSL keystore and define certs?
I'm not sure what that exactly means?
Until you do that, no URL path will work.
Again, like I said. This app works as designed, using https!
I am simply trying what should be an easy modification that I cannot get to work!
Norm Radder wrote:Is there a window that you can open and issue the command to start tomcat so any error messages it prints out are shown?
On windows it writes lots of messages on the console window.
Tim Holloway wrote:Also, some general notes. Apparently some people are running this product in Docker containers. I don't know if that's an option for the Community Edition or not, but if so, it's probably going to be a lot easier to get running.
If I can get this to work, I am considering running this in containers, sure!
I think a system I worked on about 2 years ago did something similar, but it was based on MediaTomb, which is now known as Gerbera. That was a completely non-Java system, though.
Tim Holloway wrote:That was rather loud.
OK, a quick trip to antmedia.io seems to be something I'd expect to be more up-to-date than CGI, but whatever.
I think the URL you want is more like https://localhost:5443/WebRTCApp/cgi-bin/hello.cgi
Tried it. It does not work.
Which, incidentally, is more like non-Java CGI URLs look as well. Now that I think of it, my Nagios server is CGI-based.
Also, as I said, Tomcat doesn't come pre-configured to use port 5443, so you're going to either have to use port 8443 or change the Tomcat server.xml file to use port 5443. And since this is SSL, you WILL need to setup a keystore and certificate no matter which port you use.
The app come with an ssl install script, using "Lets Encrypt" and port 5443.
Also, please warn us when cross-posting to other sites/forums. It helps in keeping people from getting confused.
I thought I answered this reply already but when I came back to read it, I didn't see any of the comments I made? Weird.
Norm Radder wrote:
got the same error.
Strange. The URL I posted does a GET not a POST.
Have you looked at the DOS window console where tomcat is running for error messages?
Tim Holloway wrote:OK, first of all NO Java webapp server - including Tomcat - will serve anything out of any file or directory under WEB-INF. That's defined by the 2EE/JEE standards specification. The WEB-INF directory is reserved to hold support files and other vital assets that outsiders shouldn't be able to mess around with, so it's hidden from URL web requests and so are its contents.
The How-To says something different? Have I misinterpreted it? : https://dzone.com/articles/enable-cgi-mode-in-tomcat
Secondly, jQuery isn't necessarily Java. The "j" is for Javascript, and it's a client-side library package used to support AJAX and other advanced client-side functions and features. It is very popular in Java apps, but it can be used with non-Java apps on non-java servers (such as Apache httpd server, which is a completely different software system from Apache Tomcat). It doesn't require or use CGI.
Sorry if I implied jQuery was java. I know it is javascript and I am trying to use AJAX;
Thirdly, Enterprise Java (J2EE/JEE) does NOT work on loose collections of files. It is based on the WAR (or EAR) architecture which can be represented as a ZIP (or more accurately a JAR) file. The Tomcat webapps directory is simply Tomcat's default place to keep deployed WARs, your WAR name is WebRTCApp and what you therefore have is what is known as an "exploded" WAR, which is to say an unzipped version of what would in strict JEE terms be a file named WebRTCApp.war.
And if that sounds needlessly pedantic never forget that computers are infinitely more pedantic, and if you don't understand the rules, you're likely to not follow them correctly and you're likely to have things fail for reasons you don't understand.
It might help if you could tell us where you got that webapp from. It's probably hideously obsolete, but at least then we could figure out what it really needs.
And finally, Tomcat doesn't normally listen on port 5443. I suspect that's supposed to be an SSL port, although Tomcat's default for SSL is 8443 and only a change to the Tomcat config file will make it listen on 5443.
The app is from antmedia.io the community version. And yes, it's configured to run ssl on 5443. I don't think it's obsolete. If does what it is developed to do. I'm just trying to slightly modify it via html and javascript.
Thanks for the response and appreciate it!
Norm Radder wrote:Have you tried with a simpler URL: http://127.0.0.1:8080/Norms/cgi-bin/ENV2HTML.PL
I was able to configure TomCat 8.0.32 to call the perl script and return with it output to my browser
Paul Clapham wrote:
Ray Jender wrote:Your suggestion goes totally opposite of what I am trying to accomplish. I don't mind several learning curves. I just need to learn what I need to do, not program a space launch.....
Oh, sorry. Your original post said you were interested in streaming live video. My mistake was assuming that was your goal. Sorry about that.
Salil Wadnerkar wrote:I suggest that since you are not familiar with how java servlets work, you can forget about this task for now, and just get "hello world" servlet working. This will introduce you to servlet mapping, and writing simple servlet that handles GET request from browser. Then you can develop a simple program where you submit your name via POST request, and the server responds back with "Hello, <your name>". Once you have these basic pieces working, you can easily finish your task.
Paul Clapham wrote:If I understand it right, you have to create this random string exactly once, and then you can start broadcasting.
If that's the case then I would suggest this simpler process:
1. Create the random string.
2. Write it on a piece of paper.
3. Find the place in the application's source code where the user will be looking for the random string.
4. Modify that by hard-coding the random string there.
Right now you're setting yourself up for several learning curves. I'm suggesting you look for opportunities not to go up those curves. There's a recent buzz phrase in programming: Do the simplest thing that can possibly work.
Paul Clapham wrote:
Ray Jender wrote:Currently I am playing around with an evaluation copy of a Webrtc media server called antmedia.
So I guess this means that you don't have access to the web app and can't make changes to it?
Is this random value supposed to affect how the web app works?
Paul Clapham wrote:
Ray Jender wrote:Maybe I did not articulate my issue very well. I have an existing Apache Tomcat based application that I am modifying slightly. In order to do the mod,
I create a random 12 digit number using javascript in the index.html file and need to store it in a mysql database. That's were AJAX comes in.
Subsequently, a user will need to retrieve it from the DB. The apache tomcat server does not support PHP so I figured java servlets would do the trick?
Okay. For now I will assume the idea of generating the 12-digit number on the client side is okay. Then you have to have some way of sending it to the server side, where Tomcat runs. Your AJAX code would take care of that by sending a request to this servlet you're planning to write.
Can I also assume that your Tomcat application is already using that database? If so then looking at existing servlets which use the database would be helpful.
Confused as to why you say my code is not a servlet? All examples I have found use the similar method to access the DB?
Your code doesn't even extend HttpServlet. It's true that if you're going to include code in your Tomcat-based application that you're going to have to use servlets, but if you're looking for examples of how to update a database then don't expect those examples to be examples of servlets.