Improve error messages for failed starts
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
c17bcc7db8
commit
c5f9faa479
|
@ -31,6 +31,7 @@ import java.net.ConnectException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -187,18 +188,30 @@ public class Main
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invokeMain(ClassLoader classloader, StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException, IOException
|
public void invokeMain(ClassLoader classloader, StartArgs args) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException
|
||||||
{
|
{
|
||||||
|
if (args.getEnabledModules().isEmpty())
|
||||||
|
{
|
||||||
|
if (Files.exists(getBaseHome().getBasePath("start.jar")))
|
||||||
|
StartLog.error("Do not start with ${jetty.base} == ${jetty.home}!");
|
||||||
|
else
|
||||||
|
StartLog.error("No enabled jetty modules found!");
|
||||||
|
StartLog.info("${jetty.home} = " + getBaseHome().getHomePath());
|
||||||
|
StartLog.info("${jetty.base} = " + getBaseHome().getBasePath());
|
||||||
|
StartLog.error("Please create and/or configure a ${jetty.base} directory.");
|
||||||
|
usageExit(ERR_INVOKE_MAIN);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Class<?> invokedClass = null;
|
Class<?> invokedClass = null;
|
||||||
String mainclass = args.getMainClassname();
|
String mainclass = args.getMainClassname();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
invokedClass = classloader.loadClass(mainclass);
|
invokedClass = classloader.loadClass(mainclass);
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e)
|
catch (ClassNotFoundException e)
|
||||||
{
|
{
|
||||||
StartLog.error("Nothing to start, exiting ...");
|
StartLog.error("Unable to find: " + mainclass);
|
||||||
StartLog.debug(e);
|
StartLog.debug(e);
|
||||||
usageExit(ERR_INVOKE_MAIN);
|
usageExit(ERR_INVOKE_MAIN);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue