OSX El Cap, Apache2, Tomcat 8, Lucee 5 - java

I have posted in the Lucee google group, but after four days, i'm just not getting the support I need. I have a feeling a Tomcat expert will be able to point me in the right direction fairly quickly, so I'm posting here.
OSX El Cap, Apache2, Tomcat 8, Lucee 5.
On http://localhost, i get the Apache "It Works!" page.
on http://localhost:8080, i get the default Lucee page, served from
/usr/local/Cellar/tomcat/8.5.3/libexec/apps/lucee
On http://localhost:8080/manager/html and http://localhost:8080/host-manager/html, I get the Tomcat admin pages.
I have a directory, /Volumes/Storage/{companyname}/sites/www-test-app/www that contains index.cfm and index.htm
I have www-test-app set up in my HOSTS file.
I have a host entry in httpd-vhosts.conf for www-test-app
I have an entry in tomcat's server.xml file:
<Host name="www-test-app" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/Volumes/Storage/{companyname}/sites/_test-app/www/">
<JarScanner scanClassPath="false"/>
</Context>
</Host>
When i call up http://www-test-app/index.htm, I get my static test page.
When I call up http://www-test-app/index.cfm I get this error:
HTTP Status 404 -
type Status report
message
description The requested resource is not available.
Apache Tomcat/8.5.3
I have stopped and restarted apache and tomcat to make sure config files are read.
THE BIGGEST CLUE:
I do not see WEB-INF being created under
/Volumes/Storage/{companyname}/sites/www-test-app/www
My directory permissions are 777 for this directory and all subdirectories:
/Volumes/Storage/{companyname}/sites
I'm not sure if I need to make ownership changes though.
Apache2 was included with El Cap. Apache testconfig yields "syntax OK".
Tomcat was installed via Homebrew.
Lucee was installed via WAR file per this page:
http://brianflove.com/2015/03/05/lucee-on-mac-os-x-yosemite-quick-start/
I am stuck from here... but oh so close, since the default Lucee page looks great, including any cfoutput/variables.
Here's is a sample from catalina.{date}.log:
13-Jul-2016 12:06:02.381 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.3
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 9 2016 11:16:29 UTC
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.3.0
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Mac OS X
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.11.5
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: x86_64
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_65-b17
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/Cellar/tomcat/8.5.3/libexec
13-Jul-2016 12:06:02.383 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/Cellar/tomcat/8.5.3/libexec
13-Jul-2016 12:06:02.384 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/Cellar/tomcat/8.5.3/libexec/conf/logging.properties
13-Jul-2016 12:06:02.384 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
13-Jul-2016 12:06:02.384 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
13-Jul-2016 12:06:02.384 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/Cellar/tomcat/8.5.3/libexec
13-Jul-2016 12:06:02.385 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/Cellar/tomcat/8.5.3/libexec
13-Jul-2016 12:06:02.385 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/Cellar/tomcat/8.5.3/libexec/temp
13-Jul-2016 12:06:02.385 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/marc/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
13-Jul-2016 12:06:02.578 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
13-Jul-2016 12:06:02.619 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Jul-2016 12:06:02.623 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
13-Jul-2016 12:06:02.624 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Jul-2016 12:06:02.625 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 702 ms
13-Jul-2016 12:06:02.654 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
13-Jul-2016 12:06:02.655 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.3
13-Jul-2016 12:06:02.665 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor /usr/local/Cellar/tomcat/8.5.3/libexec/conf/Catalina/localhost/ROOT.xml
13-Jul-2016 12:06:03.183 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
13-Jul-2016 12:06:08.815 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor /usr/local/Cellar/tomcat/8.5.3/libexec/conf/Catalina/localhost/ROOT.xml has finished in 6,149 ms
13-Jul-2016 12:06:08.816 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/docs
13-Jul-2016 12:06:08.837 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/docs has finished in 21 ms
13-Jul-2016 12:06:08.837 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/examples
13-Jul-2016 12:06:09.079 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/examples has finished in 241 ms
13-Jul-2016 12:06:09.079 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/host-manager
13-Jul-2016 12:06:09.104 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/host-manager has finished in 25 ms
13-Jul-2016 12:06:09.104 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/manager
13-Jul-2016 12:06:09.123 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/Cellar/tomcat/8.5.3/libexec/webapps/manager has finished in 19 ms
13-Jul-2016 12:06:09.157 INFO [www-test-app-startStop-1] org.apache.catalina.core.ApplicationContext.log Marking servlet CFMLServlet as unavailable
13-Jul-2016 12:06:09.157 SEVERE [www-test-app-startStop-1] org.apache.catalina.core.StandardContext.loadOnStartup Servlet [CFMLServlet] in web application [] threw load() exception
java.lang.ClassNotFoundException: lucee.loader.servlet.CFMLServlet
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1282)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1116)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:520)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:501)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1061)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1000)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4902)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5212)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1405)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1395)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Can't find the disconnect... where do i go from here?

