Discussion:
[jetty-users] Jetty 9.4 issue while rendering JSP page
Karn, Vibhas
2018-07-06 06:41:10 UTC
Permalink
Hi All,

I am struggling with jetty Migration of 6.1 to latest or anything above Jetty 9.1 . Currently I am trying with Jetty 9.4 which is latest.
I am able to compile the old code with the new one but there are few issues with the migration which I am trying to fix. Yes its the tough job but no option left.
I am currently focussing to render the old jsp pages after migrating it to Jetty 9.4. Here is the sample code , I have mentioned the problem in the post below. Help me with you suggestion or anything as I am struggling to fix this issue since a week now.

JettyServer Sample Code :

public class JettyServer extends AbstractService implements IJettyServer, IStatus {
public static final String SERVICE_NAME = "JettyServer"; //frozen
private static final Logger log = Logger.getLogger(JettyServer.class.getName());
private static JettyServer instance = null;
private Server server;

// The map of service id to the jetty slave.
private final Map<Integer, IJettySlave> idToSlaveMap = new HashMap<Integer, IJettySlave>();

// A linked list of the slaves.
private final List<IJettySlave> availableSlaves = new LinkedList<IJettySlave>();

// TODO ref count availableAPIs.
private final Set<Class> availableAPIs = new HashSet<Class>();

// The map of service if to the slave status.
private final Map<Integer, IStatus> idToStatusMap = new HashMap<Integer, IStatus>();
private final int registryPort;
private int maxWaitForSlave = 0;

/**
* Creates a new JettyServer using the default registry port from the ServiceControllerConfig.
* @throws RemoteException when RMI problems occur.
*/
public JettyServer() throws RemoteException {
this(ServiceControllerConfig.getInstance().getControlPort());
}

/**
* Creates a new JettyServer using the control port passed.
* @param registryPort the registry port.
* @throws RemoteException when RMI problems occur.
*/
public JettyServer(final int registryPort) throws RemoteException {
this.registryPort = registryPort;
instance = this;
}

@Override
public void initialize(final ServiceConfiguration genericConfig, final Controller controller, final int serviceId,
final ServiceLock lock) throws Exception {
if (genericConfig instanceof JettyServerConfiguration) {
configuration = (JettyServerConfiguration) genericConfig;
} else {
configuration = XmlConfigurable.createInstance(JettyServerConfiguration.class,
genericConfig.getXmlConfigElement());
}

server = new Server();
log.info("jetty version = " + Server.getVersion()); //frozen

maxWaitForSlave = getConfiguration().getMaxWaitForSlave();

final boolean debug = getConfiguration().getMortBayDebug();
log.info("Eclipse mortbay debug = '" + debug + "'"); //frozen
org.eclipse.jetty.util.log.Log.getLog().setDebugEnabled(debug);

// Configure http
final boolean httpEnabled = getConfiguration().getHttpEnabled();

if (httpEnabled) {
final int mainPort = getConfiguration().getHttpPort();

log.info("adding default connector on port '" + mainPort + "'"); //frozen
//Re-writing the code for jetty 9.3
// Setup HTTP Connector

HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");

// Establish the HTTP ServerConnector
ServerConnector httpConnector = new ServerConnector(server, new HttpConnectionFactory(httpConf));
httpConnector.setPort(mainPort);
server.addConnector(httpConnector);
}

// Configure SSL
final boolean sslEnabled = getConfiguration().getSslEnabled();

if (sslEnabled) {
//Re-writing code for Jetty 9.3
final int mainPort = getConfiguration().getHttpPort(); //8580
final int sslPort = getConfiguration().getSslPort(); //8581
final String sslKeyStore = getConfiguration().getSslKeyStore();
final String sslPassword = getConfiguration().getSslPassword();
final String sslKeyPassword = getConfiguration().getSslKeyPassword();
final String sslTrustPassword = getConfiguration().getSslTrustPassword();

//Added for Jetty 9.3
final KeyStore trustKeyStore = KeyStore.getInstance(getConfiguration().getSslKeyStore());

SslContextFactory theSSLFactory = new SslContextFactory();

theSSLFactory.setKeyStorePath(sslKeyStore);
theSSLFactory.setKeyManagerPassword(sslPassword);
theSSLFactory.setKeyStorePassword(sslKeyPassword);
theSSLFactory.setTrustStore(trustKeyStore);
theSSLFactory.setTrustStorePassword(sslTrustPassword);

// Setup HTTP Connector
HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");

// Setup HTTPS Configuration
HttpConfiguration httpsConf = new HttpConfiguration(httpConf);
httpsConf.addCustomizer(new SecureRequestCustomizer()); // adds ssl info to request object

// Establish the HTTPS ServerConnector
ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(theSSLFactory, "http/1.1"), new HttpConnectionFactory(httpsConf));
httpsConnector.setPort(sslPort);

log.info("adding ssl connector on port '" + sslPort + "'"); //frozen
server.addConnector(httpsConnector);

//}
}

// Check we had 1 connector else the server is useless
if (server.getConnectors().length == 0) {
throw new FileNotFoundException("No connectors registered. Please see HttpEnable or SslEnable XML tags."); //frozen
}

// Configure the handlers
final HandlerCollection handlers = new HandlerCollection();

//4. Enabling the Annotation based configuration
org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration",
"org.eclipse.jetty.plus.webapp.EnvConfiguration", "org.eclipse.jetty.plus.webapp.PlusConfiguration");
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");

for (final WebAppContext webAppContext : getConfiguration().getWebAppContexts()) {
log.info("Adding WebAppContext " + webAppContext.getWar() + " at " + webAppContext.getContextPath()); //frozen

webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
".*/[^/]*jstl.*\\.jar$");
handlers.addHandler(webAppContext);
}

final boolean accessLogEnabled = getConfiguration().getLogEnabled();

if (accessLogEnabled) {
final RequestLogHandler requestLogHandler = new RequestLogHandler();
final File logDir = ServiceUtilities.getLogDirectory();

if (!logDir.exists()) {
logDir.mkdirs();
}

final File logFile = new File(getConfiguration().getLogFormat());

if (!logFile.getParentFile().exists()) {
logFile.getParentFile().mkdirs();
}

final NCSARequestLog requestLog = new NCSARequestLog(getConfiguration().getLogFormat());
requestLog.setRetainDays(getConfiguration().getLogRetain());
requestLog.setAppend(getConfiguration().getLogAppend());
requestLog.setExtended(getConfiguration().getLogExtended());
requestLog.setLogTimeZone(getConfiguration().getLogTz());
requestLog.setLogLatency(getConfiguration().getLogLatency());
requestLogHandler.setRequestLog(requestLog);
handlers.addHandler(requestLogHandler);
}

handlers.addHandler(new DefaultHandler());

server.setHandler(handlers);

// server.setUserRealms(new UserRealm[] { new OSMUserRealm() });
// server.addBean(new LoginService[] { new OSMUserRealm() });

// HashLoginService loginService = new HashLoginService();
//loginService.setName("osmRealm");
//server.addBean(loginService);

// log.info("initialize...." + loginService.getName());
JettyServerInfo.install(server);

super.initialize(configuration, controller, serviceId, lock);
}

@Override
public JettyServerConfiguration getConfiguration() {
return (JettyServerConfiguration) super.getConfiguration();
}

@Override
public synchronized void stop() {
final Thread t = new Thread("JettyServer Stop Thread") { //frozen
@Override
public void run() {
try {
server.stop();
} catch (Exception ex) {
log.log(Level.SEVERE, "Failed to stop Jetty server", ex); //frozen
}
}
};

t.start();

try {
t.join(500);
} catch (final InterruptedException ex) {
}

super.stop();
}

@Override
public synchronized void start() throws Exception {
log.info("start()"); //frozen

registerJetty();

server.start();

// finish startup which registers with the controller
super.start();

server.join(); //For Jetty 9.3 and above

// server.join(); need to uncomment and verify if jetty if we need server.join in Jetty 9.3 as previous person don't have
log.info("After Jetty 9.3 Services starts..");
}

private void registerJetty() throws RemoteException, AlreadyBoundException, AlreadyBoundException {
final Registry registry = LocateRegistry.getRegistry("127.0.0.1", registryPort); //frozen

final Remote remote = UnicastRemoteObject.toStub(this);
log.info("Registering JettyServer"); //frozen
registry.rebind(IJettyServer.JETTYSERVER_NAME, remote);
}

@Override
public void unregister(final IJettySlave slave) throws RemoteException {
log.info("unregister(" + slave.getName() + ") (ID=" + slave.getServiceID() + ")"); //frozen

synchronized (idToSlaveMap) {
idToSlaveMap.remove(slave.getServiceID());

if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.remove(slave.getServiceID());
}
}
}

synchronized (availableSlaves) {
// Shouldnt really be in the list as teh BusyAPIDynamicProxy shouldnt
// have re-added it on a shutdown.
if (availableSlaves.remove(slave)) {
availableSlaves.notifyAll();
}
}
}

@Override
public void register(final IJettySlave slave) throws RemoteException {
log.info("registered(" + slave.getName() + ") (ID=" + slave.getServiceID() + ")"); //frozen

synchronized (idToSlaveMap) {
idToSlaveMap.put(slave.getServiceID(), slave);

if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.put(slave.getServiceID(), (IStatus) slave);
}
}
}

synchronized (availableSlaves) {
availableSlaves.add(slave);
availableSlaves.notifyAll();
}

synchronized (availableAPIs) {
availableAPIs.addAll(slave.getAPIs());
}
}

public static JettyServer getInstance() {
return instance;
}

public <I extends Remote> I get(final Class<I> i) throws RemoteException {
return createApiProxy(i);
}

void push(final IJettySlave slave) {
synchronized (availableSlaves) {
availableSlaves.add(0, slave);
availableSlaves.notifyAll();
}
}

<I extends Remote> IJettySlave pop(final Class<I> i)
throws RemoteException {
if (idToSlaveMap.isEmpty()) {
throw new IllegalStateException("No JettySlaves available, please check the server log files."); //frozen
}

if (availableAPIs.isEmpty()) {
throw new IllegalStateException("No JettySlave APIs available, please check the server log files."); //frozen
}

synchronized (availableAPIs) {
// Check if any slave provides this API, as its pointless waiting
// when we know an API will not be available.
// FYI : This should be removed if we provide auto startup of slaves.
if (!availableAPIs.contains(i)) {
throw new RemoteException("API " + i.getName() + " is not available."); //frozen
}
}

final long end = System.currentTimeMillis() + maxWaitForSlave;

while (System.currentTimeMillis() < end) {
synchronized (availableSlaves) {
// Get a service from any idle slave.
final Iterator<IJettySlave> it = availableSlaves.iterator();

while (it.hasNext()) {
final IJettySlave slave = it.next();

try {
final I slaveApi = slave.get(i);

if (slaveApi != null) {
it.remove(); // remove this slave from list

return slave;
}
} catch (final RemoteException re) {
// this host doesnt work so remove it.
it.remove();
}
}

// now wait for a slave to become inactive
final long sleep = end - System.currentTimeMillis();

try {
if (sleep > 0) {
availableSlaves.wait(sleep);
}
} catch (final InterruptedException ex) {
}
}
}

throw new IllegalStateException("All APIs '" + i.getName() + "' are busy or unavailable."); //frozen
}

/**
* Creates a proxy for the specific interface.
* @param <I> a remote interface class.
* @param i the remote interface class
* @return the proxy for this interface.
* @throws RemoteException when RMI fails.
* @see BusyAPIDynamicProxy
*/
@SuppressWarnings("unchecked")
private <I extends Remote> I createApiProxy(final Class<I> i)
throws RemoteException {
// Insert the busy dynamic proxy so we know which is busy
final I proxy = (I) java.lang.reflect.Proxy.newProxyInstance(i.getClassLoader(), new Class[] { i },
new BusyAPIDynamicProxy<I>(this, i));

return proxy;
}

public final Map<Integer, IStatus> getSlaveStatus()
throws RemoteException {
return new TreeMap<Integer, IStatus>(idToStatusMap);
}

public final IStatus getStatus() {
return this;
}

@Override
public long getUpTime() throws RemoteException {
final java.lang.management.RuntimeMXBean mx = java.lang.management.ManagementFactory.getRuntimeMXBean();

return mx.getUptime() / 1000;
}

@Override
public long getTotalMemory() throws RemoteException {
return Runtime.getRuntime().totalMemory();
}

@Override
public long getFreeMemory() throws RemoteException {
return Runtime.getRuntime().freeMemory();
}

@Override
public long getMaxMemory() throws RemoteException {
return Runtime.getRuntime().maxMemory();
}

public static void main(final String[] args) throws Exception {
// jetty depends on the registry all the time.
LocateRegistry.createRegistry(ServiceControllerConfig.getInstance().getControlPort());

System.setProperty("service.id", "-1"); //frozen

runStandalone(SERVICE_NAME);

// jetty server depends on a slave working.
runStandalone("JettySlave1"); //frozen
}
}

Jetty Configuration class:

/**
* RCS: $Id: //oswm/rel20.10_Patches/WorkManager/src/com/osm/services/webservice/JettyServerConfiguration.java#1 $
* Last Modified: $Author: adminp4 $, $DateTime: 2018/03/28 14:59:10 $
*/
package com.osm.services.webservice;

import java.io.File;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import org.eclipse.jetty.webapp.WebAppContext;

import org.w3c.dom.Element;

import com.osm.services.configuration.ManagerServiceConfiguration;


public class JettyServerConfiguration extends ManagerServiceConfiguration {
private static final Logger log = Logger.getLogger(JettyServerConfiguration.class.getName());
private static final String WAR_TAG = "War"; //frozen
private static final String MAX_WAIT_FOR_SLAVE_TAG = "MaxWaitForSlave"; //frozen
private static final String MORTBAY_DEBUG_TAG = "MortBayDebug"; //frozen
private static final String HTTP_ENABLED_TAG = "HttpEnabled"; //frozen
private static final String HTTP_PORT_TAG = "HttpPort"; //frozen
private static final String NIO_ENABLED_TAG = "NioEnabled"; //frozen

// SSL specific
private static final String SSL_ENABLED_TAG = "SslEnabled"; //frozen
private static final String SSL_PORT_TAG = "SslPort"; //frozen
private static final String SSL_KEY_STORE_TAG = "SslKeyStore"; //frozen
private static final String SSL_PASSWORD_TAG = "SslPassword"; //frozen
private static final String SSL_KEY_PASSWORD_TAG = "SslKeyPassword"; //frozen
private static final String SSL_TRUST_PASSWORD_TAG = "SslTrustPassword"; //frozen

// Log specific
private static final String ACCESS_LOG_FORMAT_TAG = "AccessLogFormat"; //frozen
private static final String ACCESS_LOG_ENABLED_TAG = "AccessLogEnabled"; //frozen
private static final String ACCESS_LOG_RETAIN_TAG = "AccessLogRetainDays"; //frozen
private static final String ACCESS_LOG_APPEND_TAG = "AccessLogAppend"; //frozen
private static final String ACCESS_LOG_EXTENDED_TAG = "AccessLogExtended"; //frozen
private static final String ACCESS_LOG_LATENCY_TAG = "AccessLogLatency"; //frozen
private static final String ACCESS_LOG_TZ_TAG = "AccessLogTimeZone"; //frozen

// Read values
private List<WebAppContext> warContexts = new ArrayList<WebAppContext>();
private int maxWaitForSlaves;
private boolean mortBayDebug;
private boolean httpEnabled;
private int httpPort;
private boolean nioEnabled;
private boolean sslEnabled;
private int sslPort;
private String sslKeyStore;
private String sslPassword;
private String sslKeyPassword;
private String sslTrustPassword;
private boolean logEnabled;
private String logFormat;
private int logRetain;
private boolean logAppend;
private boolean logExtended;
private boolean logLatency;
private String logTz;

public JettyServerConfiguration() {
}

@Override
public void configure(final Element xmlConfigElement) {
super.configure(xmlConfigElement);

final List<Element> warElements = getChildren(WAR_TAG);

for (final Element warElement : warElements) {
final String context = warElement.getAttribute("context"); //frozen
final String location = warElement.getAttribute("location"); //frozen

if ((location != null) && !location.isEmpty()) {
// check file is valid
final File f = new File(location);

if (!f.exists()) {
log.warning("War location '" + f.getAbsolutePath() + "' does not exists."); //frozen
}

final WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath(context);
webAppContext.setResourceBase(f.getAbsolutePath()); //added in 9.3
webAppContext.setWar(f.getAbsolutePath());
webAppContext.setExtractWAR(false);

warContexts.add(webAppContext);

log.info("Context Path-->" + context);
log.info("War location-->" + f.getAbsolutePath());
} else {
throw new IllegalStateException("War location must be specified."); //frozen
}
}

maxWaitForSlaves = getChildValueAsInteger(MAX_WAIT_FOR_SLAVE_TAG, 4 * 60 * 1000);
mortBayDebug = getChildValueAsBoolean(MORTBAY_DEBUG_TAG, false);
httpEnabled = getChildValueAsBoolean(HTTP_ENABLED_TAG, true);
nioEnabled = getChildValueAsBoolean(NIO_ENABLED_TAG, false);
httpPort = getChildValueAsInteger(HTTP_PORT_TAG, 8580);

sslEnabled = getChildValueAsBoolean(SSL_ENABLED_TAG, false);
sslPort = getChildValueAsInteger(SSL_PORT_TAG, 8581);
sslKeyPassword = getChildValue(SSL_KEY_PASSWORD_TAG);
sslKeyStore = getChildValue(SSL_KEY_STORE_TAG);
sslPassword = getChildValue(SSL_PASSWORD_TAG);
sslTrustPassword = getChildValue(SSL_TRUST_PASSWORD_TAG);

logEnabled = getChildValueAsBoolean(ACCESS_LOG_ENABLED_TAG, true);
logFormat = getChildValue(ACCESS_LOG_FORMAT_TAG, "logs/access_logs/yyyy_mm_dd.access.log"); //frozen
logRetain = getChildValueAsInteger(ACCESS_LOG_RETAIN_TAG, 90);
logAppend = getChildValueAsBoolean(ACCESS_LOG_APPEND_TAG, true);
logExtended = getChildValueAsBoolean(ACCESS_LOG_EXTENDED_TAG, false);
logLatency = getChildValueAsBoolean(ACCESS_LOG_LATENCY_TAG, false);
logTz = getChildValue(ACCESS_LOG_TZ_TAG, "GMT"); //frozen

log.info("End of Configuration..");
}

public int getHttpPort() {
return httpPort;
}

public boolean getNioEnabled() {
return nioEnabled;
}

public boolean getHttpEnabled() {
return httpEnabled;
}

public List<WebAppContext> getWebAppContexts() {
return warContexts;
}

public int getMaxWaitForSlave() {
return maxWaitForSlaves;
}

public boolean getMortBayDebug() {
return mortBayDebug;
}

public boolean getSslEnabled() {
return sslEnabled;
}

public int getSslPort() {
return sslPort;
}

public String getSslKeyStore() {
return sslKeyStore;
}

public String getSslPassword() {
return sslPassword;
}

public String getSslKeyPassword() {
return sslKeyPassword;
}

public String getSslTrustPassword() {
return sslTrustPassword;
}

public boolean getLogEnabled() {
return logEnabled;
}

public String getLogFormat() {
return logFormat;
}

public int getLogRetain() {
return logRetain;
}

public boolean getLogAppend() {
return logAppend;
}

public boolean getLogExtended() {
return logExtended;
}

public boolean getLogLatency() {
return logLatency;
}

public String getLogTz() {
return logTz;
}

@Override
public String toString() {
return "JettyServerConfiguration#" + getServiceName(); //frozen
}

@Override
public String prettyPrint() {
final String s = super.prettyPrint();

final StringBuilder str = new StringBuilder();
str.append(s);
str.append("------------- WebApps \n"); //frozen
str.append(String.format("%-40s%s\n", "Context", "WarFile")); //frozen

for (final WebAppContext webapp : warContexts) {
str.append(String.format("%-40s%s\n", webapp.getContextPath(), webapp.getWar())); //frozen
}

return str.toString();
}
}

