Where do I locate Java Servlet container - java

I have installed JRE and now I'm trying to install Solr by following the Solr Reference Guide.
The guide dictates:
Stop your Java servlet container.
Copy the solr.war file from the Solr distribution to the webapps directory of your servlet container...
Start your servlet container, passing to it the location of your Solr Home in one of these ways:
Set the Java system property solr.solr.home to your Solr
Home. (for example, using the example jetty setup: java
-Dsolr.solr.home=/some/dir -jar start.jar). Configure the servlet container so that a JNDI lookup of java:comp/env/solr/home by
the Solr webapp will point to your Solr Home. Start the
servlet container in the directory containing ./solr: the default Solr
Home is solr under the JVM's current working directory
($CWD/solr).
Questions:
Where do I find this Java Servlet container?
Where/how do I execute those commands to start/stop/configure the Java Servlet container?
How do I set Java system properties?

Mine was quite straight forward. After downloading the file, I extracted it to a folder on my Server. I used the Command Line to complete the installation.
With the Command line, navigate to the example folder inside the solr-X.XX.X folder you extracted the file to, once there run the java command:
cd C:/<folder>/app/solr-X.XX.X/example
java -jar start.jar
It would perform the installation for you, like magic.
You can access SOLR by visiting localhost:8983/solr
I'm using a Windows Server though, it may be different on yours, but I guess the logic is the same.

You should to install Apache Tomcat. All information about these servers you can find here.
You also could to install Jetty, JBoss, vSphere, tc vFabric Server ... but I think that you'll setup tomcat and solr easier (it is mine personal opinion, if you are familiar with any one, use them of course).
Tomcat setup is described here.

Related

Centos 7 apache httpd can not load weblogic plug library

This is a practices that configure httpd service by adding weblogic apache plugin to support apache frontage to route traffic. This process is fellowing Puneeth Prakash's Oracle blog:
https://blogs.oracle.com/blogbypuneeth/configuring-wls-web-server-proxy-plug-in-for-apache-http-server-v2
Working environment as: Centos 7, apache 2.4.29.
I first tried install weblogic apache plugin for 12c (WLSPlugins12c-12.1.2), There are four libs in the lib directory, two modules for httpd and other two dynamic shared libs. Unfortunately, this version not work properly on ajax request, some time make session invalid.
Next I tried newer version as: WLSPlugin12.2.1.2.0. There are seven files in lib directory, two files for module libs and others 5 as shared dynamic load libs. I tried to put all files in lib directory into /usr/local/lib and change the owner to root:root, change mode to 755 for all files and then put a line in config file 00-base.conf in /etc/httpd/conf.modules.d directory. such as: "LoadModule weblogic_module /usr/local/lib/mod_wl_24.so" system load mod_wl_24.so properly, but not load dependency libopmnsecure.so, error as:
"Jan 06 16:22:49 centos.mywebsite.com.au httpd[4001]: httpd: Syntax error on line 58 of /etc/httpd/conf/httpd.conf: Syntax error on line 67 of /etc/httpd/conf.modules.d/00-base.conf: Cannot load /usr/local/lib/mod_wl_24.so into server: libopmnsecure.so: cannot open shared object file: No such file or directory"
From the error message we can see, mod_wl_24 is trying load dependent Dynamic lib libopmnsecure.so, but not found it in place. But, it is not true, libopmnsecure.so just seating in same directory with mod_wl_24.so. As Puneeth Prakash's Oracle blog required.
I had set up all related environment variables as well, that include APACHE_HOME, JAVA_HOME, PLUGIN_HOME,LD_LIBRARY_PATH.
If some one had an idea, please advise!
You need to add the specific path in LD_LIBRARY_PATH and make sure it is loaded when httpd starts.
I know you say you have, but double check, because that's exactly what the error is saying (that you haven't).
Apache httpd by default uses a file for environment variables that need to be set before starting apache httpd with its script "apachectl"
Here is the typical envvars file where we set it:
if test "x$LD_LIBRARY_PATH" != "x" ; then
LD_LIBRARY_PATH="/path/to/httpd/lib:/path/to/httpd/weblogic-module/lib:$LD_LIBRARY_PATH"
else
LD_LIBRARY_PATH="/path/to/httpd/lib:/path/to/httpd/weblogic-module/lib"
fi
export LD_LIBRARY_PATH
By the way, you don't need all files for httpd to start just these:
libdms2.so
libonssys.so
libopmnsecure.so
and obviously the module: mod_wl_24.so
Edit: Note this requirement/dependency of other libraries is new for these newer versions of the weblogic module, in earlier versions it wasn't necessary.
Update:
This issue was fixed by following steps:
Remove yum installed httpd service from system.
Download & Install weblogic apache plugins 12.2.1.2 from Oracle in customer location.
Following https://blacksaildivision.com/how-to-install-apache-httpd-on-centos to build apache 2.4.29 from source in CentOS 7
Please note: When run ./configure in apache build process, use parameter as:
--libdir=/usr/local/WLSPlugins12c-12.2.1.2/lib point to your weblogic plugin lib location
After apache was built and installed in your CentOS, setup httpd.service to be controlled by systemctl
Reconfigure apache and restart it.
it will works for you.
This issue was fixed by following steps:
1. Remove yum installed httpd service from system.
2. Download & Install weblogic apache plugins 12.2.1.2 from Oracle in customer location.
3. Following https://blacksaildivision.com/how-to-install-apache-httpd-on-centos to build apache 2.4.29 from source in CentOS 7
4. Please note: When run ./configure in apache build process, use parameter as: --libdir=/usr/local/WLSPlugins12c-12.2.1.2/lib point to your weblogic plugin lib location
5. After apache was built and installed in your CentOS, setup httpd.service to be controlled by systemctl
6. Reconfigure apache and restart it.
it will works for you.