RESOLVED {sigh}
Well, I’m totally ready to kick my own a$$. The solution was way more simple than I thought.
My (mis)understanding was that configuring the Lucee EXPRESS to use the local Apache install on the mac just wasn’t going to work – that I had to use the tomcat built-in web server. The tomcat web server, because it’s based on Java, is in fact case-sensitive when it comes to filenames in the URL – “Foo.jpg” is NOT the same as “foo.jpg” in the eyes of the ‘cat. This is why I had given up on Lucee Express.
I do recall trying to get local Apache to work with Lucee Express, but since so much time has passed since that attempt, I couldn’t begin to tell you what I was doing wrong. I just know I couldn’t get it to work – probably mucking with config files that I actually didn’t need to.
Anyway, the solution is simple as all heck… download Lucee Express. Then just configure virtual hosts in apache as one normally would, as Apache needs to be told to proxy any coldfusion requests to tomcat/lucee… like so:
<Directory "/Volumes/Storage/company/sites/_test-app/www">
Allow From All
AllowOverride All
Options +Indexes
Require all granted
DirectoryIndex index.cfm
</Directory>
<VirtualHost *:80>
ServerName "www-test-app"
ServerAlias "www-test-app.*.*.*.*.xip.io"
DocumentRoot "/Volumes/Storage/company/sites/_test-app/www"
<Proxy *>
Allow from 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8009/$1$2
</VirtualHost>
Then on the other side, add a similar entry for the Tomcat server.xml file:
<Host name="www-test-app" appBase="webapps" autoDeploy="true" unpackWARs="true">
<Context path="" docBase="/Volumes/Storage/company/sites/_test-app/www">
<JarScanner scanClassPath="false"/>
</Context>
</Host>
Then (damn it!!!) just start Apache and start Tomcat/Lucee. That’s it. Tomcat will create the WEB-INF files in each virtual host specified. The tomcat web server is still running on port 8888, and the ajp connector is still running on 8009.
http://www-test-app gives the result via Apache (case-insensitive urls).
Since Apache has root permission to listen on port 80, it does so… and passes CF requests on to port 8009.
BONUS: One can still test via the Tomcat web server…
http://www-test-app:8888 gives the result via Tomcat web server.
If one wanted to bypass/refrain from Apache and use the Tomcat web server, completely self-contained, BUT not have to add “:8888” to all their urls, homebrew for mac can install “haproxy” which, when run as root and configured using a simple config file, can receive requests on port 80 and forward them to port 8888.
For any NEW sites where the desire is to make sure file names are properly specified in code (case sensitivity-wise), this would be my ultimate solution. For legacy apps that were originally run on a case-insensitive stack, the use of the local Apache web server is the way to go.

Related

Tomcat catalina logging