Logs for the execution:

INFO 17:11:46 05/07/2018 [com.osm.services.launcher.ServiceLauncher] ServiceId = 3
SEVERE 17:11:46 05/07/2018 [stderr] 2018-07-05 17:11:46.936:INFO::main: Logging initialized @821ms to org.eclipse.jetty.util.log.StdErrLog
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] Context Path-->/mmweb
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] War location-->C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] Context Path-->/
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] War location-->C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] End of Configuration..
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer] jetty version = 9.4.5.v20170502
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer] Eclipse mortbay debug = 'false'
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer] adding default connector on port '8580'
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] Adding WebAppContext C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb at /mmweb
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] Adding WebAppContext C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war at /
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] initialize....osmRealm
INFO 17:11:47 05/07/2018 [com.osm.services.launcher.ServiceLauncher] Configuration 'JettyServer' :
------------- XML configuration values
AccessLogAppend: true
AccessLogEnabled: true
AccessLogExtended: false
AccessLogFormat: logs/access_logs/yyyy_mm_dd.access.log
AccessLogLatency: false
AccessLogRetainDays: 90
AccessLogTimeZone: GMT
AdditionalClasspath: jar\\jetty\\*
Executable: DreoJettyServer.exe
FileHandlerLogLevel: FINE
HttpEnabled: true
HttpPort: 8580
JvmArgs: -Xms16m -Xmx128m -Djava.rmi.server.hostname=localhost
LogAppend: false
MaxLogFileSizeInMB: 0
MortBayDebug: false
SslEnabled: false
SslPort: 8581
StartupTimeoutInMinutes: 5

------------- Configuration class properties
classpath: classes;jar\*;jar\custom\*;jar\\jetty\\*
configurationFile: custom.xml
debugOptions:
defaultUser: medmgr
enabled: true
executable: DreoJettyServer.exe
fileHandlerLevel: FINE
httpEnabled: true
httpPort: 8580
javaClass: com.osm.services.webservice.JettyServer
jvmArgs: -Xms16m -Xmx128m -Djava.rmi.server.hostname=localhost
logAppend: false
logEnabled: true
logExtended: false
logFormat: logs/access_logs/yyyy_mm_dd.access.log
logLatency: false
logLevels: {=INFO, com.osm.ws.QueryService=FINE, com.osm.webservices.legacy.FileService=FINE, com.osm.webservices.legacy.OSMService=FINE, com.osm.webservices.legacy.servlets=FINE, com.osm.ws.UpdateService=FINE}
logRetain: 90
logTz: GMT
maxLogFileSizeInMB: 0
maxWaitForSlave: 240000
mortBayDebug: false
nioEnabled: false
runLevel: 5.0
serviceName: JettyServer
sslEnabled: false
sslPort: 8581
startupTimeoutInMinutes: 5
webAppContexts: [***@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,UNAVAILABLE}{C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb}, ***@69a3d1d{/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,UNAVAILABLE}{C:\Program<mailto:***@69a3d1d%7b/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,UNAVAILABLE%7d%7bC:\Program> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war}]
------------- WebApps
Context WarFile
/mmweb C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb
/ C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war


INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] start()
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] Registering JettyServer
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.092:INFO:oejs.Server:main: jetty-9.4.5.v20170502
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.217:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=6ms
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:INFO:oejs.session:main: No SessionScavenger set, using defaults
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:INFO:oejs.session:main: Scavenging every 660000ms
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /css/*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /js/*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /style/*
INFO 17:11:47 05/07/2018 [com.sun.xml.ws.server.http] WSSERVLET12: JAX-WS context listener initializing
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signature on the wire for successful dispatch. Methods [getGroups, getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same request body block . Method dispatching may fail, runtime will try to dispatch using SOAPAction. Another option is to enable AddressingFeature to enabled runtime to uniquely identify WSDL operation using wsa:Action header.
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signature on the wire for successful dispatch. Methods [getGroups, getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same request body block . Method dispatching may fail, runtime will try to dispatch using SOAPAction. Another option is to enable AddressingFeature to enabled runtime to uniquely identify WSDL operation using wsa:Action header.
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signature on the wire for successful dispatch. Methods [getGroups, getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same request body block . Method dispatching may fail, runtime will try to dispatch using SOAPAction. Another option is to enable AddressingFeature to enabled runtime to uniquely identify WSDL operation using wsa:Action header.
INFO 17:11:48 05/07/2018 [com.sun.xml.ws.servlet.http] WSSERVLET14: JAX-WS servlet initializing
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.296:INFO:oejsh.ContextHandler:main: Started ***@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,AVAILABLE}{C:\Program<mailto:***@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,AVAILABLE%7d%7bC:\Program> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb}
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.311:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=0ms
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.327:INFO:oejsh.ContextHandler:main: Started ***@69a3d1d{/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,AVAILABLE}{C:\Program<mailto:***@69a3d1d%7b/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,AVAILABLE%7d%7bC:\Program> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war}
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.327:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\logs\access_logs\2018_07_05.access.log
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.433:INFO:oejs.AbstractConnector:main: Started ***@1b1637e1{HTTP/1.1,[http/1.1]}{0.0.0.0:8580}<mailto:***@1b1637e1%7bHTTP/1.1,%5bhttp/1.1%5d%7d%7b0.0.0.0:8580%7d>
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.433:INFO:oejs.Server:main: Started @2313ms
INFO 17:11:58 05/07/2018 [com.osm.services.webservice.JettyServer] registered(JettySlave2) (ID=5)
INFO 17:12:06 05/07/2018 [com.osm.services.webservice.JettyServer] registered(JettySlave1) (ID=6)

All the remaining details was same in Jetty 6.1 except this line:

webAppContexts: [***@5792a0{/mmweb,C:\Program Files (x86)\RTC\Dreo Elements\Direct Manager Server 20.0\webapps\mmweb}, ***@653222{/,C:\Program<mailto:***@653222%7b/,C:\Program> Files (x86)\RTC\Dreo Elements\Direct Manager Server 20.0\webapps\OSMWebServices.war}]

Just ignore the path of mmweb it is different directory.

The problem I am facing is when I hit the url for a jsp page I am getting the error like below which I was not getting in earlier jetty 6.1

Caused by:
javax.servlet.ServletException: org.apache.jasper.JasperException: An exception occurred processing JSP page /include/header.jsp at line 8

5: String style = (String)session.getAttribute("style");
6: if(style==null) {
7: // controls default style
8: style = WebConfig.getInstance(getServletContext()).getOption("DefaultTheme");
9: session.setAttribute("style", style);
10: }
11:


Stacktrace:
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.jasper.JasperException: An exception occurred processing JSP page /include/header.jsp at line 8
The jsp contains the scriptlet, please ignore that I am using the scriptlet here. Just trying to show you the actual problem .

<%@page import="com.osm.jsp.util.WebConfig"%<mailto:%***@page%20import=%22com.osm.jsp.util.WebConfig%22%25>>
<%
request.setAttribute("start.time", (Long)System.currentTimeMillis());

String style = (String)session.getAttribute("style");
if(style==null) {
// controls default style
style = WebConfig.getInstance(getServletContext()).getOption("DefaultTheme");
session.setAttribute("style", style);
}

final String header = "style/" + style + "/header.jsp";
%>
<%@taglib prefix="osm" uri="/WEB-INF/tlds/Manager.tld" %<mailto:%***@taglib%20prefix=%22osm%22%20uri=%22/WEB-INF/tlds/Manager.tld%22%20%25>>
<osm:license writeAccess="false"/>
<jsp:include page="<%=header%>"/>

I don't think it has anything to do with dependency as even displaying the Jetty version is giving the same kind of error.But it gets render when I remove the JettyServer import and version call,i.e only system libraries are getting detected.

These are the jars I have used in classpath:

C:\Users\vkarn\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar
C:\Users\vkarn\.m2\repository\junit\junit\4.12\junit-4.12.jar
C:\Users\vkarn\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-annotations\9.4.5.v20170502\jetty-annotations-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-plus\9.4.5.v20170502\jetty-plus-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-jndi\9.4.5.v20170502\jetty-jndi-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm\5.1\asm-5.1.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-commons\5.1\asm-commons-5.1.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-tree\5.1\asm-tree-5.1.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-webapp\9.4.5.v20170502\jetty-webapp-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-xml\9.4.5.v20170502\jetty-xml-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-servlet\9.4.5.v20170502\jetty-servlet-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-security\9.4.5.v20170502\jetty-security-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-server\9.4.5.v20170502\jetty-server-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-http\9.4.5.v20170502\jetty-http-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-io\9.4.5.v20170502\jetty-io-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\apache-jsp\9.4.5.v20170502\apache-jsp-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-util\9.4.5.v20170502\jetty-util-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\toolchain\jetty-schemas\3.1\jetty-schemas-3.1.jar
C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-jsp\8.5.9.1\apache-jsp-8.5.9.1.jar
C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-el\8.5.9.1\apache-el-8.5.9.1.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jdt\core\compiler\ecj\4.4.2\ecj-4.4.2.jar
C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-standard-spec\1.2.5\taglibs-standard-spec-1.2.5.jar
C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-standard-impl\1.2.5\taglibs-standard-impl-1.2.5.jar
Vibhas Karn
2018-07-06 06:44:50 UTC
Permalink
Hi All,



I am struggling with jetty Migration of 6.1 to latest or anything above
Jetty 9.1 . Currently I am trying with Jetty 9.4 which is latest.

I am able to compile the old code with the new one but there are few issues
with the migration which I am trying to fix. Yes its the tough job but no
option left.

I am currently focussing to render the old jsp pages after migrating it to
Jetty 9.4. Here is the sample code , I have mentioned the problem in the
post below. Help me with you suggestion or anything as I am struggling to
fix this issue since a week now.



JettyServer Sample Code :



public class JettyServer extends AbstractService implements IJettyServer,
IStatus {

public static final String SERVICE_NAME = "JettyServer"; //frozen

private static final Logger log =
Logger.getLogger(JettyServer.class.getName());

private static JettyServer instance = null;

private Server server;



// The map of service id to the jetty slave.

private final Map<Integer, IJettySlave> idToSlaveMap = new
HashMap<Integer, IJettySlave>();



// A linked list of the slaves.

private final List<IJettySlave> availableSlaves = new
LinkedList<IJettySlave>();



// TODO ref count availableAPIs.

private final Set<Class> availableAPIs = new HashSet<Class>();



// The map of service if to the slave status.

private final Map<Integer, IStatus> idToStatusMap = new
HashMap<Integer, IStatus>();

private final int registryPort;

private int maxWaitForSlave = 0;



/**

* Creates a new JettyServer using the default registry port from the
ServiceControllerConfig.

* @throws RemoteException when RMI problems occur.

*/

public JettyServer() throws RemoteException {

this(ServiceControllerConfig.getInstance().getControlPort());

}



/**

* Creates a new JettyServer using the control port passed.

* @param registryPort the registry port.

* @throws RemoteException when RMI problems occur.

*/

public JettyServer(final int registryPort) throws RemoteException {

this.registryPort = registryPort;

instance = this;

}



@Override

public void initialize(final ServiceConfiguration genericConfig, final
Controller controller, final int serviceId,

final ServiceLock lock) throws Exception {

if (genericConfig instanceof JettyServerConfiguration) {

configuration = (JettyServerConfiguration) genericConfig;

} else {

configuration =
XmlConfigurable.createInstance(JettyServerConfiguration.class,

genericConfig.getXmlConfigElement());

}



server = new Server();

log.info("jetty version = " + Server.getVersion()); //frozen



maxWaitForSlave = getConfiguration().getMaxWaitForSlave();



final boolean debug = getConfiguration().getMortBayDebug();

log.info("Eclipse mortbay debug = '" + debug + "'"); //frozen

org.eclipse.jetty.util.log.Log.getLog().setDebugEnabled(debug);



// Configure http

final boolean httpEnabled = getConfiguration().getHttpEnabled();



if (httpEnabled) {

final int mainPort = getConfiguration().getHttpPort();



log.info("adding default connector on port '" + mainPort +
"'"); //frozen


//Re-writing the
code for jetty 9.3


// Setup HTTP Connector



HttpConfiguration httpConf = new HttpConfiguration();

httpConf.setSecurePort(mainPort);

httpConf.setSecureScheme("https");



// Establish the HTTP ServerConnector

ServerConnector httpConnector = new ServerConnector(server, new
HttpConnectionFactory(httpConf));

httpConnector.setPort(mainPort);

server.addConnector(httpConnector);

}



// Configure SSL

final boolean sslEnabled = getConfiguration().getSslEnabled();



if (sslEnabled) {

//Re-writing code for Jetty 9.3

final int mainPort = getConfiguration().getHttpPort(); //8580

final int sslPort = getConfiguration().getSslPort(); //8581

final String sslKeyStore = getConfiguration().getSslKeyStore();

final String sslPassword = getConfiguration().getSslPassword();

final String sslKeyPassword =
getConfiguration().getSslKeyPassword();

final String sslTrustPassword =
getConfiguration().getSslTrustPassword();



//Added for Jetty 9.3

final KeyStore trustKeyStore =
KeyStore.getInstance(getConfiguration().getSslKeyStore());



SslContextFactory theSSLFactory = new SslContextFactory();



theSSLFactory.setKeyStorePath(sslKeyStore);

theSSLFactory.setKeyManagerPassword(sslPassword);

theSSLFactory.setKeyStorePassword(sslKeyPassword);

theSSLFactory.setTrustStore(trustKeyStore);

theSSLFactory.setTrustStorePassword(sslTrustPassword);



// Setup HTTP Connector

HttpConfiguration httpConf = new HttpConfiguration();

httpConf.setSecurePort(mainPort);

httpConf.setSecureScheme("https");



// Setup HTTPS Configuration

HttpConfiguration httpsConf = new HttpConfiguration(httpConf);

httpsConf.addCustomizer(new SecureRequestCustomizer()); // adds
ssl info to request object



// Establish the HTTPS ServerConnector

ServerConnector httpsConnector = new ServerConnector(server,

new SslConnectionFactory(theSSLFactory, "http/1.1"),
new HttpConnectionFactory(httpsConf));

httpsConnector.setPort(sslPort);



log.info("adding ssl connector on port '" + sslPort + "'");
//frozen

server.addConnector(httpsConnector);



//}

}



// Check we had 1 connector else the server is useless

if (server.getConnectors().length == 0) {

throw new FileNotFoundException("No connectors registered.
Please see HttpEnable or SslEnable XML tags."); //frozen

}



// Configure the handlers

final HandlerCollection handlers = new HandlerCollection();



//4. Enabling the Annotation based configuration

org.eclipse.jetty.webapp.Configuration.ClassList classlist =
org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);

classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration",

"org.eclipse.jetty.plus.webapp.EnvConfiguration",
"org.eclipse.jetty.plus.webapp.PlusConfiguration");


classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",

"org.eclipse.jetty.annotations.AnnotationConfiguration");



for (final WebAppContext webAppContext :
getConfiguration().getWebAppContexts()) {

log.info("Adding WebAppContext " + webAppContext.getWar() + "
at " + webAppContext.getContextPath()); //frozen




webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",

".*/[^/]*jstl.*\\.jar$");

handlers.addHandler(webAppContext);

}



final boolean accessLogEnabled = getConfiguration().getLogEnabled();



if (accessLogEnabled) {

final RequestLogHandler requestLogHandler = new
RequestLogHandler();

final File logDir = ServiceUtilities.getLogDirectory();



if (!logDir.exists()) {

logDir.mkdirs();

}



final File logFile = new
File(getConfiguration().getLogFormat());



if (!logFile.getParentFile().exists()) {

logFile.getParentFile().mkdirs();

}



final NCSARequestLog requestLog = new
NCSARequestLog(getConfiguration().getLogFormat());

requestLog.setRetainDays(getConfiguration().getLogRetain());

requestLog.setAppend(getConfiguration().getLogAppend());

requestLog.setExtended(getConfiguration().getLogExtended());

requestLog.setLogTimeZone(getConfiguration().getLogTz());

requestLog.setLogLatency(getConfiguration().getLogLatency());

requestLogHandler.setRequestLog(requestLog);

handlers.addHandler(requestLogHandler);

}



handlers.addHandler(new DefaultHandler());



server.setHandler(handlers);



// server.setUserRealms(new UserRealm[] { new OSMUserRealm() });

// server.addBean(new LoginService[] { new OSMUserRealm() });



// HashLoginService loginService = new HashLoginService();

//loginService.setName("osmRealm");

//server.addBean(loginService);



// log.info("initialize...." + loginService.getName());

JettyServerInfo.install(server);



super.initialize(configuration, controller, serviceId, lock);

}



@Override

public JettyServerConfiguration getConfiguration() {

return (JettyServerConfiguration) super.getConfiguration();

}



@Override