Why doesn't my JBoss AS bin directory contain a run.sh script?

I am running Ubuntu 16.04 and I need to install and run Restcomm JSS7 stack as a JBoss AS Service.
I followed this video tutorial to install JBoss AS 7. Then I set the JBOSS_HOME environment variable to installation directory of JBoss AS 7. As a result, I was able to start the JBoss AS successfully by executing ./run.sh in the bin sub-folder of the installation directory.
Then I followed this guide to install Restcomm JSS7 stack. For that, I downloaded restcomm-jss7-7.4.1404.zip, unzipped it to /opt/ and then navigated to the ss7-jboss sub-directory and then executed ant deploy,
and the result was
...
BUILD SUCCESSFUL
which according to the guide is an indication of the service deployed successfully.
Then I am following CHAPTER 4 SECTION 4.1 of this user manual to run it as a JBoss AS Service. According to it,
All you have to do to start the Service is start the JBoss AS. This
will automatically start the SS7 Service. To start the JBoss Server
you must execute the run.sh (Unix) or run.bat (Microsoft Windows)
startup script in the /bin folder (on Unix or
Windows).
TWO PROBLEMS:
My <jboss_install_directory>/bin does NOT have a run.sh script. Because of this reason, I tried by running JBoss AS by using the regular standalone.sh script.
Next in the user manual, it is stated:
Result: If the service started properly you should see following lines
in the Unix terminal or Command Prompt depending on your environment:
(Note: I have pasted the following excerpt from user manual here, since it is too long to paste in this question.)
But I see none of those lines in my terminal. Rather, my terminal output of running ./standalone.sh is pasted here.
So I don't know how and where to proceed from here. Please help.
NOTE: This question is NOT a duplicate of my other question. Like I mentioned in the question titles, this question is about why my JBoss AS installation doesn't contain a run.sh script, and what would be its alternative. The other question is about some possible command to find out the JBoss Services started when it is running? When a beginner is starting to learn something, their entire purpose Not getting the job done. They have many confusions/questions in their mind.
The documentation documents how to start a JBoss 5.1 server but your installation uses a JBoss 7.1 server, which is why you have to use standalone.sh instead of run.sh to start the server and why the logs are different.
Since you correctly reach the JBoss AS 7.1.0.Final "Thunder" started in 3955ms line I wouldn't worry too much (except about using a documentation that is clearly outdated).
The documentation of your product only declares compatibility with JBoss 5.1.0. While it may work on later releases, you might want to check if there's a more recent version of your product. I wouldn't recommend installing JBoss AS 5.1.0 as it isn't supported anymore and will contain security breaches.

Does Tomcat (as a Service) not load native libraries for a Java web application?

