I'm facing a wrong behavior using ScheduledExecutorService due a restart mechanism implemented.
Problem - Short
Each restart attempt is creating a new Scheduled task and restarting the old ones.
Problem - Long
The process goal is to publish a message into RabbitMQ from time to time ( it's keep-alive ). When an exception occurs with RabbitMQ, it uses the ExceptionObserver to notify
that an exception occurred. The ExceptionObserver implemented stops the service and restart it again. It attemp to restart 3 times, if it was restart succesfully, the count is
reseted to zero. If it couldn't restart, the attempt count is incremented and if it reaches the attempt limit, it will shutdown the process.
Each time the service is restarted, it creates a new "KeepAliveService" and restarts the last service. So, each time an exception occours, a new service is created and the old
service is restarted. If 1 exception occours after restart there are 2 process running. If 2 exception occours there are 3 process running, and so on.
The service class which handles the keep-alive service ( start/stop ScheduledExecutorService )
private KeepaliveExecutor keepaliveExecutor; // This is the runnable used inside the scheduledService
private ScheduledFuture futureTask; // The escheduled task
private ScheduledExecutorService scheduledService; // the scheduled service
private ExceptionObserver exceptionObserver; // The Exception Handler, which will handle the exceptions
public void startService( final int keepaliveTime ) throws IllegalArgumentException, FInfraException {
keepaliveExecutor = new KeepaliveExecutor( new RabbitMQService( settings ), settings );
keepaliveExecutor.setExceptionObserver( exceptionObserver );
scheduledService = Executors.newSingleThreadScheduledExecutor();
futureTask = scheduledService.scheduleAtFixedRate( keepaliveExecutor, 0, keepaliveTime, TimeUnit.MINUTES );
}
public void stopService() {
futureTask.cancel(true);
scheduledService.shutdown();
}
The KeepaliveExecutor class
class KeepaliveExecutor implements Runnable {
private FInfraExceptionObserver exceptionObserver;
#Override
public void run() {
try {
final String keepAlive = JsonMapper.toJsonString( keepaliveMessage );
rabbitService.publishMessage( keepAlive );
keepaliveMessage.setFirtsPackage( false );
} catch( FInfraException ex ) {
if( exceptionObserver != null ) {
exceptionObserver.notifyExpcetion(ex);
}
}
}
The ExceptionObserver implementation class
public class FInfraExceptionHandler implements FInfraExceptionObserver {
private final FInfraServiceHandler finfraHandler;
public FInfraExceptionHandler(FInfraServiceHandler finfraHandler) {
this.finfraHandler = finfraHandler;
}
#Override
public void notifyExpcetion(Throwable ex) {
Util.logger.log( Level.INFO, "F-Infra Exception occurred", ex);
finfraHandler.stopService();
Util.logger.log( Level.INFO, "Waiting 30s for restarting..." );
Util.wait( 30, TimeUnit.SECONDS );
finfraHandler.startService();
}
The FInfraServiceHandler class
public class FInfraServiceHandler {
private static final int ATTEMPT_LIMIT = 3;
private FInfraService finfraService;
private int keepaliveTime;
private int attempt;
public FInfraServiceHandler() {
this.finfraService = new FInfraService();
this.finfraService.setExceptionObserver(new FInfraExceptionHandler( this ));
this.attempt = 0;
}
void startService(){
if( attempt <= ATTEMPT_LIMIT ) {
try {
attempt++;
Util.logger.log(Level.INFO, "Starting F-Infra Service. Attemp[{0} of {1}]", new String[]{String.valueOf(attempt), String.valueOf(ATTEMPT_LIMIT)});
finfraService.startService( keepaliveTime );
} catch( FInfraException | RuntimeException ex ){
Util.logger.log(Level.INFO, "F-INFRA EXCEPTION", ex);
startService();
}
Util.logger.log( Level.INFO, "F-Infra started!");
attempt = 0;
return;
}
Util.logger.log( Level.INFO, "Restart attemp limit reached." );
Main.closeAll(new ShutdownException("It's not possible stablish a connection with F-Infra Service."));
}
public void stopService() {
if( attempt > 0 ){
Util.logger.log(Level.INFO, "Stpoping F-Infra...");
finfraService.stopService();
}
}
And here follows the log which tells me there are more than one service running
jul 16, 2017 2:58:03 PM domain.FInfraServiceHandler startService
INFO: Starting F-Infra Service. Attemp[1 of 3]
jul 16, 2017 2:58:03 PM domain.FInfraServiceHandler startService
INFO: F-Infra started!
jul 16, 2017 5:01:15 PM domain.FInfraExceptionHandler notifyExpcetion
INFO: F-Infra Exception occurred
domain.FInfraException: java.net.UnknownHostException: rabbit.domain
at domain.RabbitMQService.openConnection(RabbitMQService.java:48)
at domain.RabbitMQService.publishMessage(RabbitMQService.java:66)
at domain.KeepaliveExecutor.run(KeepaliveExecutor.java:38)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: rabbit.domain
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:34)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:91)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:670)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:722)
at domain.RabbitMQService.openConnection(RabbitMQService.java:45)
... 9 more
jul 16, 2017 5:01:15 PM domain.FInfraExceptionHandler notifyExpcetion
INFO: Waiting 30s for restarting...
jul 16, 2017 5:01:45 PM domain.FInfraServiceHandler startService
INFO: Starting F-Infra Service. Attemp[1 of 3]
jul 16, 2017 5:01:45 PM domain.FInfraServiceHandler startService
INFO: F-Infra started!
jul 16, 2017 6:01:58 PM domain.FInfraExceptionHandler notifyExpcetion
INFO: F-Infra Exception occurred
domain.FInfraException: java.net.UnknownHostException: rabbit.domain
at domain.RabbitMQService.openConnection(RabbitMQService.java:48)
at domain.RabbitMQService.publishMessage(RabbitMQService.java:66)
at domain.KeepaliveExecutor.run(KeepaliveExecutor.java:38)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: rabbit.domain
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:34)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:91)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:670)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:722)
at domain.RabbitMQService.openConnection(RabbitMQService.java:45)
... 9 more
jul 16, 2017 6:01:58 PM domain.FInfraExceptionHandler notifyExpcetion
INFO: Waiting 30s for restarting...
jul 16, 2017 6:02:03 PM domain.FInfraExceptionHandler notifyExpcetion
INFO: F-Infra Exception occurred
domain.FInfraException: java.net.UnknownHostException: rabbit.domain
at domain.RabbitMQService.openConnection(RabbitMQService.java:48)
at domain.RabbitMQService.publishMessage(RabbitMQService.java:66)
at domain.KeepaliveExecutor.run(KeepaliveExecutor.java:38)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: rabbit.domain
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:34)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:91)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:670)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:722)
at domain.RabbitMQService.openConnection(RabbitMQService.java:45)
... 9 more
jul 16, 2017 6:02:03 PM domain.FInfraExceptionHandler notifyExpcetion
INFO: Waiting 30s for restarting...
jul 16, 2017 6:02:28 PM domain.FInfraServiceHandler startService
INFO: Starting F-Infra Service. Attemp[1 of 3]
jul 16, 2017 6:02:28 PM domain.FInfraServiceHandler startService
INFO: F-Infra started!
jul 16, 2017 6:02:33 PM domain.FInfraServiceHandler startService
INFO: Starting F-Infra Service. Attemp[1 of 3]
jul 16, 2017 6:02:33 PM domain.FInfraServiceHandler startService
INFO: F-Infra started!
I don't know what to do to close the old Thread or use the current one to restart. What I tried wast calling Thread.currentThread().interrupt(); on the ExceptionObserver class before calling start method.
But that doesn't works.
I have no idea in what to do.
In the FInfraServiceHandler class, your stopService method does not do anything if attempt is zero.
public void stopService() {
if( attempt > 0 ){
Util.logger.log(Level.INFO, "Stpoping F-Infra...");
finfraService.stopService();
}
}
So the original ScheduledExecutorService keeps going. When I removed the condition, the code behaved fine.
Note, by the way, that you call startService and stopService on the same instance, from different threads. I think you'll need some sort of synchronization on the mutable field attempt.
Related
I don't have much experience with Java and I need a little help with the following issue.
I’m trying to make a Birt Java Servlet in order to generate PDF files based on a given input (XML in this case). I’m using Tomcat 7.0 for that I was able to create blank PDF files with this code (I’ve commented out a lot of lines in order to get Tomcat started).
public class Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* #see HttpServlet#HttpServlet()
*/
public Servlet() {
super();
// TODO Auto-generated constructor stub
}
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//get report name and launch the engine
resp.setContentType( "application/pdf" );
resp.setHeader ("Content-Disposition","inline; filename=test.pdf");
String reportName = req.getParameter("ReportName");
ServletContext sc = req.getSession().getServletContext();
}
/**
* #see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}}
But when I try with the complete code that is:
public class Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* #see HttpServlet#HttpServlet()
*/
private IReportEngine birtReportEngine = null;
protected static Logger logger = Logger.getLogger( "org.eclipse.birt" );
public Servlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* #see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//get report name and launch the engine
resp.setContentType( "application/pdf" );
resp.setHeader ("Content-Disposition","inline; filename=test.pdf");
String reportName = req.getParameter("ReportName");
ServletContext sc = req.getSession().getServletContext();
this.birtReportEngine = BirtEngine.getBirtEngine(sc);
IReportRunnable design;
try
{
//Open report design
design = birtReportEngine.openReportDesign( sc.getRealPath("/Reports")+"/"+reportName );
//create task to run and render report
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design );
task.getAppContext().put("BIRT_VIEWER_HTTPSERVLET_REQUEST", req );
PDFRenderOption options = new PDFRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
options.setOutputStream(resp.getOutputStream());
task.setRenderOption(options);
//run report
task.run();
task.close();
}catch (Exception e){
e.printStackTrace();
throw new ServletException( e );
}
}
/**
* #see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}}
the Tomcat Server (Version 7.0) doesn’t start anymore and the following info is logged to the console:
Nov 17, 2017 11:09:44 AM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test_servlet]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1239)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1700)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1690)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test_servlet]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
... 6 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/birt/report/engine/api/IRenderOption
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:270)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:139)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:417)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:891)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5519)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.birt.report.engine.api.IRenderOption
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
... 20 more
Nov 17, 2017 11:09:44 AM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1239)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:758)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:694)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1700)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1690)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1247)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 6 more
Nov 17, 2017 11:09:44 AM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.startup.Catalina.start(Catalina.java:694)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:758)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:444)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1247)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 11 more
Nov 17, 2017 11:09:44 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Nov 17, 2017 11:09:44 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Nov 17, 2017 11:09:44 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Nov 17, 2017 11:09:44 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Nov 17, 2017 11:09:44 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Any help or example of a working Birt servlet would be apreciated.
Thanks in advance!
driver.get() throws org.openqa.selenium.WebDriverException after launching the URL.
My URL is in the following format- https://qa-abc.google.abc.com
It works fine for any other URL but when I change the data to the above mentioned URL, driver.get() launches the URL and then throws exception.
I am using Gecko Driver. Also I am able to launch the URL directly.
Any solutions?
**Code**
public static void InvokeApp(String browser, String url) {
try {
if(browser.equalsIgnoreCase("firefox")){
System.setProperty("webdriver.gecko.driver",
"D:\\geckodriver.exe");
driver = new FirefoxDriver();
//driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get(url);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void VerifyTitle(String title){
try{
if (driver.getTitle().equalsIgnoreCase(title)){
Reporter.reportStep("Page is successfully loaded :"+title, "PASS");
}else
Reporter.reportStep("Page Title :"+driver.getTitle()+" did not match with :"+title, "FAIL");
}catch (Exception e) {
e.printStackTrace();
Reporter.reportStep("The title did not match", "FAIL");
}
}
**Exception Details-**
1499170417435 geckodriver INFO Listening on 127.0.0.1:47524
1499170418556 geckodriver::marionette INFO Starting browser C:\Program
Files\Mozilla Firefox\firefox.exe with args ["-marionette"]
1499170422668 Marionette INFO Listening on port 51988
Jul 04, 2017 5:43:43 PM org.openqa.selenium.remote.ProtocolHandshake
createSession
INFO: Detected dialect: W3C
org.openqa.selenium.WebDriverException:
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities
Session ID: 84657932-4128-4bfb-babd-56a2ba0eb399
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:364)
at appModule.ReusableActions.InvokeApp(ReusableActions.java:76)
at utility.OpentapWrappers.beforeMethod(OpentapWrappers.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:590)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:756)
at org.testng.TestRunner.run(TestRunner.java:610)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
1499170483235 addons.productaddons WARN Failed downloading XML, status: 0, reason: error
1499170483704 addons.productaddons WARN Failed downloading via XHR, status: 0, reason: error
PostMethod post = new PostMethod(strURL);
try {
post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), input.length()));
post.setRequestHeader("Content-type","text/xml; charset=ISO-8859-1");
HttpClient httpclient = new HttpClient();
HostConfiguration config = httpclient.getHostConfiguration();
config.setProxy("zz.zz.zz.zz", 1111);
String username = "username";
String password = "password";
Credentials credentials = new UsernamePasswordCredentials(username, password);
AuthScope authScope = new AuthScope("zz.zz.zz.zz", 1111);
httpclient.getState().setProxyCredentials(authScope, credentials);
int result = httpclient.executeMethod(post);
The above code works fine when I am outside client network. Could someone please check if anything wrong in the code
Dec 29, 2015 2:34:26 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
Dec 29, 2015 2:34:26 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: Retrying request
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
I'm new in integrating Rapid miner in Java applications and currently i'm having an exception in the rapidminer.init(). As far as i can understand its because od the repositories. But i don't know what to do. I did some research but i still cant resolve my problem. The exception is:
Dez 17, 2013 5:26:39 PM com.rapidminer.tools.ParameterService init
INFO: Reading configuration resource com/rapidminer/resources/rapidminerrc.
Dec 17, 2013 5:26:39 PM com.rapidminer.tools.I18N <clinit>
INFO: Set locale to en.
Dec 17, 2013 5:26:39 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
INFO: Property rapidminer.home is not set. Guessing.
Dec 17, 2013 5:26:39 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
INFO: Trying parent directory of 'C:\Documents and Settings\Geral\workspace\LinkMiningModule\Resources\RM5.3\launcher.jar'...gotcha!
Dec 17, 2013 5:26:39 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
INFO: Trying parent directory of 'C:\Documents and Settings\Geral\workspace\LinkMiningModule\Resources\RM5.3\rapidminer.jar'...gotcha!
Dec 17, 2013 5:26:39 PM com.rapidminer.repository.RepositoryManager load
INFO: Cannot access file system in execution mode UNKNOWN. Not loading repositories.
Exception in thread "main" java.lang.NoClassDefFoundError: com/vlsolutions/swing/docking/ui/DockingUISettings
at com.rapidminer.tools.plugin.Plugin.initAll(Plugin.java:945)
at com.rapidminer.RapidMiner.init(RapidMiner.java:550)
at DataMinning.RapidMinnerInteraction.<init>(RapidMinnerInteraction.java:26)
at dataBaseHandling.GatheringInformationFromDB.<init>(GatheringInformationFromDB.java:61)
at General.InitializeEverything.<init>(InitializeEverything.java:22)
at General.Main.main(Main.java:12)
Caused by: java.lang.ClassNotFoundException: com.vlsolutions.swing.docking.ui.DockingUISettings
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more
My code is very simple:
public RapidMinnerInteraction()
{
RapidMinerCommandLine.init();
Process process = null;
try {
process = new Process(new File("NeuralNetwork/NeuralNetworkProcess.rmp"));
try {
process.run();
} catch (OperatorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (XMLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
Any help would be awesome
Kind regards
From the exception it looks like you missed to add at least the vldocking.jar file to your classpath, possibly others are missing too.
as In topic my war is running without errors on Jetty / Tomcat but when I deploy it to the Resin 4
It shows as running / active in the deployed applications tab on the resin-admin panel. Nothing unusual in the logs as well.
But when I try to access myapp I am getting 404
Aug 14, 2013 9:20:25 AM com.caucho.server.cluster.Server start
INFO: resin.conf = null
Aug 14, 2013 9:20:25 AM com.caucho.server.cluster.Server start
INFO:
Aug 14, 2013 9:20:25 AM com.caucho.lifecycle.Lifecycle toActive
INFO: Host[] active
Aug 14, 2013 9:20:25 AM com.caucho.server.port.Port bind
INFO: http listening to *:8080
Aug 14, 2013 9:20:25 AM com.caucho.lifecycle.Lifecycle toActive
INFO: Server[id=,cluster=] active
Aug 14, 2013 9:20:25 AM com.caucho.server.resin.Resin start
INFO: Resin started in 2804ms
Aug 14, 2013 9:20:25 AM com.caucho.lifecycle.Lifecycle toStopping
INFO: Host[] stopping
Aug 14, 2013 9:20:25 AM com.caucho.lifecycle.Lifecycle toActive
INFO: Host[] active
Aug 14, 2013 9:20:26 AM com.caucho.lifecycle.Lifecycle toActive
INFO: WebApp[http://localhost:8080/myapp] active
web 3.0 app initializer
import com.opensymphony.sitemesh.webapp.SiteMeshFilter;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import javax.servlet.Filter;
#Order(1)
public class AppWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
#Override
protected Class<?>[] getRootConfigClasses() {
return new Class[]{RootConfiguration.class};
}
#Override
protected Class<?>[] getServletConfigClasses() {
return new Class[]{WebConfiguration.class};
}
#Override
protected String[] getServletMappings() {
return new String[]{"/"};
}
#Override
protected Filter[] getServletFilters() {
return new Filter[] { new SiteMeshFilter() };
}