public synchronized void stop() {

final Thread t = new Thread("JettyServer Stop Thread") { //frozen

@Override

public void run() {

try {

server.stop();

} catch (Exception ex) {

log.log(Level.SEVERE, "Failed to stop Jetty
server", ex); //frozen

}

}

};



t.start();



try {

t.join(500);

} catch (final InterruptedException ex) {

}



super.stop();

}



@Override

public synchronized void start() throws Exception {

log.info("start()"); //frozen



registerJetty();



server.start();



// finish startup which registers with the controller

super.start();



server.join(); //For Jetty 9.3 and above



// server.join(); need to uncomment and verify if jetty if we need
server.join in Jetty 9.3 as previous person don't have

log.info("After Jetty 9.3 Services starts..");

}



private void registerJetty() throws RemoteException,
AlreadyBoundException, AlreadyBoundException {

final Registry registry = LocateRegistry.getRegistry("127.0.0.1",
registryPort); //frozen



final Remote remote = UnicastRemoteObject.toStub(this);

log.info("Registering JettyServer"); //frozen

registry.rebind(IJettyServer.JETTYSERVER_NAME, remote);

}



@Override

public void unregister(final IJettySlave slave) throws RemoteException {

log.info("unregister(" + slave.getName() + ") (ID=" +
slave.getServiceID() + ")"); //frozen



synchronized (idToSlaveMap) {

idToSlaveMap.remove(slave.getServiceID());



if (slave instanceof IStatus) {

synchronized (idToStatusMap) {

idToStatusMap.remove(slave.getServiceID());

}

}

}



synchronized (availableSlaves) {

// Shouldnt really be in the list as teh BusyAPIDynamicProxy
shouldnt

// have re-added it on a shutdown.

if (availableSlaves.remove(slave)) {

availableSlaves.notifyAll();

}

}

}



@Override

public void register(final IJettySlave slave) throws RemoteException {

log.info("registered(" + slave.getName() + ") (ID=" +
slave.getServiceID() + ")"); //frozen



synchronized (idToSlaveMap) {

idToSlaveMap.put(slave.getServiceID(), slave);



if (slave instanceof IStatus) {

synchronized (idToStatusMap) {

idToStatusMap.put(slave.getServiceID(), (IStatus)
slave);

}

}

}



synchronized (availableSlaves) {

availableSlaves.add(slave);

availableSlaves.notifyAll();

}



synchronized (availableAPIs) {

availableAPIs.addAll(slave.getAPIs());

}

}



public static JettyServer getInstance() {

return instance;

}



public <I extends Remote> I get(final Class<I> i) throws
RemoteException {

return createApiProxy(i);

}



void push(final IJettySlave slave) {

synchronized (availableSlaves) {

availableSlaves.add(0, slave);

availableSlaves.notifyAll();

}

}



<I extends Remote> IJettySlave pop(final Class<I> i)

throws RemoteException {

if (idToSlaveMap.isEmpty()) {

throw new IllegalStateException("No JettySlaves available,
please check the server log files."); //frozen

}



if (availableAPIs.isEmpty()) {

throw new IllegalStateException("No JettySlave APIs available,
please check the server log files."); //frozen

}



synchronized (availableAPIs) {

// Check if any slave provides this API, as its pointless
waiting

// when we know an API will not be available.

// FYI : This should be removed if we provide auto startup of
slaves.

if (!availableAPIs.contains(i)) {

throw new RemoteException("API " + i.getName() + " is not
available."); //frozen

}

}



final long end = System.currentTimeMillis() + maxWaitForSlave;



while (System.currentTimeMillis() < end) {

synchronized (availableSlaves) {

// Get a service from any idle slave.

final Iterator<IJettySlave> it = availableSlaves.iterator();



while (it.hasNext()) {

final IJettySlave slave = it.next();



try {

final I slaveApi = slave.get(i);



if (slaveApi != null) {

it.remove(); // remove this slave from list



return slave;

}

} catch (final RemoteException re) {

// this host doesnt work so remove it.

it.remove();

}

}



// now wait for a slave to become inactive

final long sleep = end - System.currentTimeMillis();



try {

if (sleep > 0) {

availableSlaves.wait(sleep);

}

} catch (final InterruptedException ex) {

}

}

}



throw new IllegalStateException("All APIs '" + i.getName() + "' are
busy or unavailable."); //frozen

}



/**

* Creates a proxy for the specific interface.

* @param <I> a remote interface class.

* @param i the remote interface class

* @return the proxy for this interface.

* @throws RemoteException when RMI fails.

* @see BusyAPIDynamicProxy

*/

@SuppressWarnings("unchecked")

private <I extends Remote> I createApiProxy(final Class<I> i)

throws RemoteException {

// Insert the busy dynamic proxy so we know which is busy

final I proxy = (I)
java.lang.reflect.Proxy.newProxyInstance(i.getClassLoader(), new Class[] {
i },

new BusyAPIDynamicProxy<I>(this, i));



return proxy;

}



public final Map<Integer, IStatus> getSlaveStatus()

throws RemoteException {

return new TreeMap<Integer, IStatus>(idToStatusMap);

}



public final IStatus getStatus() {

return this;

}



@Override

public long getUpTime() throws RemoteException {

final java.lang.management.RuntimeMXBean mx =
java.lang.management.ManagementFactory.getRuntimeMXBean();



return mx.getUptime() / 1000;

}



@Override

public long getTotalMemory() throws RemoteException {

return Runtime.getRuntime().totalMemory();

}



@Override

public long getFreeMemory() throws RemoteException {

return Runtime.getRuntime().freeMemory();

}



@Override

public long getMaxMemory() throws RemoteException {

return Runtime.getRuntime().maxMemory();

}



public static void main(final String[] args) throws Exception {

// jetty depends on the registry all the time.


LocateRegistry.createRegistry(ServiceControllerConfig.getInstance().getControlPort());



System.setProperty("service.id", "-1"); //frozen



runStandalone(SERVICE_NAME);



// jetty server depends on a slave working.

runStandalone("JettySlave1"); //frozen

}

}



Jetty Configuration class:



/**

* RCS: $Id:
//oswm/rel20.10_Patches/WorkManager/src/com/osm/services/webservice/JettyServerConfiguration.java#1
$

* Last Modified: $Author: adminp4 $, $DateTime: 2018/03/28 14:59:10 $

*/

package com.osm.services.webservice;



import java.io.File;



import java.util.ArrayList;

import java.util.List;

import java.util.logging.Logger;



import org.eclipse.jetty.webapp.WebAppContext;



import org.w3c.dom.Element;



import com.osm.services.configuration.ManagerServiceConfiguration;





public class JettyServerConfiguration extends ManagerServiceConfiguration {

private static final Logger log =
Logger.getLogger(JettyServerConfiguration.class.getName());

private static final String WAR_TAG = "War"; //frozen

private static final String MAX_WAIT_FOR_SLAVE_TAG = "MaxWaitForSlave";
//frozen

private static final String MORTBAY_DEBUG_TAG = "MortBayDebug"; //frozen

private static final String HTTP_ENABLED_TAG = "HttpEnabled"; //frozen

private static final String HTTP_PORT_TAG = "HttpPort"; //frozen

private static final String NIO_ENABLED_TAG = "NioEnabled"; //frozen



// SSL specific

private static final String SSL_ENABLED_TAG = "SslEnabled"; //frozen

private static final String SSL_PORT_TAG = "SslPort"; //frozen

private static final String SSL_KEY_STORE_TAG = "SslKeyStore"; //frozen

private static final String SSL_PASSWORD_TAG = "SslPassword"; //frozen

private static final String SSL_KEY_PASSWORD_TAG = "SslKeyPassword";
//frozen

private static final String SSL_TRUST_PASSWORD_TAG =
"SslTrustPassword"; //frozen



// Log specific

private static final String ACCESS_LOG_FORMAT_TAG = "AccessLogFormat";
//frozen

private static final String ACCESS_LOG_ENABLED_TAG =
"AccessLogEnabled"; //frozen

private static final String ACCESS_LOG_RETAIN_TAG =
"AccessLogRetainDays"; //frozen

private static final String ACCESS_LOG_APPEND_TAG = "AccessLogAppend";
//frozen

private static final String ACCESS_LOG_EXTENDED_TAG =
"AccessLogExtended"; //frozen

private static final String ACCESS_LOG_LATENCY_TAG =
"AccessLogLatency"; //frozen

private static final String ACCESS_LOG_TZ_TAG = "AccessLogTimeZone";
//frozen



// Read values

private List<WebAppContext> warContexts = new
ArrayList<WebAppContext>();

private int maxWaitForSlaves;

private boolean mortBayDebug;

private boolean httpEnabled;

private int httpPort;

private boolean nioEnabled;

private boolean sslEnabled;

private int sslPort;

private String sslKeyStore;

private String sslPassword;

private String sslKeyPassword;

private String sslTrustPassword;

private boolean logEnabled;

private String logFormat;

private int logRetain;

private boolean logAppend;

private boolean logExtended;

private boolean logLatency;

private String logTz;



public JettyServerConfiguration() {

}



@Override

public void configure(final Element xmlConfigElement) {

super.configure(xmlConfigElement);



final List<Element> warElements = getChildren(WAR_TAG);



for (final Element warElement : warElements) {

final String context = warElement.getAttribute("context");
//frozen

final String location = warElement.getAttribute("location");
//frozen



if ((location != null) && !location.isEmpty()) {

// check file is valid

final File f = new File(location);



if (!f.exists()) {

log.warning("War location '" + f.getAbsolutePath() + "'
does not exists."); //frozen

}



final WebAppContext webAppContext = new WebAppContext();

webAppContext.setContextPath(context);

webAppContext.setResourceBase(f.getAbsolutePath()); //added
in 9.3

webAppContext.setWar(f.getAbsolutePath());

webAppContext.setExtractWAR(false);



warContexts.add(webAppContext);



log.info("Context Path-->" + context);

log.info("War location-->" + f.getAbsolutePath());

} else {

throw new IllegalStateException("War location must be
specified."); //frozen

}

}



maxWaitForSlaves = getChildValueAsInteger(MAX_WAIT_FOR_SLAVE_TAG, 4
* 60 * 1000);

mortBayDebug = getChildValueAsBoolean(MORTBAY_DEBUG_TAG, false);

httpEnabled = getChildValueAsBoolean(HTTP_ENABLED_TAG, true);

nioEnabled = getChildValueAsBoolean(NIO_ENABLED_TAG, false);

httpPort = getChildValueAsInteger(HTTP_PORT_TAG, 8580);



sslEnabled = getChildValueAsBoolean(SSL_ENABLED_TAG, false);

sslPort = getChildValueAsInteger(SSL_PORT_TAG, 8581);

sslKeyPassword = getChildValue(SSL_KEY_PASSWORD_TAG);

sslKeyStore = getChildValue(SSL_KEY_STORE_TAG);

sslPassword = getChildValue(SSL_PASSWORD_TAG);

sslTrustPassword = getChildValue(SSL_TRUST_PASSWORD_TAG);



logEnabled = getChildValueAsBoolean(ACCESS_LOG_ENABLED_TAG, true);

logFormat = getChildValue(ACCESS_LOG_FORMAT_TAG,
"logs/access_logs/yyyy_mm_dd.access.log"); //frozen

logRetain = getChildValueAsInteger(ACCESS_LOG_RETAIN_TAG, 90);

logAppend = getChildValueAsBoolean(ACCESS_LOG_APPEND_TAG, true);

logExtended = getChildValueAsBoolean(ACCESS_LOG_EXTENDED_TAG,
false);

logLatency = getChildValueAsBoolean(ACCESS_LOG_LATENCY_TAG, false);

logTz = getChildValue(ACCESS_LOG_TZ_TAG, "GMT"); //frozen



log.info("End of Configuration..");

}



public int getHttpPort() {

return httpPort;

}



public boolean getNioEnabled() {

return nioEnabled;

}



public boolean getHttpEnabled() {

return httpEnabled;

}



public List<WebAppContext> getWebAppContexts() {

return warContexts;

}



public int getMaxWaitForSlave() {

return maxWaitForSlaves;

}



public boolean getMortBayDebug() {

return mortBayDebug;

}



public boolean getSslEnabled() {

return sslEnabled;

}



public int getSslPort() {

return sslPort;

}



public String getSslKeyStore() {

return sslKeyStore;

}



public String getSslPassword() {

return sslPassword;

}



public String getSslKeyPassword() {

return sslKeyPassword;

}



public String getSslTrustPassword() {

return sslTrustPassword;

}



public boolean getLogEnabled() {

return logEnabled;

}



public String getLogFormat() {

return logFormat;

}



public int getLogRetain() {

return logRetain;

}



public boolean getLogAppend() {

return logAppend;

}



public boolean getLogExtended() {

return logExtended;

}



public boolean getLogLatency() {

return logLatency;

}



public String getLogTz() {

return logTz;

}



@Override

public String toString() {

return "JettyServerConfiguration#" + getServiceName(); //frozen

}



@Override

public String prettyPrint() {

final String s = super.prettyPrint();



final StringBuilder str = new StringBuilder();

str.append(s);

str.append("------------- WebApps \n"); //frozen

str.append(String.format("%-40s%s\n", "Context", "WarFile"));
//frozen



for (final WebAppContext webapp : warContexts) {

str.append(String.format("%-40s%s\n", webapp.getContextPath(),
webapp.getWar())); //frozen

}



return str.toString();

}

}



Logs for the execution:



INFO 17:11:46 05/07/2018
[com.osm.services.launcher.ServiceLauncher] ServiceId = 3

SEVERE 17:11:46 05/07/2018 [stderr] 2018-07-05
17:11:46.936:INFO::main: Logging initialized @821ms to
org.eclipse.jetty.util.log.StdErrLog

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServerConfiguration] Context
Path-->/mmweb

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServerConfiguration] War
location-->C:\Program Files\RTC\Dreo Elements\Direct Manager Server
20.1\webapps\mmweb

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServerConfiguration] Context
Path-->/

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServerConfiguration] War
location-->C:\Program Files\RTC\Dreo Elements\Direct Manager Server
20.1\webapps\OSMWebServices.war

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServerConfiguration] End of
Configuration..

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServer] jetty version =
9.4.5.v20170502

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServer] Eclipse mortbay debug =
'false'

INFO 17:11:46 05/07/2018
[com.osm.services.webservice.JettyServer] adding default connector
on port '8580'

INFO 17:11:47 05/07/2018
[com.osm.services.webservice.JettyServer] Adding WebAppContext
C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb
at /mmweb

INFO 17:11:47 05/07/2018
[com.osm.services.webservice.JettyServer] Adding WebAppContext
C:\Program Files\RTC\Dreo Elements\Direct Manager Server
20.1\webapps\OSMWebServices.war at /

INFO 17:11:47 05/07/2018
[com.osm.services.webservice.JettyServer] initialize....osmRealm

INFO 17:11:47 05/07/2018
[com.osm.services.launcher.ServiceLauncher] Configuration 'JettyServer'
:

------------- XML configuration values

AccessLogAppend: true

AccessLogEnabled: true

AccessLogExtended: false

AccessLogFormat:
logs/access_logs/yyyy_mm_dd.access.log

AccessLogLatency: false

AccessLogRetainDays: 90

AccessLogTimeZone: GMT

AdditionalClasspath: jar\\jetty\\*

Executable: DreoJettyServer.exe

FileHandlerLogLevel: FINE

HttpEnabled: true

HttpPort: 8580

JvmArgs: -Xms16m -Xmx128m
-Djava.rmi.server.hostname=localhost

LogAppend: false

MaxLogFileSizeInMB: 0

MortBayDebug: false

SslEnabled: false

SslPort: 8581

StartupTimeoutInMinutes: 5



------------- Configuration class properties

classpath:
classes;jar\*;jar\custom\*;jar\\jetty\\*

configurationFile: custom.xml

debugOptions:

defaultUser: medmgr

enabled: true

executable: DreoJettyServer.exe

fileHandlerLevel: FINE

httpEnabled: true

httpPort: 8580

javaClass:
com.osm.services.webservice.JettyServer

jvmArgs: -Xms16m -Xmx128m
-Djava.rmi.server.hostname=localhost

logAppend: false

logEnabled: true

logExtended: false

logFormat:
logs/access_logs/yyyy_mm_dd.access.log

logLatency: false

logLevels: {=INFO,
com.osm.ws.QueryService=FINE, com.osm.webservices.legacy.FileService=FINE,
com.osm.webservices.legacy.OSMService=FINE,
com.osm.webservices.legacy.servlets=FINE, com.osm.ws.UpdateService=FINE}

logRetain: 90

logTz: GMT

maxLogFileSizeInMB: 0

maxWaitForSlave: 240000

mortBayDebug: false

nioEnabled: false

runLevel: 5.0

serviceName: JettyServer

sslEnabled: false

sslPort: 8581

startupTimeoutInMinutes: 5

webAppContexts:
[***@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,UNAVAILABLE}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb},
***@69a3d1d{/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,UNAVAILABLE}{C:\Program
<***@69a3d1d%7b/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,UNAVAILABLE%7d%7bC:\Program>
Files\RTC\Dreo Elements\Direct Manager Server
20.1\webapps\OSMWebServices.war}]

------------- WebApps

Context WarFile

/mmweb C:\Program Files\RTC\Dreo
Elements\Direct Manager Server 20.1\webapps\mmweb

/ C:\Program Files\RTC\Dreo
Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war





INFO 17:11:47 05/07/2018
[com.osm.services.webservice.JettyServer] start()