I am using SpringMVC framework and Java 8 for development. In the Tomcat catalina.out file, the date timestamp and threadid are not added along with my application logs.
I am getting the logs as below
INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-9090"]
INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["https-jsse-nio-8443"]
INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
java.io.FileNotFoundException: /apps/opt/sws/logs
Request SecurityContextHolderAwareRequestWrapper
Beginning of the api method
I need to have the date timestamp and threadid be added along with my application
example:-
2022-01-08 12:51:23:986[Thread - http-nio-exec-4id] INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-9090"]
2022-01-08 12:52:56:986[Thread - http-nio-exec-8id] INFO Request SecurityContextHolderAwareRequestWrapper
2022-01-08 12:58:45:986[Thread - http-nio-exec-9id] INFO Beginning of the api method
2022-01-08 12:58:55:986[Thread - http-nio-exec-47id] ERROR Exception happened while loading
Please help me, where I need to change the settings and provide any samples.
You could do the followings to achieve this. Add the following line to log4j.properties.
java.util.logging.SimpleFormatter.format=%1$tF %1$tT [%4$-7s] %5$s %n
else you can also change Tomcat logging to log4j. You may refer here.

Tomcat server not shutting down during first time

I am developing a Queue message proof of concept on Spring-MVC 5.x, Java 8 and Tomcat server 9.x. While reading the queue messages from the Oracle table, thread warning messages appending in the Catalina log file.
If I try to shutdown and start the tomcat server, the tomcat server is not shutting down during the first time but on the next call tomcat server is shutting down and a memory leak warning message is logged in the log file.
Please help why I am unable to shutdown the tomcat server during the first time.
Log details
INFO [main] org.apache.catalina.core.Aprlifecyclelistener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path
INFO [main] org.apache.coyote.Abstract Protocol.init Initializing ProtocolHandler ["http-nio-9090"]
INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-jsse-nio-8443"]
INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 912 ms
INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.53]
INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/apps/opt/tomcat/webapps/Books.war]
WARNING [localhost-startStop-1] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [4.0]. Default version will be used.
INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup: time and JSP compilation time.
INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/apps/opt/tomcat/webapps/Books.war] has finished in [62,365] ms
INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-9090"]
INFO [main] org.apache.coyote.AbstractProtocol.start Starting Protocollandler ["https-jsse-nio-8443"]
INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 82019 ms
INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-9090"]
INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["https-jsse-nio-8443"]
INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferences Threads The web application [Books] appears to have started a thread named [AQThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Thread.sleep(Native Method)
WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferences Threads The web application [Books] appears to have started a thread named [AQThread] but has failed to stop it. This is very likely to create a nemory leak. Stack trace of thread:
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
java.net.SocketInputStream.read(SocketInputStream.java:171)
java.net.SocketInputStream.read(SocketInputStream.java:141)
oracle.net.ns.Packet.receive(Packet.java:282)
oracle.net.ns.DataPacket.receive(DataPacket.java:103)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:230)
oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamwWrapper.java:122)
oracle.jdbc.driver.T4CSocketInputStreamwrapper.read(T4CSocketInputStreamWrapper.java:78)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1179)
oracle.jdbc.driver.T4CMAREngine.unmarsha1SB1(T4CMAREngine.java:1155)
oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:279)
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:202)
oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1005)
oracle.jdbc.driver.OracleStatement.doExecutewithTimeout(OracleStatement.java:1307)
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3493)
oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
oracle.AQ.AQOracleQueue.dequeue(AQOracleQueue.java:1625)
oracle.AQ.AQOracleQueue.dequeue(AQOracleQueue.java:1326)
INFO [AQThread] org.apache.catalina.loader WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [oracle.AQ.AQOracleQueue]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [oracle.AQ.AQOracleQueue]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1435)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1423)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1262)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1223)
Code sample
public void deQueMsg() throws AQException, SQLException {
java.sql.Connection dqConn = QueueConnection.getConnection(); // DB call
dqConn.setAutoCommit(false);
AQSession dqSess = null;
object
}
//db connection
public Connection QueueConnection(String strJdbc)
{
OracleDataSource OraDs;
OraDs = new OracleDataSource();
OraDs.setDriverType("thin");
OraDs.setServerName("test");
OraDs.setPortNumber(1521);
OraDs.setDatabaseName("booksdb");
OraDs.setUser("testusr");
OraDs.setPassword("test123");
return OraDs();
}