I am using Tomcat7 and Ubuntu. I have a Java web application which uses some native libraries. When I run the web application within Eclipse it works through Eclipse internal Tomcat server during debugging. However, when I deploy the applcation to a hosted Tomcat service, the application fails when it reaches the point of loading these libraries.
I put the native libraries in /home/me/my_shared_libs, and gave
folder and file ownership to user "Tomcat7" -- sudo chown
I give all permissions of the native libraries to "Tomcat7" user
-- sudo chmod
In do sudo vi /usr/share/tomcat7/bin/setenv.sh, and put the following
in the file export CATALINA_OPTS="-Djava.library.path=/home/me/my_shared_libs"
Then I restart Tomcat -- sudo service tomcat7 restart And, whenever
refernce to load native libraries is reached, I get an error about InvocationTargetException.
I am also open to the option of adding the native libraries as part of the the application's .WAR file. (Although I am not sure how to do this in Eclipse).
Log of /var/log/tomcat7/catalina.out-->
Jun 30, 2016 8:11:50 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3643 ms
Load my_native_lib_called. libmachoman.so: cannot open shared object file: No such file or directory
EDIT:
I found out something very interesting. Tomcat does pick up the library location that I set above. What happens is I have two types of libraries (.so) files in the location. The first library (libcore.so) calls/loads the the second library (libmachoman.so). libcore.so is found and loaded both libmachoman.so is not, even though both are in the same location.
It can be done from the code itself. That should give you confidence in the loading of the library.
To do this you can use System.load()
It takes absolute path of the library for example
System.load("/PATH/TO/.so");
Run this piece of code one once when the application starts up before calling the library functions.
You'll have to place your library in a custom location on all the servers.
System.loadLibrary() is also used for the same purpose but the difference is that it would load library by name and would look into locations specified by the Java environment variable java.library.path.
But that can be a pain to set as you have mentioned, this change would have to be done in all the instances of tomcat.
After days of headache, I have a solution.
Edit file
sudo vi /etc/ld.so.conf
Append the location of native libs in file
include /etc/ld.so.conf.d/*.conf
/home/me/my_shared_lib
load config
sudo ldconfig
View the new change
ldconfig -p | grep my_shared_lib
This tells the dynamic linker where to look for native libraries.
My problem is solved.
There are other alternative solutions here, which may or may not have some cons.
Alternatively (also found out), you can can export LD_LIBRARY_PATH in the setenv.sh file under /usr/share/tomcat7/bin/ instead of the above steps. Settings become part of Tomcat; cleaner approach.

Can a java .war file contain a webserver

I'm looking into installing Jenkins, in the instructions it says
"Easy installation: Just java -jar jenkins.war, or deploy it in a
servlet container. No additional install, no database."
I understand the servlet container method, but does the above statement mean that just installing Java and running the .war file will somehow spinup a webserver and start serving http request ?
Yes, the war file contains the built-in Winstone servlet container, and running that command will start it and make it listen for requests on port 8080.
Edit: Jenkins 1.535 and above bundles Jetty (rather than Winstone). You can still run it with java -jar jenkins.war.
Jenkins comes bundled with Winstone, a very lightweight servlet container. As such, Jenkins can be started from the command line as stated by the instructions without any additional software installation.

Deploy java program on Linux

A web application has been developed in C# which hits my Java code through a restful web service which returns a JSON response.This process was working on a local machine with tomcat server. Now my Java application needs to be hosted on an external server in Linux environment.
Using putty, I logged into the particular hostname and as a root admin.
I have installed Java JDK 1.7, Apache tomcat server 7, my Java application as a war file is placed in the webapps folder. I can start the tomcat server too.
My question is:
How do I hit my application from windows. Is it http://x.y.z.k:8080//MYAPPNAME(war file name)/?
How do i check the java logs in the linux env?
Also I have a set of files that I read from my windows folders as in C://uploads//file.txt or C:\DeveloperTool\Pluggins\
I replaced them with the linux structure in my java code. as /home/opt/file.txt
Will this work?
How do I hit my application from windows. Is it
http://x.y.z.k:8080//MYAPPNAME(war file name)/?
If 8080 is the port Tomcat is configured to listen on (I think by default, it is), then that is correct. Bare in mind the web app name is case sensitive. You can configure this setting in $TOMCAT_HOME/conf/server.xml
How do i check the java logs in the linux env?
Since you're using a remote shell over SSH, you will want to use either tail or less to monitor logs in real time. The log files are stored in $TOMCAT_HOME/logs.
Try
$ less +F /path/to/tomcat/logs/catalina.out
catalina.out is the main file when running Tomcat on *nix systems.
Also I have a set of files that I read from my windows folders as in
C://uploads//file.txt or C:\DeveloperTool\Pluggins\
I replaced them with the linux structure in my java code. as
/home/opt/file.txt Will this work?
As Lutz Horn mentioned in the comments, try it. In theory, that should work fine as long as the permissions are setup properly.

Categories

Resources