INFO 17:11:47 05/07/2018
[com.osm.services.webservice.JettyServer] Registering JettyServer

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.092:INFO:oejs.Server:main: jetty-9.4.5.v20170502

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.217:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed
time=6ms

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:INFO:oejs.session:main: DefaultSessionIdManager
workerName=node0

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:INFO:oejs.session:main: No SessionScavenger set, using defaults

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:INFO:oejs.session:main: Scavenging every 660000ms

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:WARN:oejs.SecurityHandler:main:
***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program
<***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program>
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /css/*

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:WARN:oejs.SecurityHandler:main:
***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program
<***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program>
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /*

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:WARN:oejs.SecurityHandler:main:
***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program
<***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program>
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /js/*

SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:WARN:oejs.SecurityHandler:main:
***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program
<***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:\Program>
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /style/*

INFO 17:11:47 05/07/2018 [com.sun.xml.ws.server.http]
WSSERVLET12: JAX-WS context listener initializing

WARNING 17:11:47 05/07/2018
[com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body
parts! In a port, as per BP 1.1 R2710 operations must have unique operation
signature on the wire for successful dispatch. Methods [getGroups,
getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same
request body block . Method dispatching may fail, runtime will try to
dispatch using SOAPAction. Another option is to enable AddressingFeature to
enabled runtime to uniquely identify WSDL operation using wsa:Action header.

WARNING 17:11:47 05/07/2018
[com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body
parts! In a port, as per BP 1.1 R2710 operations must have unique operation
signature on the wire for successful dispatch. Methods [getGroups,
getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same
request body block . Method dispatching may fail, runtime will try to
dispatch using SOAPAction. Another option is to enable AddressingFeature to
enabled runtime to uniquely identify WSDL operation using wsa:Action header.

WARNING 17:11:47 05/07/2018
[com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body
parts! In a port, as per BP 1.1 R2710 operations must have unique operation
signature on the wire for successful dispatch. Methods [getGroups,
getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same
request body block . Method dispatching may fail, runtime will try to
dispatch using SOAPAction. Another option is to enable AddressingFeature to
enabled runtime to uniquely identify WSDL operation using wsa:Action header.

INFO 17:11:48 05/07/2018 [com.sun.xml.ws.servlet.http]
WSSERVLET14: JAX-WS servlet initializing

SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.296:INFO:oejsh.ContextHandler:main: Started
***@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,AVAILABLE}{C:\Program
<***@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,AVAILABLE%7d%7bC:\Program>
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb}

SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.311:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed
time=0ms

SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.327:INFO:oejsh.ContextHandler:main: Started
***@69a3d1d{/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,AVAILABLE}{C:\Program
<***@69a3d1d%7b/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,AVAILABLE%7d%7bC:\Program>
Files\RTC\Dreo Elements\Direct Manager Server
20.1\webapps\OSMWebServices.war}

SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.327:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\Program
Files\RTC\Dreo Elements\Direct Manager Server
20.1\logs\access_logs\2018_07_05.access.log

SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.433:INFO:oejs.AbstractConnector:main: Started
***@1b1637e1{HTTP/1.1,[http/1.1]}{0.0.0.0:8580}

SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.433:INFO:oejs.Server:main: Started @2313ms

INFO 17:11:58 05/07/2018
[com.osm.services.webservice.JettyServer] registered(JettySlave2)
(ID=5)

INFO 17:12:06 05/07/2018
[com.osm.services.webservice.JettyServer] registered(JettySlave1)
(ID=6)



All the remaining details was same in Jetty 6.1 except this line:



webAppContexts:
[***@5792a0{/mmweb,C:\Program Files
(x86)\RTC\Dreo Elements\Direct Manager Server 20.0\webapps\mmweb},
***@653222{/,C:\Program Files
(x86)\RTC\Dreo Elements\Direct Manager Server
20.0\webapps\OSMWebServices.war}]



Just ignore the path of mmweb it is different directory.



The problem I am facing is when I hit the url for a jsp page I am getting
the error like below which I was not getting in earlier jetty 6.1



Caused by:

javax.servlet.ServletException: org.apache.jasper.JasperException: An
exception occurred processing JSP page /include/header.jsp at line 8



5: String style = (String)session.getAttribute("style");

6: if(style==null) {

7: // controls default style

8: style =
WebConfig.getInstance(getServletContext()).getOption("DefaultTheme");

9: session.setAttribute("style", style);

10: }

11:





Stacktrace:

at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)

at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.Server.handle(Server.java:564)

at
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)

at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)

at
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)

at
org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)

at
org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)

at
org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)

at
org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)

at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)

at
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)

at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)

at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)

at java.lang.Thread.run(Thread.java:748)

Caused by: org.apache.jasper.JasperException: An exception occurred
processing JSP page /include/header.jsp at line 8

The jsp contains the scriptlet, please ignore that I am using the scriptlet
here. Just trying to show you the actual problem .



<%@page import="com.osm.jsp.util.WebConfig"%
<%***@page%20import=%22com.osm.jsp.util.WebConfig%22%25>>

<%

request.setAttribute("start.time", (Long)System.currentTimeMillis());



String style = (String)session.getAttribute("style");

if(style==null) {

// controls default style

style =
WebConfig.getInstance(getServletContext()).getOption("DefaultTheme");

session.setAttribute("style", style);

}



final String header = "style/" + style + "/header.jsp";

%>

<%@taglib prefix="osm" uri="/WEB-INF/tlds/Manager.tld" %
<%***@taglib%20prefix=%22osm%22%20uri=%22/WEB-INF/tlds/Manager.tld%22%20%25>>

<osm:license writeAccess="false"/>

<jsp:include page="<%=header%>"/>



I don't think it has anything to do with dependency as even displaying the
Jetty version is giving the same kind of error.But it gets render when I
remove the JettyServer import and version call,i.e only system libraries
are getting detected.



These are the jars I have used in classpath:



C:\Users\vkarn\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar

C:\Users\vkarn\.m2\repository\junit\junit\4.12\junit-4.12.jar

C:\Users\vkarn\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-annotations\9.4.5.v20170502\jetty-annotations-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-plus\9.4.5.v20170502\jetty-plus-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-jndi\9.4.5.v20170502\jetty-jndi-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar

C:\Users\vkarn\.m2\repository\org\ow2\asm\asm\5.1\asm-5.1.jar

C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-commons\5.1\asm-commons-5.1.jar

C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-tree\5.1\asm-tree-5.1.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-webapp\9.4.5.v20170502\jetty-webapp-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-xml\9.4.5.v20170502\jetty-xml-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-servlet\9.4.5.v20170502\jetty-servlet-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-security\9.4.5.v20170502\jetty-security-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-server\9.4.5.v20170502\jetty-server-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-http\9.4.5.v20170502\jetty-http-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-io\9.4.5.v20170502\jetty-io-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\apache-jsp\9.4.5.v20170502\apache-jsp-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-util\9.4.5.v20170502\jetty-util-9.4.5.v20170502.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jetty\toolchain\jetty-schemas\3.1\jetty-schemas-3.1.jar

C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-jsp\8.5.9.1\apache-jsp-8.5.9.1.jar

C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-el\8.5.9.1\apache-el-8.5.9.1.jar

C:\Users\vkarn\.m2\repository\org\eclipse\jdt\core\compiler\ecj\4.4.2\ecj-4.4.2.jar

C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-standard-spec\1.2.5\taglibs-standard-spec-1.2.5.jar

C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-standard-impl\1.2.5\taglibs-standard-impl-1.2.5.jar
Greg Wilkins
2018-07-06 07:53:52 UTC
Permalink
Hi,

I'm sorry but you've not well described your problem and giving us a lot of
code does not help at all.


I suggest that you start with one of the examples from 9.4 that provides a
sample JSP and then just change that to add in your JSPs and anything else
you need.

regards
Post by Karn, Vibhas
Hi All,
I am struggling with jetty Migration of 6.1 to latest or anything above
Jetty 9.1 . Currently I am trying with Jetty 9.4 which is latest.
I am able to compile the old code with the new one but there are few
issues with the migration which I am trying to fix. Yes its the tough job
but no option left.
I am currently focussing to render the old jsp pages after migrating it to
Jetty 9.4. Here is the sample code , I have mentioned the problem in the
post below. Help me with you suggestion or anything as I am struggling to
fix this issue since a week now.
public class JettyServer extends AbstractService implements IJettyServer,
IStatus {
public static final String SERVICE_NAME = "JettyServer"; //frozen
private static final Logger log = Logger.getLogger(JettyServer.
class.getName());
private static JettyServer instance = null;
private Server server;
// The map of service id to the jetty slave.
private final Map<Integer, IJettySlave> idToSlaveMap = new
HashMap<Integer, IJettySlave>();
// A linked list of the slaves.
private final List<IJettySlave> availableSlaves = new
LinkedList<IJettySlave>();
// TODO ref count availableAPIs.
private final Set<Class> availableAPIs = new HashSet<Class>();
// The map of service if to the slave status.
private final Map<Integer, IStatus> idToStatusMap = new
HashMap<Integer, IStatus>();
private final int registryPort;
private int maxWaitForSlave = 0;
/**
* Creates a new JettyServer using the default registry port from the
ServiceControllerConfig.
*/
public JettyServer() throws RemoteException {
this(ServiceControllerConfig.getInstance().getControlPort());
}
/**
* Creates a new JettyServer using the control port passed.
*/
public JettyServer(final int registryPort) throws RemoteException {
this.registryPort = registryPort;
instance = this;
}
@Override
public void initialize(final ServiceConfiguration genericConfig, final
Controller controller, final int serviceId,
final ServiceLock lock) throws Exception {
if (genericConfig instanceof JettyServerConfiguration) {
configuration = (JettyServerConfiguration) genericConfig;
} else {
configuration = XmlConfigurable.createInstance(
JettyServerConfiguration.class,
genericConfig.getXmlConfigElement());
}
server = new Server();
log.info("jetty version = " + Server.getVersion()); //frozen
maxWaitForSlave = getConfiguration().getMaxWaitForSlave();
final boolean debug = getConfiguration().getMortBayDebug();
log.info("Eclipse mortbay debug = '" + debug + "'"); //frozen
org.eclipse.jetty.util.log.Log.getLog().setDebugEnabled(debug);
// Configure http
final boolean httpEnabled = getConfiguration().getHttpEnabled();
if (httpEnabled) {
final int mainPort = getConfiguration().getHttpPort();
log.info("adding default connector on port '" + mainPort +
"'"); //frozen
//Re-writing the code for jetty 9.3
// Setup HTTP Connector
HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");
// Establish the HTTP ServerConnector
ServerConnector httpConnector = new ServerConnector(server,
new HttpConnectionFactory(httpConf));
httpConnector.setPort(mainPort);
server.addConnector(httpConnector);
}
// Configure SSL
final boolean sslEnabled = getConfiguration().getSslEnabled();
if (sslEnabled) {
//Re-writing code for Jetty 9.3
final int mainPort = getConfiguration().getHttpPort(); //8580
final int sslPort = getConfiguration().getSslPort(); //8581
final String sslKeyStore = getConfiguration().
getSslKeyStore();
final String sslPassword = getConfiguration().
getSslPassword();
final String sslKeyPassword = getConfiguration().
getSslKeyPassword();
final String sslTrustPassword = getConfiguration().
getSslTrustPassword();
//Added for Jetty 9.3
final KeyStore trustKeyStore = KeyStore.getInstance(
getConfiguration().getSslKeyStore());
SslContextFactory theSSLFactory = new SslContextFactory();
theSSLFactory.setKeyStorePath(sslKeyStore);
theSSLFactory.setKeyManagerPassword(sslPassword);
theSSLFactory.setKeyStorePassword(sslKeyPassword);
theSSLFactory.setTrustStore(trustKeyStore);
theSSLFactory.setTrustStorePassword(sslTrustPassword);
// Setup HTTP Connector
HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");
// Setup HTTPS Configuration
HttpConfiguration httpsConf = new HttpConfiguration(httpConf);
httpsConf.addCustomizer(new SecureRequestCustomizer()); //
adds ssl info to request object
// Establish the HTTPS ServerConnector
ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(theSSLFactory, "http/1.1"),
new HttpConnectionFactory(httpsConf));
httpsConnector.setPort(sslPort);
log.info("adding ssl connector on port '" + sslPort + "'");
//frozen
server.addConnector(httpsConnector);
//}
}
// Check we had 1 connector else the server is useless
if (server.getConnectors().length == 0) {
throw new FileNotFoundException("No connectors registered.
Please see HttpEnable or SslEnable XML tags."); //frozen
}
// Configure the handlers
final HandlerCollection handlers = new HandlerCollection();
//4. Enabling the Annotation based configuration
org.eclipse.jetty.webapp.Configuration.ClassList classlist =
org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
classlist.addAfter("org.eclipse.jetty.webapp.
FragmentConfiguration",
"org.eclipse.jetty.plus.webapp.EnvConfiguration",
"org.eclipse.jetty.plus.webapp.PlusConfiguration");
classlist.addBefore("org.eclipse.jetty.webapp.
JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");
for (final WebAppContext webAppContext : getConfiguration().getWebAppContexts())
{
log.info("Adding WebAppContext " + webAppContext.getWar() + "
at " + webAppContext.getContextPath()); //frozen
webAppContext.setAttribute("org.eclipse.jetty.server.webapp.
ContainerIncludeJarPattern",
".*/[^/]*jstl.*\\.jar$");
handlers.addHandler(webAppContext);
}
final boolean accessLogEnabled = getConfiguration().
getLogEnabled();
if (accessLogEnabled) {
final RequestLogHandler requestLogHandler = new
RequestLogHandler();
final File logDir = ServiceUtilities.getLogDirectory();
if (!logDir.exists()) {
logDir.mkdirs();
}
final File logFile = new File(getConfiguration().
getLogFormat());
if (!logFile.getParentFile().exists()) {
logFile.getParentFile().mkdirs();
}
final NCSARequestLog requestLog = new NCSARequestLog(
getConfiguration().getLogFormat());
requestLog.setRetainDays(getConfiguration().getLogRetain());
requestLog.setAppend(getConfiguration().getLogAppend());
requestLog.setExtended(getConfiguration().getLogExtended());
requestLog.setLogTimeZone(getConfiguration().getLogTz());
requestLog.setLogLatency(getConfiguration().getLogLatency());
requestLogHandler.setRequestLog(requestLog);
handlers.addHandler(requestLogHandler);
}
handlers.addHandler(new DefaultHandler());
server.setHandler(handlers);
// server.setUserRealms(new UserRealm[] { new OSMUserRealm() });
// server.addBean(new LoginService[] { new OSMUserRealm() });
// HashLoginService loginService = new HashLoginService();
//loginService.setName("osmRealm");
//server.addBean(loginService);
// log.info("initialize...." + loginService.getName());
JettyServerInfo.install(server);
super.initialize(configuration, controller, serviceId, lock);
}
@Override
public JettyServerConfiguration getConfiguration() {
return (JettyServerConfiguration) super.getConfiguration();
}
@Override
public synchronized void stop() {
final Thread t = new Thread("JettyServer Stop Thread") { //frozen
@Override
public void run() {
try {
server.stop();
} catch (Exception ex) {
log.log(Level.SEVERE, "Failed to stop Jetty
server", ex); //frozen
}
}
};
t.start();
try {
t.join(500);
} catch (final InterruptedException ex) {
}
super.stop();
}
@Override
public synchronized void start() throws Exception {
log.info("start()"); //frozen
registerJetty();
server.start();
// finish startup which registers with the controller
super.start();
server.join(); //For Jetty 9.3 and above
// server.join(); need to uncomment and verify if jetty if we need
server.join in Jetty 9.3 as previous person don't have
log.info("After Jetty 9.3 Services starts..");
}
private void registerJetty() throws RemoteException,
AlreadyBoundException, AlreadyBoundException {
final Registry registry = LocateRegistry.getRegistry("127.0.0.1",
registryPort); //frozen
final Remote remote = UnicastRemoteObject.toStub(this);
log.info("Registering JettyServer"); //frozen
registry.rebind(IJettyServer.JETTYSERVER_NAME, remote);
}
@Override
public void unregister(final IJettySlave slave) throws RemoteException {
log.info("unregister(" + slave.getName() + ") (ID=" +
slave.getServiceID() + ")"); //frozen
synchronized (idToSlaveMap) {
idToSlaveMap.remove(slave.getServiceID());
if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.remove(slave.getServiceID());
}
}
}
synchronized (availableSlaves) {
// Shouldnt really be in the list as teh BusyAPIDynamicProxy
shouldnt
// have re-added it on a shutdown.
if (availableSlaves.remove(slave)) {
availableSlaves.notifyAll();
}
}
}
@Override
public void register(final IJettySlave slave) throws RemoteException {
log.info("registered(" + slave.getName() + ") (ID=" +
slave.getServiceID() + ")"); //frozen
synchronized (idToSlaveMap) {
idToSlaveMap.put(slave.getServiceID(), slave);
if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.put(slave.getServiceID(), (IStatus)
slave);
}
}
}
synchronized (availableSlaves) {
availableSlaves.add(slave);
availableSlaves.notifyAll();
}
synchronized (availableAPIs) {
availableAPIs.addAll(slave.getAPIs());
}
}
public static JettyServer getInstance() {
return instance;
}
public <I extends Remote> I get(final Class<I> i) throws
RemoteException {
return createApiProxy(i);
}
void push(final IJettySlave slave) {
synchronized (availableSlaves) {
availableSlaves.add(0, slave);
availableSlaves.notifyAll();
}
}
<I extends Remote> IJettySlave pop(final Class<I> i)
throws RemoteException {
if (idToSlaveMap.isEmpty()) {
throw new IllegalStateException("No JettySlaves available,
please check the server log files."); //frozen
}
if (availableAPIs.isEmpty()) {
throw new IllegalStateException("No JettySlave APIs available,
please check the server log files."); //frozen
}
synchronized (availableAPIs) {
// Check if any slave provides this API, as its pointless
waiting
// when we know an API will not be available.
// FYI : This should be removed if we provide auto startup of
slaves.
if (!availableAPIs.contains(i)) {
throw new RemoteException("API " + i.getName() + " is not
available."); //frozen
}
}
final long end = System.currentTimeMillis() + maxWaitForSlave;
while (System.currentTimeMillis() < end) {
synchronized (availableSlaves) {
// Get a service from any idle slave.
final Iterator<IJettySlave> it =
availableSlaves.iterator();
while (it.hasNext()) {
final IJettySlave slave = it.next();
try {
final I slaveApi = slave.get(i);
if (slaveApi != null) {
it.remove(); // remove this slave from list
return slave;
}
} catch (final RemoteException re) {
// this host doesnt work so remove it.
it.remove();
}
}
// now wait for a slave to become inactive
final long sleep = end - System.currentTimeMillis();
try {
if (sleep > 0) {
availableSlaves.wait(sleep);
}
} catch (final InterruptedException ex) {
}
}
}
throw new IllegalStateException("All APIs '" + i.getName() + "'
are busy or unavailable."); //frozen
}
/**
* Creates a proxy for the specific interface.
*/
@SuppressWarnings("unchecked")
private <I extends Remote> I createApiProxy(final Class<I> i)
throws RemoteException {
// Insert the busy dynamic proxy so we know which is busy
final I proxy = (I) java.lang.reflect.Proxy.newProxyInstance(i.getClassLoader(),
new Class[] { i },
new BusyAPIDynamicProxy<I>(this, i));
return proxy;
}
public final Map<Integer, IStatus> getSlaveStatus()
throws RemoteException {
return new TreeMap<Integer, IStatus>(idToStatusMap);
}
public final IStatus getStatus() {
return this;
}
@Override
public long getUpTime() throws RemoteException {
final java.lang.management.RuntimeMXBean mx =
java.lang.management.ManagementFactory.getRuntimeMXBean();
return mx.getUptime() / 1000;
}
@Override
public long getTotalMemory() throws RemoteException {
return Runtime.getRuntime().totalMemory();
}
@Override
public long getFreeMemory() throws RemoteException {
return Runtime.getRuntime().freeMemory();
}
@Override
public long getMaxMemory() throws RemoteException {
return Runtime.getRuntime().maxMemory();
}
public static void main(final String[] args) throws Exception {
// jetty depends on the registry all the time.
LocateRegistry.createRegistry(ServiceControllerConfig.
getInstance().getControlPort());
System.setProperty("service.id", "-1"); //frozen
runStandalone(SERVICE_NAME);
// jetty server depends on a slave working.
runStandalone("JettySlave1"); //frozen
}
}
/**
* RCS: $Id: //oswm/rel20.10_Patches/WorkManager/src/com/osm/
services/webservice/JettyServerConfiguration.java#1 $
* Last Modified: $Author: adminp4 $, $DateTime: 2018/03/28 14:59:10 $
*/
package com.osm.services.webservice;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.eclipse.jetty.webapp.WebAppContext;
import org.w3c.dom.Element;
import com.osm.services.configuration.ManagerServiceConfiguration;
public class JettyServerConfiguration extends ManagerServiceConfiguration {
private static final Logger log = Logger.getLogger(
JettyServerConfiguration.class.getName());
private static final String WAR_TAG = "War"; //frozen
private static final String MAX_WAIT_FOR_SLAVE_TAG =
"MaxWaitForSlave"; //frozen
private static final String MORTBAY_DEBUG_TAG = "MortBayDebug"; //frozen
private static final String HTTP_ENABLED_TAG = "HttpEnabled"; //frozen
private static final String HTTP_PORT_TAG = "HttpPort"; //frozen
private static final String NIO_ENABLED_TAG = "NioEnabled"; //frozen
// SSL specific
private static final String SSL_ENABLED_TAG = "SslEnabled"; //frozen
private static final String SSL_PORT_TAG = "SslPort"; //frozen
private static final String SSL_KEY_STORE_TAG = "SslKeyStore"; //frozen
private static final String SSL_PASSWORD_TAG = "SslPassword"; //frozen
private static final String SSL_KEY_PASSWORD_TAG = "SslKeyPassword";
//frozen
private static final String SSL_TRUST_PASSWORD_TAG =
"SslTrustPassword"; //frozen
// Log specific
private static final String ACCESS_LOG_FORMAT_TAG = "AccessLogFormat";
//frozen
private static final String ACCESS_LOG_ENABLED_TAG =
"AccessLogEnabled"; //frozen
private static final String ACCESS_LOG_RETAIN_TAG =
"AccessLogRetainDays"; //frozen
private static final String ACCESS_LOG_APPEND_TAG = "AccessLogAppend";
//frozen
private static final String ACCESS_LOG_EXTENDED_TAG =
"AccessLogExtended"; //frozen
private static final String ACCESS_LOG_LATENCY_TAG =
"AccessLogLatency"; //frozen
private static final String ACCESS_LOG_TZ_TAG = "AccessLogTimeZone";
//frozen
// Read values
private List<WebAppContext> warContexts = new
ArrayList<WebAppContext>();
private int maxWaitForSlaves;
private boolean mortBayDebug;
private boolean httpEnabled;
private int httpPort;
private boolean nioEnabled;
private boolean sslEnabled;
private int sslPort;
private String sslKeyStore;
private String sslPassword;
private String sslKeyPassword;
private String sslTrustPassword;
private boolean logEnabled;
private String logFormat;
private int logRetain;
private boolean logAppend;
private boolean logExtended;
private boolean logLatency;
private String logTz;
public JettyServerConfiguration() {
}
@Override
public void configure(final Element xmlConfigElement) {
super.configure(xmlConfigElement);
final List<Element> warElements = getChildren(WAR_TAG);
for (final Element warElement : warElements) {
final String context = warElement.getAttribute("context");
//frozen
final String location = warElement.getAttribute("location");
//frozen
if ((location != null) && !location.isEmpty()) {
// check file is valid
final File f = new File(location);
if (!f.exists()) {
log.warning("War location '" + f.getAbsolutePath() +
"' does not exists."); //frozen
}
final WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath(context);
webAppContext.setResourceBase(f.getAbsolutePath());
//added in 9.3
webAppContext.setWar(f.getAbsolutePath());
webAppContext.setExtractWAR(false);
warContexts.add(webAppContext);
log.info("Context Path-->" + context);
log.info("War location-->" + f.getAbsolutePath());
} else {
throw new IllegalStateException("War location must be
specified."); //frozen
}
}
maxWaitForSlaves = getChildValueAsInteger(MAX_WAIT_FOR_SLAVE_TAG,
4 * 60 * 1000);
mortBayDebug = getChildValueAsBoolean(MORTBAY_DEBUG_TAG, false);
httpEnabled = getChildValueAsBoolean(HTTP_ENABLED_TAG, true);
nioEnabled = getChildValueAsBoolean(NIO_ENABLED_TAG, false);
httpPort = getChildValueAsInteger(HTTP_PORT_TAG, 8580);
sslEnabled = getChildValueAsBoolean(SSL_ENABLED_TAG, false);
sslPort = getChildValueAsInteger(SSL_PORT_TAG, 8581);
sslKeyPassword = getChildValue(SSL_KEY_PASSWORD_TAG);
sslKeyStore = getChildValue(SSL_KEY_STORE_TAG);
sslPassword = getChildValue(SSL_PASSWORD_TAG);
sslTrustPassword = getChildValue(SSL_TRUST_PASSWORD_TAG);
logEnabled = getChildValueAsBoolean(ACCESS_LOG_ENABLED_TAG, true);
logFormat = getChildValue(ACCESS_LOG_FORMAT_TAG,
"logs/access_logs/yyyy_mm_dd.access.log"); //frozen
logRetain = getChildValueAsInteger(ACCESS_LOG_RETAIN_TAG, 90);
logAppend = getChildValueAsBoolean(ACCESS_LOG_APPEND_TAG, true);
logExtended = getChildValueAsBoolean(ACCESS_LOG_EXTENDED_TAG,
false);
logLatency = getChildValueAsBoolean(ACCESS_LOG_LATENCY_TAG, false);
logTz = getChildValue(ACCESS_LOG_TZ_TAG, "GMT"); //frozen
log.info("End of Configuration..");
}
public int getHttpPort() {
return httpPort;
}
public boolean getNioEnabled() {
return nioEnabled;
}
public boolean getHttpEnabled() {
return httpEnabled;
}
public List<WebAppContext> getWebAppContexts() {
return warContexts;
}
public int getMaxWaitForSlave() {
return maxWaitForSlaves;
}
public boolean getMortBayDebug() {
return mortBayDebug;
}
public boolean getSslEnabled() {
return sslEnabled;
}
public int getSslPort() {
return sslPort;
}
public String getSslKeyStore() {
return sslKeyStore;
}
public String getSslPassword() {
return sslPassword;
}
public String getSslKeyPassword() {
return sslKeyPassword;
}
public String getSslTrustPassword() {
return sslTrustPassword;
}
public boolean getLogEnabled() {
return logEnabled;
}
public String getLogFormat() {
return logFormat;
}
public int getLogRetain() {
return logRetain;
}
public boolean getLogAppend() {
return logAppend;
}
public boolean getLogExtended() {
return logExtended;
}
public boolean getLogLatency() {
return logLatency;
}
public String getLogTz() {
return logTz;
}
@Override
public String toString() {
return "JettyServerConfiguration#" + getServiceName(); //frozen
}
@Override
public String prettyPrint() {
final String s = super.prettyPrint();
final StringBuilder str = new StringBuilder();
str.append(s);
str.append("------------- WebApps \n"); //frozen
str.append(String.format("%-40s%s\n", "Context", "WarFile"));
//frozen
for (final WebAppContext webapp : warContexts) {
str.append(String.format("%-40s%s\n",
webapp.getContextPath(), webapp.getWar())); //frozen
}
return str.toString();
}
}
INFO 17:11:46 05/07/2018 [com.osm.services.launcher.ServiceLauncher]
ServiceId = 3
SEVERE 17:11:46 05/07/2018 [stderr] 2018-07-05
org.eclipse.jetty.util.log.StdErrLog
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.
JettyServerConfiguration] Context Path-->/mmweb
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.
JettyServerConfiguration] War location-->C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.
JettyServerConfiguration] Context Path-->/
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.
JettyServerConfiguration] War location-->C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.
war
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.
JettyServerConfiguration] End of Configuration..
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer]
jetty version = 9.4.5.v20170502
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer]
Eclipse mortbay debug = 'false'
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer]
adding default connector on port '8580'
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer]
Adding WebAppContext C:\Program Files\RTC\Dreo Elements\Direct Manager
Server 20.1\webapps\mmweb at /mmweb
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer]
Adding WebAppContext C:\Program Files\RTC\Dreo Elements\Direct Manager
Server 20.1\webapps\OSMWebServices.war at /
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer]
initialize....osmRealm
INFO 17:11:47 05/07/2018 [com.osm.services.launcher.ServiceLauncher]
------------- XML configuration values
AccessLogAppend: true
AccessLogEnabled: true
AccessLogExtended: false
AccessLogFormat: logs/access_logs/yyyy_mm_dd.
access.log
AccessLogLatency: false
AccessLogRetainDays: 90
AccessLogTimeZone: GMT
AdditionalClasspath: jar\\jetty\\*
Executable: DreoJettyServer.exe
FileHandlerLogLevel: FINE
HttpEnabled: true
HttpPort: 8580
JvmArgs: -Xms16m -Xmx128m
-Djava.rmi.server.hostname=localhost
LogAppend: false
MaxLogFileSizeInMB: 0
MortBayDebug: false
SslEnabled: false
SslPort: 8581
StartupTimeoutInMinutes: 5
------------- Configuration class properties
classpath: classes;jar\*;jar\custom\*;
jar\\jetty\\*
configurationFile: custom.xml
defaultUser: medmgr
enabled: true
executable: DreoJettyServer.exe
fileHandlerLevel: FINE
httpEnabled: true
httpPort: 8580
javaClass: com.osm.services.webservice.
JettyServer
jvmArgs: -Xms16m -Xmx128m
-Djava.rmi.server.hostname=localhost
logAppend: false
logEnabled: true
logExtended: false
logFormat: logs/access_logs/yyyy_mm_dd.
access.log
logLatency: false
logLevels: {=INFO,
com.osm.ws.QueryService=FINE, com.osm.webservices.legacy.FileService=FINE,
com.osm.webservices.legacy.OSMService=FINE, com.osm.webservices.legacy.servlets=FINE,
com.osm.ws.UpdateService=FINE}
logRetain: 90
logTz: GMT
maxLogFileSizeInMB: 0
maxWaitForSlave: 240000
mortBayDebug: false
nioEnabled: false
runLevel: 5.0
serviceName: JettyServer
sslEnabled: false
sslPort: 8581
startupTimeoutInMinutes: 5
4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%
20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,UNAVAILABLE}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb},
RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/
webapps/OSMWebServices.war,UNAVAILABLE}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.
war}]
------------- WebApps
Context WarFile
/mmweb C:\Program Files\RTC\Dreo
Elements\Direct Manager Server 20.1\webapps\mmweb
/ C:\Program Files\RTC\Dreo
Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer]
start()
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer]
Registering JettyServer
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.092:INFO:oejs.Server:main: jetty-9.4.5.v20170502
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.217:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed
time=6ms
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:INFO:oejs.session:main: DefaultSessionIdManager
workerName=node0
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:INFO:oejs.session:main: No SessionScavenger set, using defaults
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
17:11:47.264:INFO:oejs.session:main: Scavenging every 660000ms
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/
webapps/mmweb/,STARTING}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /css/*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/
webapps/mmweb/,STARTING}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/
webapps/mmweb/,STARTING}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /js/*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05
RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/
webapps/mmweb/,STARTING}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has
uncovered http methods for path: /style/*
INFO 17:11:47 05/07/2018 [com.sun.xml.ws.server.http]
WSSERVLET12: JAX-WS context listener initializing
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.
PayloadQNameBasedOperationFinder] Non unique body parts! In a port,
as per BP 1.1 R2710 operations must have unique operation signature on the
wire for successful dispatch. Methods [getGroups, getUsers,
getUsersAndGroups, getRoutingLists, helpAbout] have the same request body
block . Method dispatching may fail, runtime will try to dispatch using
SOAPAction. Another option is to enable AddressingFeature to enabled
runtime to uniquely identify WSDL operation using wsa:Action header.
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.
PayloadQNameBasedOperationFinder] Non unique body parts! In a port,
as per BP 1.1 R2710 operations must have unique operation signature on the
wire for successful dispatch. Methods [getGroups, getUsers,
getUsersAndGroups, getRoutingLists, helpAbout] have the same request body
block . Method dispatching may fail, runtime will try to dispatch using
SOAPAction. Another option is to enable AddressingFeature to enabled
runtime to uniquely identify WSDL operation using wsa:Action header.
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.
PayloadQNameBasedOperationFinder] Non unique body parts! In a port,
as per BP 1.1 R2710 operations must have unique operation signature on the
wire for successful dispatch. Methods [getGroups, getUsers,
getUsersAndGroups, getRoutingLists, helpAbout] have the same request body
block . Method dispatching may fail, runtime will try to dispatch using
SOAPAction. Another option is to enable AddressingFeature to enabled
runtime to uniquely identify WSDL operation using wsa:Action header.
INFO 17:11:48 05/07/2018 [com.sun.xml.ws.servlet.http]
WSSERVLET14: JAX-WS servlet initializing
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.296:INFO:oejsh.ContextHandler:main: Started
20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/
,AVAILABLE}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb}
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.311:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed
time=0ms
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.327:INFO:oejsh.ContextHandler:main: Started
RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/
webapps/OSMWebServices.war,AVAILABLE}{C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.
war}
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.327:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\Program
Files\RTC\Dreo Elements\Direct Manager Server 20.1\logs\access_logs\2018_07_
05.access.log
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
17:11:48.433:INFO:oejs.AbstractConnector:main: Started
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05
INFO 17:11:58 05/07/2018 [com.osm.services.webservice.JettyServer]
registered(JettySlave2) (ID=5)
INFO 17:12:06 05/07/2018 [com.osm.services.webservice.JettyServer]
registered(JettySlave1) (ID=6)
webAppContexts: [org.mortbay.jetty.webapp.
Elements\Direct Manager Server 20.0\webapps\mmweb},
(x86)\RTC\Dreo Elements\Direct Manager Server 20.0\webapps\OSMWebServices.
war}]
Just ignore the path of mmweb it is different directory.
The problem I am facing is when I hit the url for a jsp page I am getting
the error like below which I was not getting in earlier jetty 6.1
javax.servlet.ServletException: org.apache.jasper.JasperException: An
exception occurred processing JSP page /include/header.jsp at line 8
5: String style = (String)session.getAttribute("style");
6: if(style==null) {
7: // controls default style
8: style = WebConfig.getInstance(getServletContext()).
getOption("DefaultTheme");
9: session.setAttribute("style", style);
10: }
at org.eclipse.jetty.server.handler.HandlerCollection.
handle(HandlerCollection.java:146)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(
HttpChannel.java:317)
at org.eclipse.jetty.server.HttpConnection.onFillable(
HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$
ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(
FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(
ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.
Invocable.invokePreferred(Invocable.java:128)
at org.eclipse.jetty.util.thread.
Invocable$InvocableExecutor.invoke(Invocable.java:222)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.
doProduce(EatWhatYouKill.java:294)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.
produce(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
QueuedThreadPool.java:672)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(
QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.jasper.JasperException: An exception occurred
processing JSP page /include/header.jsp at line 8
The jsp contains the scriptlet, please ignore that I am using the
scriptlet here. Just trying to show you the actual problem .
<%
request.setAttribute("start.time", (Long)System.currentTimeMillis());
String style = (String)session.getAttribute("style");
if(style==null) {
// controls default style
style = WebConfig.getInstance(getServletContext()).
getOption("DefaultTheme");
session.setAttribute("style", style);
}
final String header = "style/" + style + "/header.jsp";
%>
<osm:license writeAccess="false"/>
<jsp:include page="<%=header%>"/>
I don't think it has anything to do with dependency as even displaying the
Jetty version is giving the same kind of error.But it gets render when I
remove the JettyServer import and version call,i.e only system libraries
are getting detected.
C:\Users\vkarn\.m2\repository\javax\servlet\javax.servlet-
api\3.1.0\javax.servlet-api-3.1.0.jar
C:\Users\vkarn\.m2\repository\junit\junit\4.12\junit-4.12.jar
C:\Users\vkarn\.m2\repository\org\hamcrest\hamcrest-core\1.
3\hamcrest-core-1.3.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-
annotations\9.4.5.v20170502\jetty-annotations-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-plus\
9.4.5.v20170502\jetty-plus-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-jndi\
9.4.5.v20170502\jetty-jndi-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\javax\annotation\javax.
annotation-api\1.2\javax.annotation-api-1.2.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm\5.1\asm-5.1.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-commons\5.1\
asm-commons-5.1.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-tree\5.1\asm-tree-5.1.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-
webapp\9.4.5.v20170502\jetty-webapp-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-xml\9.
4.5.v20170502\jetty-xml-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-
servlet\9.4.5.v20170502\jetty-servlet-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-
security\9.4.5.v20170502\jetty-security-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-
server\9.4.5.v20170502\jetty-server-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-http\
9.4.5.v20170502\jetty-http-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-io\9.
4.5.v20170502\jetty-io-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\apache-jsp\
9.4.5.v20170502\apache-jsp-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-util\
9.4.5.v20170502\jetty-util-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\toolchain\
jetty-schemas\3.1\jetty-schemas-3.1.jar
C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-jsp\
8.5.9.1\apache-jsp-8.5.9.1.jar
C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-el\
8.5.9.1\apache-el-8.5.9.1.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jdt\core\compiler\
ecj\4.4.2\ecj-4.4.2.jar
C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-
standard-spec\1.2.5\taglibs-standard-spec-1.2.5.jar
C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-
standard-impl\1.2.5\taglibs-standard-impl-1.2.5.jar
_______________________________________________
jetty-users mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
--
Greg Wilkins <***@webtide.com> CTO http://webtide.com
Karn, Vibhas
2018-07-06 08:31:21 UTC
Permalink
Hi ,

Thanks for the response. I have attached the sample example project.

Can you simply extract and run the example.jsp?

You can run the “JettyJspExampleMain.java”

Then try to hit: https://localhost:8083/mmweb/example.jsp

Or

https://localhost:8083/mmweb/include/header.jsp

It will show you the error which I am getting.

Regards

Vibhas

From: jetty-users-***@eclipse.org [mailto:jetty-users-***@eclipse.org] On Behalf Of Greg Wilkins
Sent: 06 July 2018 13:24
To: JETTY user mailing list <jetty-***@eclipse.org>
Subject: Re: [jetty-users] Jetty 9.4 issue while rendering JSP page


Hi,

I'm sorry but you've not well described your problem and giving us a lot of code does not help at all.


I suggest that you start with one of the examples from 9.4 that provides a sample JSP and then just change that to add in your JSPs and anything else you need.

regards




On 6 July 2018 at 08:44, Vibhas Karn <***@gmail.com<mailto:***@gmail.com>> wrote:
Hi All,

I am struggling with jetty Migration of 6.1 to latest or anything above Jetty 9.1 . Currently I am trying with Jetty 9.4 which is latest.
I am able to compile the old code with the new one but there are few issues with the migration which I am trying to fix. Yes its the tough job but no option left.
I am currently focussing to render the old jsp pages after migrating it to Jetty 9.4. Here is the sample code , I have mentioned the problem in the post below. Help me with you suggestion or anything as I am struggling to fix this issue since a week now.

JettyServer Sample Code :

public class JettyServer extends AbstractService implements IJettyServer, IStatus {
public static final String SERVICE_NAME = "JettyServer"; //frozen
private static final Logger log = Logger.getLogger(JettyServer.class.getName());
private static JettyServer instance = null;
private Server server;

// The map of service id to the jetty slave.
private final Map<Integer, IJettySlave> idToSlaveMap = new HashMap<Integer, IJettySlave>();

// A linked list of the slaves.
private final List<IJettySlave> availableSlaves = new LinkedList<IJettySlave>();

// TODO ref count availableAPIs.
private final Set<Class> availableAPIs = new HashSet<Class>();

// The map of service if to the slave status.
private final Map<Integer, IStatus> idToStatusMap = new HashMap<Integer, IStatus>();
private final int registryPort;
private int maxWaitForSlave = 0;

/**
* Creates a new JettyServer using the default registry port from the ServiceControllerConfig.
* @throws RemoteException when RMI problems occur.
*/
public JettyServer() throws RemoteException {
this(ServiceControllerConfig.getInstance().getControlPort());
}