Configure Apache Web Server with Tomcat and trying to Deploy war file

I am not getting my project on my domain name. It gives me Apache Test Page instead of my project which i have added in webapps.
I have my war file FINAL_WE.war in /opt/code/apache-tomcat-8.5.54/webapps/
And I have started my tomcat server. using sh startup.sh from /bin/ folder.
Log gives me tail -f catalina.out
20-Apr-2020 04:06:13.733 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
20-Apr-2020 04:06:13.837 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
20-Apr-2020 04:06:13.879 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
20-Apr-2020 04:06:13.909 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1307 ms
20-Apr-2020 04:06:14.001 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
20-Apr-2020 04:06:14.004 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.54
20-Apr-2020 04:06:14.038 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/code/apache-tomcat-8.5.54/webapps/FINAL_WE.war]
20-Apr-2020 04:06:14.602 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/code/apache-tomcat-8.5.54/webapps/FINAL_WE.war] has finished in [564] ms
20-Apr-2020 04:06:14.609 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
20-Apr-2020 04:06:14.623 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 714 ms
I have executed the following commands
1. cd /usr/local/apache/modules
2. cd /usr/local/apache/conf
3. vim workers.properties
worker.list=we-matter
worker.we-matter.type=ajp13
worker.we-matter.port=8009
worker.we-matter.host=192.169.217.121
4. Apache Web Server file:
vim /usr/local/apache/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /usr/local/apache/conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel emerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T %p %q %r %v %U"
<VirtualHost *:80>
ServerName www.we-matter.com
RewriteEngine on
RewriteRule ^/(.*)$ /we-matter/$1 [L,PT]
JkMount /* we-matter
</VirtualHost>
6. service httpd stop
service httpd start
You're creating a named virtual host in Apache httpd.
<VirtualHost *:80>
ServerName www.upyourcode.com
RewriteEngine on
RewriteRule ^/(.*)$ /upyourcode/$1 [L,PT]
JkMount /* upyourcode
</VirtualHost>
This will cover every request coming in with the Host header to www.upyourcode.com. Any other host name will fall back to the default virtual host, which likely does not have your JkMount configuration, but is rather configured to the default content, e.g. httpd's "Success" page, rather than your own content.
You'll need to either configure the default virtual host, add a ServerAlias to the virtual host you mention in this question, or add yet another virtual host with the ServerName that you're expecting to see your content on.

IntelliJ IDEA 13.0.3 and Tomcat 8.0.9. Cant get it to work

I'm trying to deploy a Java web application running on Tomcat. I got the book
Professional Java for Web Applications: Featuring Websockets, Spring Framework, JPA Hibernate, and Spring Security
and I've done everything said to get IntelliJ IDEA 13 work together with Tomcat 8.0.9. I've tested the server container manually and it works great, even deploying .war files works great. However when i move on to start/debug a web application - in this case the first example form the book - from IntelliJ the application wont start. The output in the Tomcat Log doesn't say much.
Server output tells me this:
Connected to server
[2014-08-08 09:17:35,075] Artifact Sample-Debug-IntelliJ:war exploded: Artifact is being deployed, please wait...
[2014-08-08 09:17:35,097] Artifact Sample-Debug-IntelliJ:war exploded: Error during artifact deployment. See server log for details.
[2014-08-08 09:17:35,098] Artifact Sample-Debug-IntelliJ:war exploded: com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: L:\java-dev\java_web_apps_chapter_code\9781118656464 Full Code\Chapter 02\Sample-Debug- IntelliJ\target\sample-debug-intellij-1.0.0.SNAPSHOT not found for the web module.
08-Aug-2014 21:17:44.671 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory L:\java-dev\apache-tomcat-8.0.9\webapps\manager
08-Aug-2014 21:17:44.939 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory L:\java-dev\apache-tomcat-8.0.9\webapps\manager has finished in 268 ms
Tomcat Catalina Log output this:
08-Aug-2014 22:56:35.843 INFO [main] org.apache.catalina.core.AprLifecycleListener.init Loaded APR based Apache Tomcat Native library 1.1.30 using APR version 1.4.8.
08-Aug-2014 22:56:35.846 INFO [main] org.apache.catalina.core.AprLifecycleListener.init APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
08-Aug-2014 22:56:36.652 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.1g 7 Apr 2014)
08-Aug-2014 22:56:36.738 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
08-Aug-2014 22:56:36.746 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
08-Aug-2014 22:56:36.747 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1060 ms
08-Aug-2014 22:56:36.771 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
08-Aug-2014 22:56:36.771 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.9
08-Aug-2014 22:56:36.778 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
08-Aug-2014 22:56:36.784 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
08-Aug-2014 22:56:36.785 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 38 ms
08-Aug-2014 22:56:46.785 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory L:\java-dev\apache-tomcat-8.0.9\webapps\manager
08-Aug-2014 22:56:47.035 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory L:\java-dev\apache-tomcat-8.0.9\webapps\manager has finished in 251 ms
I've tried on both Windows and OSX and it's the same story on both with the exact same error.
When i access http://localhost:8080/i can see that the server is up and running. However, the application isn't deployed.
Anyone experiencing the same error as me and/or know a solution?
I'm running IntelliJ IDEA 13.0.3, Java 1.8.0_11 and Tomcat 8.0.9.
EDIT: I've also tried with IntelliJ IDEA 13.1.4. Didn't make any difference.
Steps taken
Downloaded Java 1.8.0_11, installed it and added it to environment variables.
Downloaded Tomcat, unpacked it and made the following changes to it (step 2-4);
In conf/tomcat-users.xml i added this user:
<user username="admin" password="admin" roles="manager-gui,admin-gui" />
In conf/web.xml i added the code below beneath the org.apache.jasper.servlet.jspServlet element
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>compiler</param-name>
<param-value>modern</param-value>
</init-param>
Downloaded apache-ant and added a setenv.bat file in the apache-tomcat/bin directory with the following script
export CLASSPATH=L:/java-dev/jdk8/lib/tools.jar:L:/java-dev/apache-ant/lib/ant.jar:L:/java-dev/apache-ant/lib/ant-launcher.jar
Started IntelliJ and added the Tomcat application server.
Then i imported the project and set it to use the Tomcat server that I just added.
UPDATE: 2014-08-09 16:22
I tried to deploy a JavaEE web application that IntelliJ created itself, and that worked right away. Seems like it's something wrong with the source code that the book references.
I had similar problem. The problem was in artifact configuration in Run/Debug Configurations. I had to remove the project artifact and readd it. The important thing is to choose Web Application: Exploded, From Modules...
You can read my blog post that contains screenshots about this issue.
For me it worked with:
File >Project Structure >Artifacts
In the
Output Layout on the right side >"Available Elements?"
right click on the available libraries ( for me it was "Spring MVC-4.2.4.RELEASE")
Put into Lib ( actually click on the fix warning button )
And it worked.
Open "Debug Configuration" in IntelliJ IDEA and make sure that "Deploy applications configured in Tomcat" checkbox is checked as it shown on the screenshot
open the artifact config dialog (artifact > edit...)
check 'Show contents of elements' in the dialogs bottom section
highlight the 'WEB-INF' directory
right click on the library container (on the right pane)
select from context menu 'put into /WEB-INF/lib'
the lib folder is added in the output layout
rebuild artifact
restart webserver
Hope it helps.

How do I debug GlassFish 3 using Eclipse Helios?

I am using the GlassFish 3 server adapter with Eclipse Helios 3.6. I can start the server using the Servers view in Eclipse, and things run just fine - but I am not able to debug my code.
After using the GF Admin Console to enable debugging (Configuration → JVM Settings → Debug, then restart the server), clicking Debug (Ctrl+Alt+D) gives me an error window:
I'm guessing this is because Eclipse can't connect to the JVM's debug port (9009 by default).
What is the proper way to set up GlassFish 3 debugging in Helios?
Edit
Re: #The Elite Gentleman, there aren't any errors that show up in the console. Here's an example:
Nov 29, 2010 11:47:42 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
C:\Program Files\Java\jdk1.6.0_22\bin\java.exe
-cp
C:/glassfishv3/glassfish/modules/glassfish.jar
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=192m
-XX:NewRatio=2
-XX:+LogVMOutput
-XX:LogFile=C:\glassfishv3\glassfish\domains\myDomain/logs/jvm.log
-Xmx512m
-client
-javaagent:C:/glassfishv3/glassfish/lib/monitor/btrace-agent.jar=unsafe=true,noServer=true
-Dosgi.shell.telnet.maxconn=1
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Dfelix.fileinstall.dir=C:\glassfishv3\glassfish/modules/autostart/
-Djavax.net.ssl.keyStore=C:\glassfishv3\glassfish\domains\myDomain/config/keystore.jks
-Dosgi.shell.telnet.port=6666
-Djava.security.policy=C:\glassfishv3\glassfish\domains\myDomain/config/server.policy
-Dfelix.fileinstall.poll=5000
-Dcom.sun.aas.instanceRoot=C:\glassfishv3\glassfish\domains\myDomain
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Dosgi.shell.telnet.ip=127.0.0.1
-Djava.endorsed.dirs=C:\glassfishv3\glassfish/modules/endorsed;C:\glassfishv3\glassfish/lib/endorsed
-Dcom.sun.aas.installRoot=C:\glassfishv3\glassfish
-Djava.ext.dirs=C:\Program Files\Java\jdk1.6.0_22/lib/ext;C:\Program Files\Java\jdk1.6.0_22/jre/lib/ext;C:\glassfishv3\glassfish\domains\myDomain/lib/ext
-Dfelix.fileinstall.bundles.new.start=true
-Djavax.net.ssl.trustStore=C:\glassfishv3\glassfish\domains\myDomain/config/cacerts.jks
-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as
-Djava.security.auth.login.config=C:\glassfishv3\glassfish\domains\myDomain/config/login.conf
-DANTLR_USE_DIRECT_CLASS_LOADING=true
-Dfelix.fileinstall.debug=1
-Dorg.glassfish.web.rfc2109_cookie_names_enforced=false
-Djava.library.path=C:/glassfishv3/glassfish/lib;C:/Program Files/Java/jdk1.6.0_22/bin;C:/glassfishv3/glassfish;C:/Windows/Sun/Java/bin;C:/Windows/System32;C:/Windows;C:/Program Files/Java/jdk1.6.0_22/jre/bin/server;C:/Program Files/Java/jdk1.6.0_22/jre/bin;C:/Program Files/Java/jdk1.6.0_22/jre/lib/amd64;C:/Python26/Scripts;C:/Python26;C:/Windows/System32/wbem;C:/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static;C:/Program Files (x86)/Common Files/Roxio Shared/DLLShared;C:/Program Files (x86)/Common Files/Roxio Shared/10.0/DLLShared;C:/Program Files (x86)/Microsoft SQL Server/100/Tools/Binn;C:/Program Files/Microsoft SQL Server/100/Tools/Binn;C:/Program Files/Microsoft SQL Server/100/DTS/Binn;C:/Windows/System32/WindowsPowerShell/v1.0;C:/Program Files (x86)/Microsoft SQL Server/100/Tools/Binn/VSShell/Common7/IDE;C:/Program Files (x86)/Microsoft SQL Server/100/DTS/Binn;C:/Program Files (x86)/PuTTY;C:/Program Files (x86)/jboss-4.2.2.GA/bin;C:/Program Files/MySQL/MySQL Server 5.0/bin;C:/Program Files/IBM/SQLLIB/BIN;C:/Program Files/IBM/SQLLIB/FUNCTION;C:/Program Files/IBM/SQLLIB/samples/repl;C:/Program Files/TortoiseSVN/bin;C:/jboss-5.1.0.GA/bin;C:/Program Files (x86)/QuickTime/QTSystem;C:/Program Files (x86)/Git/cmd;C:/Program Files/SlikSvn/bin;C:/glassfishv3/glassfish/%APPDATA%/Python/Scripts;C:/Program Files (x86)/Apache/apache-ant-1.7.0/bin;C:/Program Files (x86)/CVSNT/C:/jboss-5.1.0.GA/bin;C:/Program Files (x86)/Java/jdk1.6.0_14;C:/Program Files (x86)/Apache/apache-maven-2.1.0/bin;C:/glassfishv3/glassfish/bin
com.sun.enterprise.glassfish.bootstrap.ASMain
-domainname
myDomain
-asadmin-args
start-domain,,,--domaindir,,,C:\glassfishv3\glassfish\domains,,,--debug,,,--verbose=true,,,myDomain
-instancename
server
-verbose
true
-debug
true
-asadmin-classpath
C:/glassfishv3/glassfish/modules/admin-cli.jar
-asadmin-classname
com.sun.enterprise.admin.cli.AsadminMain
-upgrade
false
-domaindir
C:/glassfishv3/glassfish/domains/myDomain
-read-stdin
true
Nov 29, 2010 11:47:43 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: Successfully launched in 4 msec.
INFO: Running GlassFish Version: GlassFish Server Open Source Edition 3.0.1 (build 22)
INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
INFO: Starting Grizzly Framework 1.9.18-o - Mon Nov 29 11:47:46 EST 2010
INFO: Starting Grizzly Framework 1.9.18-o - Mon Nov 29 11:47:46 EST 2010
INFO: Grizzly Framework 1.9.18-o started in: 40ms listening on port 7676
INFO: Grizzly Framework 1.9.18-o started in: 50ms listening on port 3700
INFO: Grizzly Framework 1.9.18-o started in: 90ms listening on port 80
INFO: Grizzly Framework 1.9.18-o started in: 60ms listening on port 4848
INFO: Grizzly Framework 1.9.18-o started in: 67ms listening on port 8181
INFO: The Admin Console is already installed, but not yet loaded.
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
INFO: SEC1002: Security Manager is OFF.
INFO: Security startup service called
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
INFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created.
INFO: Realm jdbc of classtype com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm successfully created.
INFO: Security service(s) started successfully....
INFO: Created HTTP listener http-listener-1 on port 80
INFO: Created HTTP listener http-listener-2 on port 8181
INFO: Created HTTP listener admin-listener on port 4848
INFO: Created virtual server server
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Created virtual server __asadmin
INFO: Created virtual server __asadmin
INFO: Virtual server server loaded system default web module
|#]
INFO: Virtual server server loaded system default web module
INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/richfaces-showcase'
INFO: Selected fallback cache factory
INFO: Creating LRUMap cache instance using parameters: {org.richfaces.enableControlSkinningClasses=false, javax.faces.PROJECT_STAGE=Development, com.sun.faces.validateXml=true, com.sun.faces.forceLoadConfiguration=true, javax.faces.STATE_SAVING_METHOD=server, org.richfaces.enableControlSkinning=true, javax.faces.FACELETS_LIBRARIES=/WEB-INF/app-tags.taglib.xml, org.richfaces.skin=#{skinBean.skin}}
INFO: Creating LRUMap cache instance of 512 items capacity
INFO: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0-SNAPSHOT SVN r.20127
INFO: Monitoring jndi:/server/richfaces-showcase/WEB-INF/faces-config.xml for modifications
INFO: Loading application richfaces-showcase at /richfaces-showcase
INFO: Loading application richfaces-showcase at /richfaces-showcase
INFO: Loading richfaces-showcase Application done is 7895 ms
INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Portable JNDI names for EJB UserBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/UserBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/UserBean!com.lapis.retailerportal.demo.ejb.UserBean]
INFO: Portable JNDI names for EJB DbTestBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/DbTestBean!com.lapis.retailerportal.demo.ejb.DbTestBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/DbTestBean]
INFO: Portable JNDI names for EJB NewsBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/NewsBean!com.lapis.retailerportal.demo.ejb.NewsBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/NewsBean]
INFO: Portable JNDI names for EJB GameConfigBean : [java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/GameConfigBean!com.lapis.retailerportal.demo.ejb.GameConfigBean, java:global/RetailerPortalDemo/RetailerPortalDemo_Bean/GameConfigBean]
INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/RetailerPortalDemo'
INFO: com.lapis.retailerportal.demo.entity.Retailer actually got transformed
INFO: Selected fallback cache factory
INFO: Creating LRUMap cache instance using parameters: {javax.faces.PROJECT_STAGE=Development, com.sun.faces.validateXml=true, com.sun.faces.forceLoadConfiguration=true, org.richfaces.skin=tweaked}
INFO: Creating LRUMap cache instance of 512 items capacity
INFO: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0.20101110-M4 SVN r.20021
INFO: com.lapis.retailerportal.demo.entity.GameConfig actually got transformed
INFO: com.lapis.retailerportal.demo.entity.NewsItem actually got transformed
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: EclipseLink, version: Eclipse Persistence Services - 2.0.1.v20100213-r6600
INFO: file:/C:/glassfishv3/glassfish/domains/myDomain/eclipseApps/RetailerPortalDemo/RetailerPortalDemo_Bean_jar/_RPD_Persistence_CTX login successful
INFO: Loading application RetailerPortalDemo#RetailerPortalDemo_Web.war at RetailerPortalDemo
INFO: Loading application RetailerPortalDemo#RetailerPortalDemo_Web.war at RetailerPortalDemo
INFO: Loading RetailerPortalDemo Application done is 5656 ms
INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Felix(2386ms) startup services(14265ms) total(16651ms)
INFO: Binding RMI port to *:8686
INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://192.168.5.10:8686/jndi/rmi://192.168.5.10:8686/jmxrmi
INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\modules\autostart, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\mjball\AppData\Local\Temp\fileinstall-2104459395405070416, felix.fileinstall.filter = null}
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\domains\myDomain\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\mjball\AppData\Local\Temp\fileinstall-286375592969619901, felix.fileinstall.filter = null}
INFO: Started bundle: file:/C:/glassfishv3/glassfish/modules/autostart/osgi-web-container.jar
INFO: Updating configuration from org.apache.felix.fileinstall-autodeploy-bundles.cfg
INFO: Installed C:\glassfishv3\glassfish\modules\autostart\org.apache.felix.fileinstall-autodeploy-bundles.cfg
INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv3\glassfish\domains\myDomain\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\mjball\AppData\Local\Temp\fileinstall--3209587030652226629, felix.fileinstall.filter = null}
Edit 2
I was able to successfully debug in Eclipse by starting GlassFish externally, e.g.
> asadmin start-domain myDomain
and then creating a custom Debug Configuration:
So why can't the GlassFish server adapter do this?
Edit 3 - Problem solved
Originally, I had added GlassFish support through the GlassFish Tools plugin. I uninstalled the plugin, and added GlassFish support using Servers → New → Server → Download additional server adapters. Now I can debug. Woohoo!
You should start Glassfish with the debug instead of the run option inside the Servers view.
Same problem that you and it was driving me crazy.
My configuration is eclipse indigo over windows 7 and glassfish 3.1.1. The jdk I'm using is 1.7x64. I downloaded the glassfish server tools through the new server window.
I have solved it (it currently works, who knows what's happening in the near future) downloading and installing jdk1.6.30. I haven't uninstalled jdk1.7, but I've configured my eclipse project to use jdk1.6 instead.
Hi all I found solution for debugging problem. In my case Eclipse Indigo and linux x64 it works. More details in other thread about the same error https://stackoverflow.com/a/14551690/1976844

Categories