/**
* Creates a new JettyServer using the control port passed.
* @param registryPort the registry port.
* @throws RemoteException when RMI problems occur.
*/
public JettyServer(final int registryPort) throws RemoteException {
this.registryPort = registryPort;
instance = this;
}

@Override
public void initialize(final ServiceConfiguration genericConfig, final Controller controller, final int serviceId,
final ServiceLock lock) throws Exception {
if (genericConfig instanceof JettyServerConfiguration) {
configuration = (JettyServerConfiguration) genericConfig;
} else {
configuration = XmlConfigurable.createInstance(JettyServerConfiguration.class,
genericConfig.getXmlConfigElement());
}

server = new Server();
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706217125&sdata=5iJE%2FPzcLGxObYdzv0Ifl8tV4VpVnC2sCchjcAvPdnk%3D&reserved=0>("jetty version = " + Server.getVersion()); //frozen

maxWaitForSlave = getConfiguration().getMaxWaitForSlave();

final boolean debug = getConfiguration().getMortBayDebug();
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706227134&sdata=tjHvV3Pg1v6IG0yIyrioGlJcx%2B4d5f26xEnV8CQQyz0%3D&reserved=0>("Eclipse mortbay debug = '" + debug + "'"); //frozen
org.eclipse.jetty.util.log.Log.getLog().setDebugEnabled(debug);

// Configure http
final boolean httpEnabled = getConfiguration().getHttpEnabled();

if (httpEnabled) {
final int mainPort = getConfiguration().getHttpPort();

log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706237138&sdata=GOc5gxllNNfmFM09VIqAxqudUSao%2Bu0VvvX%2BxJiJDCk%3D&reserved=0>("adding default connector on port '" + mainPort + "'"); //frozen
//Re-writing the code for jetty 9.3
// Setup HTTP Connector

HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");

// Establish the HTTP ServerConnector
ServerConnector httpConnector = new ServerConnector(server, new HttpConnectionFactory(httpConf));
httpConnector.setPort(mainPort);
server.addConnector(httpConnector);
}

// Configure SSL
final boolean sslEnabled = getConfiguration().getSslEnabled();

if (sslEnabled) {
//Re-writing code for Jetty 9.3
final int mainPort = getConfiguration().getHttpPort(); //8580
final int sslPort = getConfiguration().getSslPort(); //8581
final String sslKeyStore = getConfiguration().getSslKeyStore();
final String sslPassword = getConfiguration().getSslPassword();
final String sslKeyPassword = getConfiguration().getSslKeyPassword();
final String sslTrustPassword = getConfiguration().getSslTrustPassword();

//Added for Jetty 9.3
final KeyStore trustKeyStore = KeyStore.getInstance(getConfiguration().getSslKeyStore());

SslContextFactory theSSLFactory = new SslContextFactory();

theSSLFactory.setKeyStorePath(sslKeyStore);
theSSLFactory.setKeyManagerPassword(sslPassword);
theSSLFactory.setKeyStorePassword(sslKeyPassword);
theSSLFactory.setTrustStore(trustKeyStore);
theSSLFactory.setTrustStorePassword(sslTrustPassword);

// Setup HTTP Connector
HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");

// Setup HTTPS Configuration
HttpConfiguration httpsConf = new HttpConfiguration(httpConf);
httpsConf.addCustomizer(new SecureRequestCustomizer()); // adds ssl info to request object

// Establish the HTTPS ServerConnector
ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(theSSLFactory, "http/1.1"), new HttpConnectionFactory(httpsConf));
httpsConnector.setPort(sslPort);

log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706237138&sdata=GOc5gxllNNfmFM09VIqAxqudUSao%2Bu0VvvX%2BxJiJDCk%3D&reserved=0>("adding ssl connector on port '" + sslPort + "'"); //frozen
server.addConnector(httpsConnector);

//}
}

// Check we had 1 connector else the server is useless
if (server.getConnectors().length == 0) {
throw new FileNotFoundException("No connectors registered. Please see HttpEnable or SslEnable XML tags."); //frozen
}

// Configure the handlers
final HandlerCollection handlers = new HandlerCollection();

//4. Enabling the Annotation based configuration
org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration",
"org.eclipse.jetty.plus.webapp.EnvConfiguration", "org.eclipse.jetty.plus.webapp.PlusConfiguration");
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");

for (final WebAppContext webAppContext : getConfiguration().getWebAppContexts()) {
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706247146&sdata=qpb1uYbd3TaR6lLOniqBtBjJdpH5dvkKKMZca36ideY%3D&reserved=0>("Adding WebAppContext " + webAppContext.getWar() + " at " + webAppContext.getContextPath()); //frozen

webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
".*/[^/]*jstl.*\\.jar$");
handlers.addHandler(webAppContext);
}

final boolean accessLogEnabled = getConfiguration().getLogEnabled();

if (accessLogEnabled) {
final RequestLogHandler requestLogHandler = new RequestLogHandler();
final File logDir = ServiceUtilities.getLogDirectory();

if (!logDir.exists()) {
logDir.mkdirs();
}

final File logFile = new File(getConfiguration().getLogFormat());

if (!logFile.getParentFile().exists()) {
logFile.getParentFile().mkdirs();
}

final NCSARequestLog requestLog = new NCSARequestLog(getConfiguration().getLogFormat());
requestLog.setRetainDays(getConfiguration().getLogRetain());
requestLog.setAppend(getConfiguration().getLogAppend());
requestLog.setExtended(getConfiguration().getLogExtended());
requestLog.setLogTimeZone(getConfiguration().getLogTz());
requestLog.setLogLatency(getConfiguration().getLogLatency());
requestLogHandler.setRequestLog(requestLog);
handlers.addHandler(requestLogHandler);
}

handlers.addHandler(new DefaultHandler());

server.setHandler(handlers);

// server.setUserRealms(new UserRealm[] { new OSMUserRealm() });
// server.addBean(new LoginService[] { new OSMUserRealm() });

// HashLoginService loginService = new HashLoginService();
//loginService.setName("osmRealm");
//server.addBean(loginService);

// log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706247146&sdata=qpb1uYbd3TaR6lLOniqBtBjJdpH5dvkKKMZca36ideY%3D&reserved=0>("initialize...." + loginService.getName());
JettyServerInfo.install(server);

super.initialize(configuration, controller, serviceId, lock);
}

@Override
public JettyServerConfiguration getConfiguration() {
return (JettyServerConfiguration) super.getConfiguration();
}

@Override
public synchronized void stop() {
final Thread t = new Thread("JettyServer Stop Thread") { //frozen
@Override
public void run() {
try {
server.stop();
} catch (Exception ex) {
log.log(Level.SEVERE, "Failed to stop Jetty server", ex); //frozen
}
}
};

t.start();

try {
t.join(500);
} catch (final InterruptedException ex) {
}

super.stop();
}

@Override
public synchronized void start() throws Exception {
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706257155&sdata=68vN8GbUAnMQL%2BAmVFKYjW8MzqlUbKXaVSB0Xs1kTd4%3D&reserved=0>("start()"); //frozen

registerJetty();

server.start();

// finish startup which registers with the controller
super.start();

server.join(); //For Jetty 9.3 and above

// server.join(); need to uncomment and verify if jetty if we need server.join in Jetty 9.3 as previous person don't have
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706267168&sdata=0%2BzmYUT8l%2BNZGwIde0tcFauzzvwljQxMUiirHdFUUXA%3D&reserved=0>("After Jetty 9.3 Services starts..");
}

private void registerJetty() throws RemoteException, AlreadyBoundException, AlreadyBoundException {
final Registry registry = LocateRegistry.getRegistry("127.0.0.1", registryPort); //frozen

final Remote remote = UnicastRemoteObject.toStub(this);
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706267168&sdata=0%2BzmYUT8l%2BNZGwIde0tcFauzzvwljQxMUiirHdFUUXA%3D&reserved=0>("Registering JettyServer"); //frozen
registry.rebind(IJettyServer.JETTYSERVER_NAME, remote);
}

@Override
public void unregister(final IJettySlave slave) throws RemoteException {
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706277172&sdata=YeXSP5jIeNI9gPQvq1EUiuEj%2FqTZ3jplpVnRbE%2F9btc%3D&reserved=0>("unregister(" + slave.getName() + ") (ID=" + slave.getServiceID() + ")"); //frozen

synchronized (idToSlaveMap) {
idToSlaveMap.remove(slave.getServiceID());

if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.remove(slave.getServiceID());
}
}
}

synchronized (availableSlaves) {
// Shouldnt really be in the list as teh BusyAPIDynamicProxy shouldnt
// have re-added it on a shutdown.
if (availableSlaves.remove(slave)) {
availableSlaves.notifyAll();
}
}
}

@Override
public void register(final IJettySlave slave) throws RemoteException {
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706277172&sdata=YeXSP5jIeNI9gPQvq1EUiuEj%2FqTZ3jplpVnRbE%2F9btc%3D&reserved=0>("registered(" + slave.getName() + ") (ID=" + slave.getServiceID() + ")"); //frozen

synchronized (idToSlaveMap) {
idToSlaveMap.put(slave.getServiceID(), slave);

if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.put(slave.getServiceID(), (IStatus) slave);
}
}
}

synchronized (availableSlaves) {
availableSlaves.add(slave);
availableSlaves.notifyAll();
}

synchronized (availableAPIs) {
availableAPIs.addAll(slave.getAPIs());
}
}

public static JettyServer getInstance() {
return instance;
}

public <I extends Remote> I get(final Class<I> i) throws RemoteException {
return createApiProxy(i);
}

void push(final IJettySlave slave) {
synchronized (availableSlaves) {
availableSlaves.add(0, slave);
availableSlaves.notifyAll();
}
}

<I extends Remote> IJettySlave pop(final Class<I> i)
throws RemoteException {
if (idToSlaveMap.isEmpty()) {
throw new IllegalStateException("No JettySlaves available, please check the server log files."); //frozen
}

if (availableAPIs.isEmpty()) {
throw new IllegalStateException("No JettySlave APIs available, please check the server log files."); //frozen
}

synchronized (availableAPIs) {
// Check if any slave provides this API, as its pointless waiting
// when we know an API will not be available.
// FYI : This should be removed if we provide auto startup of slaves.
if (!availableAPIs.contains(i)) {
throw new RemoteException("API " + i.getName() + " is not available."); //frozen
}
}

final long end = System.currentTimeMillis() + maxWaitForSlave;

while (System.currentTimeMillis() < end) {
synchronized (availableSlaves) {
// Get a service from any idle slave.
final Iterator<IJettySlave> it = availableSlaves.iterator();

while (it.hasNext()) {
final IJettySlave slave = it.next();

try {
final I slaveApi = slave.get(i);

if (slaveApi != null) {
it.remove(); // remove this slave from list

return slave;
}
} catch (final RemoteException re) {
// this host doesnt work so remove it.
it.remove();
}
}

// now wait for a slave to become inactive
final long sleep = end - System.currentTimeMillis();

try {
if (sleep > 0) {
availableSlaves.wait(sleep);
}
} catch (final InterruptedException ex) {
}
}
}

throw new IllegalStateException("All APIs '" + i.getName() + "' are busy or unavailable."); //frozen
}

/**
* Creates a proxy for the specific interface.
* @param <I> a remote interface class.
* @param i the remote interface class
* @return the proxy for this interface.
* @throws RemoteException when RMI fails.
* @see BusyAPIDynamicProxy
*/
@SuppressWarnings("unchecked")
private <I extends Remote> I createApiProxy(final Class<I> i)
throws RemoteException {
// Insert the busy dynamic proxy so we know which is busy
final I proxy = (I) java.lang.reflect.Proxy.newProxyInstance(i.getClassLoader(), new Class[] { i },
new BusyAPIDynamicProxy<I>(this, i));

return proxy;
}

public final Map<Integer, IStatus> getSlaveStatus()
throws RemoteException {
return new TreeMap<Integer, IStatus>(idToStatusMap);
}

public final IStatus getStatus() {
return this;
}

@Override
public long getUpTime() throws RemoteException {
final java.lang.management.RuntimeMXBean mx = java.lang.management.ManagementFactory.getRuntimeMXBean();

return mx.getUptime() / 1000;
}

@Override
public long getTotalMemory() throws RemoteException {
return Runtime.getRuntime().totalMemory();
}

@Override
public long getFreeMemory() throws RemoteException {
return Runtime.getRuntime().freeMemory();
}

@Override
public long getMaxMemory() throws RemoteException {
return Runtime.getRuntime().maxMemory();
}

public static void main(final String[] args) throws Exception {
// jetty depends on the registry all the time.
LocateRegistry.createRegistry(ServiceControllerConfig.getInstance().getControlPort());

System.setProperty("service.id<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fservice.id&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706287181&sdata=U%2F1IUD3h6rX54XDTKfh0fc3lRTVKditfb2W38n8wesc%3D&reserved=0>", "-1"); //frozen

runStandalone(SERVICE_NAME);

// jetty server depends on a slave working.
runStandalone("JettySlave1"); //frozen
}
}

Jetty Configuration class:

/**
* RCS: $Id: //oswm/rel20.10_Patches/WorkManager/src/com/osm/services/webservice/JettyServerConfiguration.java#1 $
* Last Modified: $Author: adminp4 $, $DateTime: 2018/03/28 14:59:10 $
*/
package com.osm.services.webservice;

import java.io.File;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import org.eclipse.jetty.webapp.WebAppContext;

import org.w3c.dom.Element;

import com.osm.services.configuration.ManagerServiceConfiguration;


public class JettyServerConfiguration extends ManagerServiceConfiguration {
private static final Logger log = Logger.getLogger(JettyServerConfiguration.class.getName());
private static final String WAR_TAG = "War"; //frozen
private static final String MAX_WAIT_FOR_SLAVE_TAG = "MaxWaitForSlave"; //frozen
private static final String MORTBAY_DEBUG_TAG = "MortBayDebug"; //frozen
private static final String HTTP_ENABLED_TAG = "HttpEnabled"; //frozen
private static final String HTTP_PORT_TAG = "HttpPort"; //frozen
private static final String NIO_ENABLED_TAG = "NioEnabled"; //frozen

// SSL specific
private static final String SSL_ENABLED_TAG = "SslEnabled"; //frozen
private static final String SSL_PORT_TAG = "SslPort"; //frozen
private static final String SSL_KEY_STORE_TAG = "SslKeyStore"; //frozen
private static final String SSL_PASSWORD_TAG = "SslPassword"; //frozen
private static final String SSL_KEY_PASSWORD_TAG = "SslKeyPassword"; //frozen
private static final String SSL_TRUST_PASSWORD_TAG = "SslTrustPassword"; //frozen

// Log specific
private static final String ACCESS_LOG_FORMAT_TAG = "AccessLogFormat"; //frozen
private static final String ACCESS_LOG_ENABLED_TAG = "AccessLogEnabled"; //frozen
private static final String ACCESS_LOG_RETAIN_TAG = "AccessLogRetainDays"; //frozen
private static final String ACCESS_LOG_APPEND_TAG = "AccessLogAppend"; //frozen
private static final String ACCESS_LOG_EXTENDED_TAG = "AccessLogExtended"; //frozen
private static final String ACCESS_LOG_LATENCY_TAG = "AccessLogLatency"; //frozen
private static final String ACCESS_LOG_TZ_TAG = "AccessLogTimeZone"; //frozen

// Read values
private List<WebAppContext> warContexts = new ArrayList<WebAppContext>();
private int maxWaitForSlaves;
private boolean mortBayDebug;
private boolean httpEnabled;
private int httpPort;
private boolean nioEnabled;
private boolean sslEnabled;
private int sslPort;
private String sslKeyStore;
private String sslPassword;
private String sslKeyPassword;
private String sslTrustPassword;
private boolean logEnabled;
private String logFormat;
private int logRetain;
private boolean logAppend;
private boolean logExtended;
private boolean logLatency;
private String logTz;

public JettyServerConfiguration() {
}

@Override
public void configure(final Element xmlConfigElement) {
super.configure(xmlConfigElement);

final List<Element> warElements = getChildren(WAR_TAG);

for (final Element warElement : warElements) {
final String context = warElement.getAttribute("context"); //frozen
final String location = warElement.getAttribute("location"); //frozen

if ((location != null) && !location.isEmpty()) {
// check file is valid
final File f = new File(location);

if (!f.exists()) {
log.warning("War location '" + f.getAbsolutePath() + "' does not exists."); //frozen
}

final WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath(context);
webAppContext.setResourceBase(f.getAbsolutePath()); //added in 9.3
webAppContext.setWar(f.getAbsolutePath());
webAppContext.setExtractWAR(false);

warContexts.add(webAppContext);

log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706287181&sdata=erFBgtsbU8vhpJgaHvh15KZQomTwJWEY3XCsL7jq6GU%3D&reserved=0>("Context Path-->" + context);
log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706297189&sdata=2Pv6odqIk6ZnUo4NhHe2TrRyWlok4j6vyiA%2B%2FT4oXC4%3D&reserved=0>("War location-->" + f.getAbsolutePath());
} else {
throw new IllegalStateException("War location must be specified."); //frozen
}
}

maxWaitForSlaves = getChildValueAsInteger(MAX_WAIT_FOR_SLAVE_TAG, 4 * 60 * 1000);
mortBayDebug = getChildValueAsBoolean(MORTBAY_DEBUG_TAG, false);
httpEnabled = getChildValueAsBoolean(HTTP_ENABLED_TAG, true);
nioEnabled = getChildValueAsBoolean(NIO_ENABLED_TAG, false);
httpPort = getChildValueAsInteger(HTTP_PORT_TAG, 8580);

sslEnabled = getChildValueAsBoolean(SSL_ENABLED_TAG, false);
sslPort = getChildValueAsInteger(SSL_PORT_TAG, 8581);
sslKeyPassword = getChildValue(SSL_KEY_PASSWORD_TAG);
sslKeyStore = getChildValue(SSL_KEY_STORE_TAG);
sslPassword = getChildValue(SSL_PASSWORD_TAG);
sslTrustPassword = getChildValue(SSL_TRUST_PASSWORD_TAG);

logEnabled = getChildValueAsBoolean(ACCESS_LOG_ENABLED_TAG, true);
logFormat = getChildValue(ACCESS_LOG_FORMAT_TAG, "logs/access_logs/yyyy_mm_dd.access.log"); //frozen
logRetain = getChildValueAsInteger(ACCESS_LOG_RETAIN_TAG, 90);
logAppend = getChildValueAsBoolean(ACCESS_LOG_APPEND_TAG, true);
logExtended = getChildValueAsBoolean(ACCESS_LOG_EXTENDED_TAG, false);
logLatency = getChildValueAsBoolean(ACCESS_LOG_LATENCY_TAG, false);
logTz = getChildValue(ACCESS_LOG_TZ_TAG, "GMT"); //frozen

log.info<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flog.info&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706307202&sdata=e9uJN8ySf0aMAiOF6fnzA2QuZ9A42qWLwOrdRm34QeE%3D&reserved=0>("End of Configuration..");
}

public int getHttpPort() {
return httpPort;
}

public boolean getNioEnabled() {
return nioEnabled;
}

public boolean getHttpEnabled() {
return httpEnabled;
}

public List<WebAppContext> getWebAppContexts() {
return warContexts;
}

public int getMaxWaitForSlave() {
return maxWaitForSlaves;
}

public boolean getMortBayDebug() {
return mortBayDebug;
}

public boolean getSslEnabled() {
return sslEnabled;
}

public int getSslPort() {
return sslPort;
}

public String getSslKeyStore() {
return sslKeyStore;
}

public String getSslPassword() {
return sslPassword;
}

public String getSslKeyPassword() {
return sslKeyPassword;
}

public String getSslTrustPassword() {
return sslTrustPassword;
}

public boolean getLogEnabled() {
return logEnabled;
}

public String getLogFormat() {
return logFormat;
}

public int getLogRetain() {
return logRetain;
}

public boolean getLogAppend() {
return logAppend;
}

public boolean getLogExtended() {
return logExtended;
}

public boolean getLogLatency() {
return logLatency;
}

public String getLogTz() {
return logTz;
}

@Override
public String toString() {
return "JettyServerConfiguration#" + getServiceName(); //frozen
}

@Override
public String prettyPrint() {
final String s = super.prettyPrint();

final StringBuilder str = new StringBuilder();
str.append(s);
str.append("------------- WebApps \n"); //frozen
str.append(String.format("%-40s%s\n", "Context", "WarFile")); //frozen

for (final WebAppContext webapp : warContexts) {
str.append(String.format("%-40s%s\n", webapp.getContextPath(), webapp.getWar())); //frozen
}

return str.toString();
}
}

Logs for the execution:

INFO 17:11:46 05/07/2018 [com.osm.services.launcher.ServiceLauncher] ServiceId = 3
SEVERE 17:11:46 05/07/2018 [stderr] 2018-07-05 17:11:46.936:INFO::main: Logging initialized @821ms to org.eclipse.jetty.util.log.StdErrLog
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] Context Path-->/mmweb
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] War location-->C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] Context Path-->/
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] War location-->C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServerConfiguration] End of Configuration..
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer] jetty version = 9.4.5.v20170502
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer] Eclipse mortbay debug = 'false'
INFO 17:11:46 05/07/2018 [com.osm.services.webservice.JettyServer] adding default connector on port '8580'
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] Adding WebAppContext C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb at /mmweb
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] Adding WebAppContext C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war at /
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] initialize....osmRealm
INFO 17:11:47 05/07/2018 [com.osm.services.launcher.ServiceLauncher] Configuration 'JettyServer' :
------------- XML configuration values
AccessLogAppend: true
AccessLogEnabled: true
AccessLogExtended: false
AccessLogFormat: logs/access_logs/yyyy_mm_dd.access.log
AccessLogLatency: false
AccessLogRetainDays: 90
AccessLogTimeZone: GMT
AdditionalClasspath: jar\\jetty\\*
Executable: DreoJettyServer.exe
FileHandlerLogLevel: FINE
HttpEnabled: true
HttpPort: 8580
JvmArgs: -Xms16m -Xmx128m -Djava.rmi.server.hostname=localhost
LogAppend: false
MaxLogFileSizeInMB: 0
MortBayDebug: false
SslEnabled: false
SslPort: 8581
StartupTimeoutInMinutes: 5

------------- Configuration class properties
classpath: classes;jar\*;jar\custom\*;jar\\jetty\\*
configurationFile: custom.xml
debugOptions:
defaultUser: medmgr
enabled: true
executable: DreoJettyServer.exe
fileHandlerLevel: FINE
httpEnabled: true
httpPort: 8580
javaClass: com.osm.services.webservice.JettyServer
jvmArgs: -Xms16m -Xmx128m -Djava.rmi.server.hostname=localhost
logAppend: false
logEnabled: true
logExtended: false
logFormat: logs/access_logs/yyyy_mm_dd.access.log
logLatency: false
logLevels: {=INFO, com.osm.ws.QueryService=FINE, com.osm.webservices.legacy.FileService=FINE, com.osm.webservices.legacy.OSMService=FINE, com.osm.webservices.legacy.servlets=FINE, com.osm.ws.UpdateService=FINE}
logRetain: 90
logTz: GMT
maxLogFileSizeInMB: 0
maxWaitForSlave: 240000
mortBayDebug: false
nioEnabled: false
runLevel: 5.0
serviceName: JettyServer
sslEnabled: false
sslPort: 8581
startupTimeoutInMinutes: 5
webAppContexts: [***@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,UNAVAILABLE}{C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb}, ***@69a3d1d{/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,UNAVAILABLE}{C:\Program<mailto:***@69a3d1d%7b/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,UNAVAILABLE%7d%7bC:%5CProgram> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war}]
------------- WebApps
Context WarFile
/mmweb C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb
/ C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war


INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] start()
INFO 17:11:47 05/07/2018 [com.osm.services.webservice.JettyServer] Registering JettyServer
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.092:INFO:oejs.Server:main: jetty-9.4.5.v20170502
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.217:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=6ms
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:INFO:oejs.session:main: No SessionScavenger set, using defaults
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:INFO:oejs.session:main: Scavenging every 660000ms
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:%5CProgram> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /css/*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:%5CProgram> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:%5CProgram> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /js/*
SEVERE 17:11:47 05/07/2018 [stderr] 2018-07-05 17:11:47.264:WARN:oejs.SecurityHandler:main: ***@o.e.j.w.WebAppContext@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING}{C:\Program<mailto:***@o.e.j.w.WebAppContext@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,STARTING%7d%7bC:%5CProgram> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb} has uncovered http methods for path: /style/*
INFO 17:11:47 05/07/2018 [com.sun.xml.ws.server.http] WSSERVLET12: JAX-WS context listener initializing
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signature on the wire for successful dispatch. Methods [getGroups, getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same request body block . Method dispatching may fail, runtime will try to dispatch using SOAPAction. Another option is to enable AddressingFeature to enabled runtime to uniquely identify WSDL operation using wsa:Action header.
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signature on the wire for successful dispatch. Methods [getGroups, getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same request body block . Method dispatching may fail, runtime will try to dispatch using SOAPAction. Another option is to enable AddressingFeature to enabled runtime to uniquely identify WSDL operation using wsa:Action header.
WARNING 17:11:47 05/07/2018 [com.sun.xml.ws.wsdl.PayloadQNameBasedOperationFinder] Non unique body parts! In a port, as per BP 1.1 R2710 operations must have unique operation signature on the wire for successful dispatch. Methods [getGroups, getUsers, getUsersAndGroups, getRoutingLists, helpAbout] have the same request body block . Method dispatching may fail, runtime will try to dispatch using SOAPAction. Another option is to enable AddressingFeature to enabled runtime to uniquely identify WSDL operation using wsa:Action header.
INFO 17:11:48 05/07/2018 [com.sun.xml.ws.servlet.http] WSSERVLET14: JAX-WS servlet initializing
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.296:INFO:oejsh.ContextHandler:main: Started ***@4b553d26{/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,AVAILABLE}{C:\Program<mailto:***@4b553d26%7b/mmweb,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/mmweb/,AVAILABLE%7d%7bC:%5CProgram> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\mmweb}
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.311:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=0ms
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.327:INFO:oejsh.ContextHandler:main: Started ***@69a3d1d{/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,AVAILABLE}{C:\Program<mailto:***@69a3d1d%7b/,file:///C:/Program%20Files/RTC/Dreo%20Elements/Direct%20Manager%20Server%2020.1/webapps/OSMWebServices.war,AVAILABLE%7d%7bC:%5CProgram> Files\RTC\Dreo Elements\Direct Manager Server 20.1\webapps\OSMWebServices.war}
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.327:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\Program Files\RTC\Dreo Elements\Direct Manager Server 20.1\logs\access_logs\2018_07_05.access.log
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.433:INFO:oejs.AbstractConnector:main: Started ***@1b1637e1{HTTP/1.1,[http/1.1]}{0.0.0.0:8580}<mailto:***@1b1637e1%7bHTTP/1.1,%5bhttp/1.1%5d%7d%7b0.0.0.0:8580%7d>
SEVERE 17:11:48 05/07/2018 [stderr] 2018-07-05 17:11:48.433:INFO:oejs.Server:main: Started @2313ms
INFO 17:11:58 05/07/2018 [com.osm.services.webservice.JettyServer] registered(JettySlave2) (ID=5)
INFO 17:12:06 05/07/2018 [com.osm.services.webservice.JettyServer] registered(JettySlave1) (ID=6)

All the remaining details was same in Jetty 6.1 except this line:

webAppContexts: [***@5792a0{/mmweb,C:\Program Files (x86)\RTC\Dreo Elements\Direct Manager Server 20.0\webapps\mmweb}, ***@653222{/,C:\Program<mailto:***@653222%7b/,C:%5CProgram> Files (x86)\RTC\Dreo Elements\Direct Manager Server 20.0\webapps\OSMWebServices.war}]

Just ignore the path of mmweb it is different directory.

The problem I am facing is when I hit the url for a jsp page I am getting the error like below which I was not getting in earlier jetty 6.1

Caused by:
javax.servlet.ServletException: org.apache.jasper.JasperException: An exception occurred processing JSP page /include/header.jsp at line 8

5: String style = (String)session.getAttribute("style");
6: if(style==null) {
7: // controls default style
8: style = WebConfig.getInstance(getServletContext()).getOption("DefaultTheme");
9: session.setAttribute("style", style);
10: }
11:


Stacktrace:
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Forg.eclipse.jetty.io&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706307202&sdata=%2FRPPTbxFa03gP2ScTL9dByVwYDpLOX5ob6Vi73kxk2Q%3D&reserved=0>.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Forg.eclipse.jetty.io&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706317210&sdata=G3r0L7zv5h3zJ0cm2Vz%2B%2B1tHgfkUY0sNmMCS75mn9N0%3D&reserved=0>.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Forg.eclipse.jetty.io&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706317210&sdata=G3r0L7zv5h3zJ0cm2Vz%2B%2B1tHgfkUY0sNmMCS75mn9N0%3D&reserved=0>.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.jasper.JasperException: An exception occurred processing JSP page /include/header.jsp at line 8
The jsp contains the scriptlet, please ignore that I am using the scriptlet here. Just trying to show you the actual problem .

<%@page import="com.osm.jsp.util.WebConfig"%<mailto:%***@page%20import=%22com.osm.jsp.util.WebConfig%22%25>>
<%
request.setAttribute("start.time", (Long)System.currentTimeMillis());

String style = (String)session.getAttribute("style");
if(style==null) {
// controls default style
style = WebConfig.getInstance(getServletContext()).getOption("DefaultTheme");
session.setAttribute("style", style);
}

final String header = "style/" + style + "/header.jsp";
%>
<%@taglib prefix="osm" uri="/WEB-INF/tlds/Manager.tld" %<mailto:%***@taglib%20prefix=%22osm%22%20uri=%22/WEB-INF/tlds/Manager.tld%22%20%25>>
<osm:license writeAccess="false"/>
<jsp:include page="<%=header%>"/>

I don't think it has anything to do with dependency as even displaying the Jetty version is giving the same kind of error.But it gets render when I remove the JettyServer import and version call,i.e only system libraries are getting detected.

These are the jars I have used in classpath:

C:\Users\vkarn\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar
C:\Users\vkarn\.m2\repository\junit\junit\4.12\junit-4.12.jar
C:\Users\vkarn\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-annotations\9.4.5.v20170502\jetty-annotations-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-plus\9.4.5.v20170502\jetty-plus-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-jndi\9.4.5.v20170502\jetty-jndi-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm\5.1\asm-5.1.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-commons\5.1\asm-commons-5.1.jar
C:\Users\vkarn\.m2\repository\org\ow2\asm\asm-tree\5.1\asm-tree-5.1.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-webapp\9.4.5.v20170502\jetty-webapp-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-xml\9.4.5.v20170502\jetty-xml-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-servlet\9.4.5.v20170502\jetty-servlet-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-security\9.4.5.v20170502\jetty-security-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-server\9.4.5.v20170502\jetty-server-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-http\9.4.5.v20170502\jetty-http-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-io\9.4.5.v20170502\jetty-io-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\apache-jsp\9.4.5.v20170502\apache-jsp-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\jetty-util\9.4.5.v20170502\jetty-util-9.4.5.v20170502.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jetty\toolchain\jetty-schemas\3.1\jetty-schemas-3.1.jar
C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-jsp\8.5.9.1\apache-jsp-8.5.9.1.jar
C:\Users\vkarn\.m2\repository\org\mortbay\jasper\apache-el\8.5.9.1\apache-el-8.5.9.1.jar
C:\Users\vkarn\.m2\repository\org\eclipse\jdt\core\compiler\ecj\4.4.2\ecj-4.4.2.jar
C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-standard-spec\1.2.5\taglibs-standard-spec-1.2.5.jar
C:\Users\vkarn\.m2\repository\org\apache\taglibs\taglibs-standard-impl\1.2.5\taglibs-standard-impl-1.2.5.jar


_______________________________________________
jetty-users mailing list
jetty-***@eclipse.org<mailto:jetty-***@eclipse.org>
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdev.eclipse.org%2Fmailman%2Flistinfo%2Fjetty-users&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706327215&sdata=pFWVSAuUVJd77T2ka30dXhUOOVx%2BUkJ7b35G9A3%2BFuE%3D&reserved=0>
--
Greg Wilkins <***@webtide.com<mailto:***@webtide.com>> CTO http://webtide.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwebtide.com&data=02%7C01%7Cvkarn%40ptc.com%7C081525aa4542459c8d1208d5e315b226%7Cb9921086ff774d0d828acb3381f678e2%7C0%7C1%7C636664604706337227&sdata=5m4GodcP5IFlGDSsvgrZZTJ2rkbx%2BjgwVxz09yYKUIc%3D&reserved=0>
Jan Bartel
2018-07-06 10:29:38 UTC
Permalink
Not sure if it's the cause of your problem but given the names of the jars
that contain the jstl libs (or the ones with "taglib" in them) don't match
the pattern you've specified for the containerincludejarpattern you should
fix that.
Jan
Post by Greg Wilkins
Hi,
I'm sorry but you've not well described your problem and giving us a lot
of code does not help at all.
I suggest that you start with one of the examples from 9.4 that provides a
sample JSP and then just change that to add in your JSPs and anything else
you need.
regards
Post by Karn, Vibhas
Hi All,
I am struggling with jetty Migration of 6.1 to latest or anything above
Jetty 9.1 . Currently I am trying with Jetty 9.4 which is latest.
I am able to compile the old code with the new one but there are few
issues with the migration which I am trying to fix. Yes its the tough job
but no option left.
I am currently focussing to render the old jsp pages after migrating it
to Jetty 9.4. Here is the sample code , I have mentioned the problem in the
post below. Help me with you suggestion or anything as I am struggling to
fix this issue since a week now.
public class JettyServer extends AbstractService implements IJettyServer,
IStatus {
public static final String SERVICE_NAME = "JettyServer"; //frozen
private static final Logger log =
Logger.getLogger(JettyServer.class.getName());
private static JettyServer instance = null;
private Server server;
// The map of service id to the jetty slave.
private final Map<Integer, IJettySlave> idToSlaveMap = new
HashMap<Integer, IJettySlave>();
// A linked list of the slaves.
private final List<IJettySlave> availableSlaves = new
LinkedList<IJettySlave>();
// TODO ref count availableAPIs.
private final Set<Class> availableAPIs = new HashSet<Class>();
// The map of service if to the slave status.
private final Map<Integer, IStatus> idToStatusMap = new
HashMap<Integer, IStatus>();
private final int registryPort;
private int maxWaitForSlave = 0;
/**
* Creates a new JettyServer using the default registry port from the
ServiceControllerConfig.
*/
public JettyServer() throws RemoteException {
this(ServiceControllerConfig.getInstance().getControlPort());
}
/**
* Creates a new JettyServer using the control port passed.
*/
public JettyServer(final int registryPort) throws RemoteException {
this.registryPort = registryPort;
instance = this;
}
@Override
public void initialize(final ServiceConfiguration genericConfig,
final Controller controller, final int serviceId,
final ServiceLock lock) throws Exception {
if (genericConfig instanceof JettyServerConfiguration) {
configuration = (JettyServerConfiguration) genericConfig;
} else {
configuration =
XmlConfigurable.createInstance(JettyServerConfiguration.class,
genericConfig.getXmlConfigElement());
}
server = new Server();
log.info("jetty version = " + Server.getVersion()); //frozen
maxWaitForSlave = getConfiguration().getMaxWaitForSlave();
final boolean debug = getConfiguration().getMortBayDebug();
log.info("Eclipse mortbay debug = '" + debug + "'"); //frozen
org.eclipse.jetty.util.log.Log.getLog().setDebugEnabled(debug);
// Configure http
final boolean httpEnabled = getConfiguration().getHttpEnabled();
if (httpEnabled) {
final int mainPort = getConfiguration().getHttpPort();
log.info("adding default connector on port '" + mainPort +
"'"); //frozen
//Re-writing the
code for jetty 9.3
// Setup HTTP Connector
HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");
// Establish the HTTP ServerConnector
ServerConnector httpConnector = new ServerConnector(server,
new HttpConnectionFactory(httpConf));
httpConnector.setPort(mainPort);
server.addConnector(httpConnector);
}
// Configure SSL
final boolean sslEnabled = getConfiguration().getSslEnabled();
if (sslEnabled) {
//Re-writing code for Jetty 9.3
final int mainPort = getConfiguration().getHttpPort(); //8580
final int sslPort = getConfiguration().getSslPort(); //8581
final String sslKeyStore =
getConfiguration().getSslKeyStore();
final String sslPassword =
getConfiguration().getSslPassword();
final String sslKeyPassword =
getConfiguration().getSslKeyPassword();
final String sslTrustPassword =
getConfiguration().getSslTrustPassword();
//Added for Jetty 9.3
final KeyStore trustKeyStore =
KeyStore.getInstance(getConfiguration().getSslKeyStore());
SslContextFactory theSSLFactory = new SslContextFactory();
theSSLFactory.setKeyStorePath(sslKeyStore);
theSSLFactory.setKeyManagerPassword(sslPassword);
theSSLFactory.setKeyStorePassword(sslKeyPassword);
theSSLFactory.setTrustStore(trustKeyStore);
theSSLFactory.setTrustStorePassword(sslTrustPassword);
// Setup HTTP Connector
HttpConfiguration httpConf = new HttpConfiguration();
httpConf.setSecurePort(mainPort);
httpConf.setSecureScheme("https");
// Setup HTTPS Configuration
HttpConfiguration httpsConf = new HttpConfiguration(httpConf);
httpsConf.addCustomizer(new SecureRequestCustomizer()); //
adds ssl info to request object
// Establish the HTTPS ServerConnector
ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(theSSLFactory, "http/1.1"),
new HttpConnectionFactory(httpsConf));
httpsConnector.setPort(sslPort);
log.info("adding ssl connector on port '" + sslPort + "'");
//frozen
server.addConnector(httpsConnector);
//}
}
// Check we had 1 connector else the server is useless
if (server.getConnectors().length == 0) {
throw new FileNotFoundException("No connectors registered.
Please see HttpEnable or SslEnable XML tags."); //frozen
}
// Configure the handlers
final HandlerCollection handlers = new HandlerCollection();
//4. Enabling the Annotation based configuration
org.eclipse.jetty.webapp.Configuration.ClassList classlist =
org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server);
classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration",
"org.eclipse.jetty.plus.webapp.EnvConfiguration",
"org.eclipse.jetty.plus.webapp.PlusConfiguration");
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");
getConfiguration().getWebAppContexts()) {
log.info("Adding WebAppContext " + webAppContext.getWar() +
" at " + webAppContext.getContextPath()); //frozen
webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
".*/[^/]*jstl.*\\.jar$");
handlers.addHandler(webAppContext);
}
final boolean accessLogEnabled =
getConfiguration().getLogEnabled();
if (accessLogEnabled) {
final RequestLogHandler requestLogHandler = new
RequestLogHandler();
final File logDir = ServiceUtilities.getLogDirectory();
if (!logDir.exists()) {
logDir.mkdirs();
}
final File logFile = new
File(getConfiguration().getLogFormat());
if (!logFile.getParentFile().exists()) {
logFile.getParentFile().mkdirs();
}
final NCSARequestLog requestLog = new
NCSARequestLog(getConfiguration().getLogFormat());
requestLog.setRetainDays(getConfiguration().getLogRetain());
requestLog.setAppend(getConfiguration().getLogAppend());
requestLog.setExtended(getConfiguration().getLogExtended());
requestLog.setLogTimeZone(getConfiguration().getLogTz());
requestLog.setLogLatency(getConfiguration().getLogLatency());
requestLogHandler.setRequestLog(requestLog);
handlers.addHandler(requestLogHandler);
}
handlers.addHandler(new DefaultHandler());
server.setHandler(handlers);
// server.setUserRealms(new UserRealm[] { new OSMUserRealm() });
// server.addBean(new LoginService[] { new OSMUserRealm() });
// HashLoginService loginService = new HashLoginService();
//loginService.setName("osmRealm");
//server.addBean(loginService);
// log.info("initialize...." + loginService.getName());
JettyServerInfo.install(server);
super.initialize(configuration, controller, serviceId, lock);
}
@Override
public JettyServerConfiguration getConfiguration() {
return (JettyServerConfiguration) super.getConfiguration();
}
@Override
public synchronized void stop() {
final Thread t = new Thread("JettyServer Stop Thread") { //frozen
@Override
public void run() {
try {
server.stop();
} catch (Exception ex) {
log.log(Level.SEVERE, "Failed to stop Jetty
server", ex); //frozen
}
}
};
t.start();
try {
t.join(500);
} catch (final InterruptedException ex) {
}
super.stop();
}
@Override
public synchronized void start() throws Exception {
log.info("start()"); //frozen
registerJetty();
server.start();
// finish startup which registers with the controller
super.start();
server.join(); //For Jetty 9.3 and above
// server.join(); need to uncomment and verify if jetty if we
need server.join in Jetty 9.3 as previous person don't have
log.info("After Jetty 9.3 Services starts..");
}
private void registerJetty() throws RemoteException,
AlreadyBoundException, AlreadyBoundException {
final Registry registry = LocateRegistry.getRegistry("127.0.0.1",
registryPort); //frozen
final Remote remote = UnicastRemoteObject.toStub(this);
log.info("Registering JettyServer"); //frozen
registry.rebind(IJettyServer.JETTYSERVER_NAME, remote);
}
@Override
public void unregister(final IJettySlave slave) throws
RemoteException {
log.info("unregister(" + slave.getName() + ") (ID=" +
slave.getServiceID() + ")"); //frozen
synchronized (idToSlaveMap) {
idToSlaveMap.remove(slave.getServiceID());
if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.remove(slave.getServiceID());
}
}
}
synchronized (availableSlaves) {
// Shouldnt really be in the list as teh BusyAPIDynamicProxy
shouldnt
// have re-added it on a shutdown.
if (availableSlaves.remove(slave)) {
availableSlaves.notifyAll();
}
}
}
@Override
public void register(final IJettySlave slave) throws RemoteException {
log.info("registered(" + slave.getName() + ") (ID=" +
slave.getServiceID() + ")"); //frozen
synchronized (idToSlaveMap) {
idToSlaveMap.put(slave.getServiceID(), slave);
if (slave instanceof IStatus) {
synchronized (idToStatusMap) {
idToStatusMap.put(slave.getServiceID(), (IStatus)
slave);
}
}
}
synchronized (availableSlaves) {
availableSlaves.add(slave);
availableSlaves.notifyAll();
}
synchronized (availableAPIs) {
availableAPIs.addAll(slave.getAPIs());
}
}
public static JettyServer getInstance() {
return instance;
}
public <I extends Remote> I get(final Class<I> i) throws
RemoteException {
return createApiProxy(i);
}
void push(final IJettySlave slave) {
synchronized (availableSlaves) {
availableSlaves.add(0, slave);
availableSlaves.notifyAll();
}
}
<I extends Remote> IJettySlave pop(final Class<I> i)
throws RemoteException {
if (idToSlaveMap.isEmpty()) {
throw new IllegalStateException("No JettySlaves available,
please check the server log files."); //frozen
}
if (availableAPIs.isEmpty()) {
throw new IllegalStateException("No JettySlave APIs
available, please check the server log files."); //frozen
}
synchronized (availableAPIs) {
// Check if any slave provides this API, as its pointless
waiting
// when we know an API will not be available.
// FYI : This should be removed if we provide auto startup of
slaves.
if (!availableAPIs.contains(i)) {
throw new RemoteException("API " + i.getName() + " is not
available."); //frozen
}
}
final long end = System.currentTimeMillis() + maxWaitForSlave;
while (System.currentTimeMillis() < end) {
synchronized (availableSlaves) {
// Get a service from any idle slave.
final Iterator<IJettySlave> it =
availableSlaves.iterator();
while (it.hasNext()) {
final IJettySlave slave = it.next();
try {
final I slaveApi = slave.get(i);
if (slaveApi != null) {
it.remove(); // remove this slave from list
return slave;
}
} catch (final RemoteException re) {
// this host doesnt work so remove it.
it.remove();
}
}
// now wait for a slave to become inactive
final long sleep = end - System.currentTimeMillis();
try {
if (sleep > 0) {
availableSlaves.wait(sleep);
}
} catch (final InterruptedException ex) {
}
}
}
throw new IllegalStateException("All APIs '" + i.getName() + "'
are busy or unavailable."); //frozen
}
/**
* Creates a proxy for the specific interface.
*/
@SuppressWarnings("unchecked")
private <I extends Remote> I createApiProxy(final Class<I> i)
throws RemoteException {
// Insert the busy dynamic proxy so we know which is busy
final I proxy = (I)
java.lang.reflect.Proxy.newProxyInstance(i.getClassLoader(), new Class[] {
i },
new BusyAPIDynamicProxy<I>(this, i));
return proxy;
}
public final Map<Integer, IStatus> getSlaveStatus()
throws RemoteException {
return new TreeMap<Integer, IStatus>(idToStatusMap);
}
public final IStatus getStatus() {
return this;
}
@Override
public long getUpTime() throws RemoteException {
final java.lang.management.RuntimeMXBean mx =
java.lang.management.ManagementFactory.getRuntimeMXBean();
return mx.getUptime() / 1000;
}
@Override
public long getTotalMemory() throws RemoteException {
return Runtime.getRuntime().totalMemory();
}
@Override
public long getFreeMemory() throws RemoteException {
return Runtime.getRuntime().freeMemory();
}
@Override
public long getMaxMemory() throws RemoteException {
return Runtime.getRuntime().maxMemory();
}
public static void main(final String[] args) throws Exception {
// jetty depends on the registry all the time.
LocateRegistry.createRegistry(ServiceControllerConfig.getInstance().getControlPort());
System.setProperty("service.id", "-1"); //frozen
runStandalone(SERVICE_NAME);
// jetty server depends on a slave working.
runStandalone("JettySlave1"); //frozen
}
}
/**
//oswm/rel20.10_Patches/WorkManager/src/com/osm/services/webservice/JettyServerConfiguration.java#1
$
* Last Modified: $Author: adminp4 $, $DateTime: 2018/03/28 14:59:10 $
*/
package com.osm.services.webservice;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.eclipse.jetty.webapp.WebAppContext;
import org.w3c.dom.Element;
import com.osm.services.configuration.ManagerServiceConfiguration;
public class JettyServerConfiguration extends ManagerServiceConfiguration {
private static final Logger log =
Logger.getLogger(JettyServerConfiguration.class.getName());
private static final String WAR_TAG = "War"; //frozen
private static final String MAX_WAIT_FOR_SLAVE_TAG =
"MaxWaitForSlave"; //frozen
private static final String MORTBAY_DEBUG_TAG = "MortBayDebug"; //frozen
private static final String HTTP_ENABLED_TAG = "HttpEnabled"; //frozen
private static final String HTTP_PORT_TAG = "HttpPort"; //frozen
private static final String NIO_ENABLED_TAG = "NioEnabled"; //frozen
// SSL specific
private static final String SSL_ENABLED_TAG = "SslEnabled"; //frozen
private static final String SSL_PORT_TAG = "SslPort"; //frozen
private static final String SSL_KEY_STORE_TAG = "SslKeyStore"; //frozen
private static final String SSL_PASSWORD_TAG = "SslPassword"; //frozen
private static final String SSL_KEY_PASSWORD_TAG = "SslKeyPassword";
//frozen
private static final String SSL_TRUST_PASSWORD_TAG =
"SslTrustPassword"; //frozen
// Log specific
private static final String ACCESS_LOG_FORMAT_TAG =
"AccessLogFormat"; //frozen
private static final String ACCESS_LOG_ENABLED_TAG =
"AccessLogEnabled"; //frozen
private static final String ACCESS_LOG_RETAIN_TAG =
"AccessLogRetainDays"; //frozen
private static final String ACCESS_LOG_APPEND_TAG =
"AccessLogAppend"; //frozen
private static final String ACCESS_LOG_EXTENDED_TAG =
"AccessLogExtended"; //frozen
private static final String ACCESS_LOG_LATENCY_TAG =
"AccessLogLatency"; //frozen
private static final String ACCESS_LOG_TZ_TAG = "AccessLogTimeZone";
//frozen
// Read values
private List<WebAppContext> warContexts = new
ArrayList<WebAppContext>();
private int maxWaitForSlaves;
private boolean mortBayDebug;
private boolean httpEnabled;
private int httpPort;
private boolean nioEnabled;
private boolean sslEnabled;
private int sslPort;
private String sslKeyStore;
private String sslPassword;
private String sslKeyPassword;
private String sslTrustPassword;
private boolean logEnabled;
private String logFormat;
private int logRetain;
private boolean logAppend;
private boolean logExtended;
private boolean logLatency;
private String logTz;
public JettyServerConfiguration() {
}
@Override
public void configure(final Element xmlConfigElement) {
super.configure(xmlConfigElement);
final List<Element> warElements = getChildren(WAR_TAG);
for (final Element warElement : warElements) {
final String context = warElement.getAttribute("context");
//frozen
final String location = warElement.getAttribute("location");
//frozen
if ((location != null) && !location.isEmpty()) {
// check file is valid
final File f = new File(location);
if (!f.exists()) {
log.warning("War location '" + f.getAbsolutePath() +
"' does not exists."); //frozen
}
final WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath(context);
webAppContext.setResourceBase(f.getAbsolutePath());
//added in 9.3
webAppContext.setWar(f.getAbsolutePath());
webAppContext.setExtractWAR(false);
warContexts.add(webAppContext);
log.info("Context Path-->" + context);
log.info("War location-->" + f.getAbsolutePath());
} else {
throw new IllegalStateException("War location must be
specified."); //frozen
}
}
maxWaitForSlaves = getChildValueAsInteger(MAX_WAIT_FOR_SLAVE_TAG,
4 * 60 * 1000);
mortBayDebug = getChildValueAsBoolean(MORTBAY_DEBUG_TAG, false);
httpEnabled = getChildValueAsBoolean(HTTP_ENABLED_TAG, true);
nioEnabled = getChildValueAsBoolean(NIO_ENABLED_TAG, false);
httpPort = getChildValueAsInteger(HTTP_PORT_TAG, 8580);
sslEnabled = getChildValueAsBoolean(SSL_ENABLED_TAG, false);
sslPort = getChildValueAsInteger(SSL_PORT_TAG, 8581);
sslKeyPassword = getChildValue(SSL_KEY_PASSWORD_TAG);
sslKeyStore = getChildValue(SSL_KEY_STORE_TAG);
sslPassword = getChildValue(SSL_PASSWORD_TAG);
sslTrustPassword = getChildValue(SSL_TRUST_PASSWORD_TAG);
logEnabled = getChildValueAsBoolean(ACCESS_LOG_ENABLED_TAG, true);
logFormat = getChildValue(ACCESS_LOG_FORMAT_TAG,
"logs/access_logs/yyyy_mm_dd.access.log"); //frozen
logRetain = getChildValueAsInteger(ACCESS_LOG_RETAIN_TAG, 90);
logAppend = getChildValueAsBoolean(ACCESS_LOG_APPEND_TAG, true);
logExtended = getChildValueAsBoolean(ACCESS_LOG_EXTENDED_TAG,
false);
logLatency = getChildValueAsBoolean(ACCESS_LOG_LATENCY_TAG, false);
logTz = getChildValue(ACCESS_LOG_TZ_TAG, "GMT"); //frozen
log.info("End of Configuration..");
}
public int getHttpPort() {
return httpPort;
}
public boolean getNioEnabled() {
return nioEnabled;
}
public boolean getHttpEnabled() {
return httpEnabled;
}
public List<WebAppContext> getWebAppContexts() {
return warContexts;
}
public int getMaxWaitForSlave() {
return maxWaitForSlaves;
}
public boolean getMortBayDebug() {
return mortBayDebug;
}
public boolean getSslEnabled() {
return sslEnabled;
}
public int getSslPort() {
return sslPort;
}
public String getSslKeyStore() {
return sslKeyStore;
}
public String getSslPassword() {
return sslPassword;
}
public String getSslKeyPassword() {
return sslKeyPassword;
}
public String getSslTrustPassword() {
return sslTrustPassword;
}
public boolean getLogEnabled() {
return logEnabled;
}
public String getLogFormat() {
return logFormat;
}
public int getLogRetain() {
return logRetain;
}
public boolean getLogAppend() {
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Loading...