I have a Java application written with Swing that uses a JxBrowser (jxbrowser-6.18).
We are loading a local url (http://localhost:8000/someLink.html) and then running some custom js on the browser.
At some point the following exceptions are thrown in the java code:
CERROR 2019-01-25 07:38:29,801 - Exception in thread "AWT-EventQueue-0"
CERROR 2019-01-25 07:38:29,801 - java.lang.IllegalStateException: Channel stream was closed before response has been received.
CERROR 2019-01-25 07:38:29,804 - at com.teamdev.jxbrowser.chromium.internal.ipc.SocketChannel.post(SourceFile:216)
CERROR 2019-01-25 07:38:29,804 - at com.teamdev.jxbrowser.chromium.internal.RenderChannelAccessor.post(SourceFile:67)
CERROR 2019-01-25 07:38:29,805 - at com.teamdev.jxbrowser.chromium.Browser.executeJavaScriptAndReturnValue(SourceFile:2134)
CERROR 2019-01-25 07:38:29,805 - at com.teamdev.jxbrowser.chromium.Browser.executeJavaScriptAndReturnValue(SourceFile:2077)
ERROR 2019-01-25 07:38:29,842 - Render channel is already closed.
java.lang.IllegalStateException: Render channel is already closed.
at com.teamdev.jxbrowser.chromium.internal.RenderChannelAccessor.a(SourceFile:72)
at com.teamdev.jxbrowser.chromium.internal.RenderChannelAccessor.post(SourceFile:66)
at com.teamdev.jxbrowser.chromium.Browser.executeJavaScriptAndReturnValue(SourceFile:2134)
at com.teamdev.jxbrowser.chromium.Browser.executeJavaScriptAndReturnValue(SourceFile:2077)
I've checked then the ipc log looking for events that occurred near 07:38:29
#creating browser
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.Server start
INFO: Shared Memory Name: TDB2-24864
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.SharedMemory <init>
INFO: IPC connection has been established. Connection ID: 13818240
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnHelloMessage{type=OnHello, uid=4, message='cid:0,bid:0,type:Browser', null
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.Server a
INFO: Channel has been accepted: SocketChannel{cid=0, bid=0, type=Browser}
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.IPC$b onChannelConnected
INFO: Channel is connected: SocketChannel{cid=0, bid=0, type=Browser}
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelWriter run
FINE: WRITE: LoadURLMessage{type=LoadURL, uid=9, url='about:blank', frameId=-1, extraHeaders='null', postData='null', SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnRenderViewCreatedMessage{type=OnRenderViewCreated, uid=5, renderProcessId=3, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnFrameCreatedMessage{type=OnFrameCreated, uid=6, parentFrameId=-1, frameId=2, isMainFrame=true, frameName='', SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.Server start
INFO: Shared Memory Name: TDB3-24864
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.SharedMemory <init>
INFO: IPC connection has been established. Connection ID: 13816000
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnHelloMessage{type=OnHello, uid=7, message='cid:0,bid:0,type:Render', null
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.Server a
INFO: Channel has been accepted: SocketChannel{cid=0, bid=0, type=Render}
Jan 25, 2019 7:36:50 AM com.teamdev.jxbrowser.chromium.internal.ipc.IPC$b onChannelConnected
INFO: Channel is connected: SocketChannel{cid=0, bid=0, type=Render}
#loading custom url, executing some javascript, ping messages...
#last messages with cid=0, bid=0 before 07:38:29
Jan 25, 2019 7:37:48 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelWriter run
FINE: WRITE: PingMessage{type=Ping, uid=420, alive=false, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:37:48 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: PingMessage{type=Ping, uid=420, alive=true, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:37:48 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelWriter run
FINE: WRITE: GetFrameIdMessage{type=GetFrameId, uid=422, frameId=-1, result=0, SocketInfo{cid=0, bid=0, channelType=Render}
[...]
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnRenderViewGoneMessage{type=OnRenderViewGone, uid=388, terminationStatus=6, errorCode=-536870904, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnFrameDeletedMessage{type=OnFrameDeleted, uid=389, parentFrameId=2, frameId=4, isMainFrame=false, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnFrameDeletedMessage{type=OnFrameDeleted, uid=390, parentFrameId=2, frameId=5, isMainFrame=false, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnFrameDeletedMessage{type=OnFrameDeleted, uid=391, parentFrameId=2, frameId=6, isMainFrame=false, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.MemoryChannelReader a
FINE: READ: OnFrameDeletedMessage{type=OnFrameDeleted, uid=392, parentFrameId=-1, frameId=2, isMainFrame=true, SocketInfo{cid=0, bid=0, channelType=Browser}
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.Server b
INFO: Channel has been disconnected: SocketChannel{cid=0, bid=0, type=Render}
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.IPC$b onChannelDisconnected
INFO: Channel is disconnected: SocketChannel{cid=0, bid=0, type=Render}
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.SharedMemory close
INFO: IPC connection has been closed. Connection ID: 13816000
Jan 25, 2019 7:38:29 AM com.teamdev.jxbrowser.chromium.internal.ipc.SharedMemory close
INFO: Pending IPC connections: 4
As we can see from the logs, the Render channel is closing at some point.
OnRenderViewGone - terminationStatus=6, errorCode=-536870904
If you have any ideas in which direction I should look or what does the error code or termination status mean - please tell. I searched for it on the internet but I couldn't find any useful info.
Note that I didn't manage to reproduce the issue, so if you have any ideas on how I could reproduce it, please do tell.
Update1: Here you can find the crash dump file: https://www.dropbox.com/s/yx86cfhj5rl2eye/chromium-renderer-2019-Jan-25-07-38-17.dmp
1) You will get this exception if you try to access Browser instance that is already disposed. For example, if you dispose a Browser instance using the Browser.dispose() method and then try to call its Browser.loadURL() method, you will get this IllegalStateException error message. Please make sure that in your Java code you don't use already disposed Browser instances. If you use the same Browser instance in different threads, then please make sure that you don't dispose it in one thread and use the already disposed Browser instance in another thread.
To check if the Browser instance is disposed or not, you can use the Browser.isDisposed() method.
2) Browser instance was unexpectedly disposed because of an issue in Chromium engine.
By default, on Windows platforms, when Chromium engine is crashed, JxBrowser generates jxbrowser-chromium.dmp crash dump file and stores it in the %localappdata%\JxBrowser\ directory (e.g. c:\users\\appdata\local\JxBrowser\jxbrowser-chromium.dmp).
Please check this location and share with me all the crash dump files you see using one of the online file sharing services such as Google Drive, Dropbox, etc. Take a look at the tutorials that describe how to get the crash dump files on different platforms.
3) As I can see you are using JxBrowser 6.18 version. I recommend you to update the library to the 6.22.2 as the latest version includes a lot of new features, an updated Chromium engine and plenty of stability fixes, including fixes when connection with the rendering process is lost.
I have a simple hello world application with embedded tomcat v.8.5.28
It works fine when I explicitly add servlet and mapping:
public static void main(String[] args) throws Exception {
Tomcat server = new Tomcat();
server.setPort(8080);
Context context = server.addContext("", Paths.get(".").toAbsolutePath().toString());
Tomcat.addServlet(context, "hello", new HelloServlet());
context.addServletMappingDecoded("/", "hello");
server.start();
server.getServer().await();
}
But if I delete addServlet and addServletMappingDecoded and annotate my servlet with #WebServlet(name = "HelloServlet", urlPatterns = "/hello") it doesn't work. http://localhost:8080/hello/ returns HTTP Status 404 – Not Found
I have this files hierarchy:
And this is file hierarchy in jar:
I have this output when trying to start my app
>java -jar servlet-app-1.0-SNAPSHOT-jar-with-dependencies.jar
Mar 09, 2018 3:57:36 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Mar 09, 2018 3:57:36 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 09, 2018 3:57:36 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Mar 09, 2018 3:57:36 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.28
Mar 09, 2018 3:57:36 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Mar 09, 2018 3:57:36 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 09, 2018 3:57:36 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
What paths should I pass to addWebapp so tomcat can find my web.xml?
Whenever I am going to run my project I am getting this error frequently.please let me know what is the reason behind it.serverstartup in 1680.I googled a lot but not getting any solution of it.I created a new workspace also but getting this same problem.
Dec 22, 2012 11:35:31 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: C:\Program Files\Java
\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java
/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib
/i386;c:\program files\dell\dw wlan card;C:\Windows\system32;C:\Windows;C:\Windows
\system32\wbem;C:\Windows\system32\windowspowershell\v1.0\;c:\program files\java
\jdk1.6.0_25\bin;c:\program files\ibm\gsk8\lib;C:\Program Files\Microsoft SQL
Server\100\Tools\Binn\;C: \Program Files\Microsoft SQL Server\100\DTS\Binn
\;B:\eclipse;;.
Dec 22, 2012 11:35:31 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property
'source' to 'org.eclipse.jst.jee.server:RESTfulProject' did not find a matching property.
Dec 22, 2012 11:35:31 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 22, 2012 11:35:31 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 22, 2012 11:35:31 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 742 ms
Dec 22, 2012 11:35:31 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 22, 2012 11:35:31 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.8
Dec 22, 2012 11:35:31 AM com.sun.jersey.api.core.ClasspathResourceConfig init
INFO: Scanning for root resource and provider classes in the paths:
B:\XYRAD\XyRadwebservicesMoon\.metadata\.plugins\org.eclipse.wst.server.core
\tmp6\wtpwebapps\RESTfulProject\WEB-INF\lib
B:\XYRAD\XyRadwebservicesMoon\.metadata\.plugins\org.eclipse.wst.server.core
\tmp6\wtpwebapps\RESTfulProject\WEB-INF\classes
Dec 22, 2012 11:35:32 AM com.sun.jersey.api.core.ClasspathResourceConfig init
INFO: Root resource classes found:
class webService.FeedService
Dec 22, 2012 11:35:32 AM com.sun.jersey.api.core.ClasspathResourceConfig init
INFO: Provider classes found:
Dec 22, 2012 11:35:33 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 22, 2012 11:35:33 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 22, 2012 11:35:33 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1680 ms
I use SpringSource Tool Suite sts to start a hello world example about MVC.
File -> New -> Spring Template Project -> then choose Spring MVC Project
I add Project Name: helloworld
and specify the top-level package as com.helloworld.myapp
then finish.
now I try to run the application and choose Run on Server
and it always shows me the everlasting screen that says: The requested resource (/helloworld/) is not available.
server shows the following:
Nov 30, 2011 4:06:53 PM com.springsource.tcserver.security.PropertyDecoder <init> INFO: tc
Runtime property decoder using memory-based key Nov 30, 2011 4:06:53
PM com.springsource.tcserver.security.PropertyDecoder INFO:
tcServer Runtime property decoder has been initialized in 183 ms Nov
30, 2011 4:06:53 PM org.apache.coyote.AbstractProtocol init INFO:
Initializing ProtocolHandler ["http-bio-8080"] Nov 30, 2011 4:06:53 PM
com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
INFO: Started up JMX registry on 127.0.0.1:6969 in 63 ms Nov 30, 2011
4:06:53 PM org.apache.catalina.startup.Catalina load INFO:
Initialization processed in 693 ms Nov 30, 2011 4:06:53 PM
org.apache.catalina.core.StandardService startInternal INFO: Starting
service Catalina Nov 30, 2011 4:06:53 PM
org.apache.catalina.core.StandardEngine startInternal INFO: Starting
Servlet Engine: VMware vFabric tc Runtime
2.6.1.RELEASE/7.0.20.B.RELEASE Nov 30, 2011 4:06:53 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor insight.xml from
D:\springsource\vfabric-tc-server-developer-2.6.1.RELEASE\spring-insight-instance\conf\Catalina\localhost
Nov 30, 2011 4:06:53 PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|insight] will not be woven Nov 30, 2011
4:06:54 PM org.apache.catalina.core.ApplicationContext log INFO:
Initializing Spring root WebApplicationContext Nov 30, 2011 4:07:04 PM
org.apache.catalina.core.ApplicationContext log INFO: Initializing
Spring FrameworkServlet 'Spring MVC Dispatcher Servlet' Nov 30, 2011
4:07:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager Nov 30, 2011 4:07:06
PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|manager] will not be woven Nov 30, 2011
4:07:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT Nov 30, 2011 4:07:06 PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|ROOT] will not be woven Nov 30, 2011
4:07:06 PM org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["http-bio-8080"] Nov 30, 2011 4:07:06 PM
org.apache.catalina.startup.Catalina start INFO: Server startup in
12820 ms Nov 30, 2011 4:07:56 PM
org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor EchoSpringMVC.xml from
D:\springsource\vfabric-tc-server-developer-2.6.1.RELEASE\spring-insight-instance\conf\Catalina\localhost
Nov 30, 2011 4:07:56 PM
org.apache.catalina.startup.SetContextPropertiesRule begin WARNING:
[SetContextPropertiesRule]{Context} Setting property 'source' to
'org.eclipse.jst.jee.server:EchoSpringMVC' did not find a matching
property. Nov 30, 2011 4:07:56 PM
com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader
start INFO: Context [localhost|EchoSpringMVC] will not be woven Nov
30, 2011 4:07:56 PM org.apache.catalina.core.StandardContext
listenerStart SEVERE: Exception sending context initialized event to
listener instance of class
org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/log4j/Level at
org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at
org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:191)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at
org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at
org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722) Caused by:
java.lang.ClassNotFoundException: org.apache.log4j.Level at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
... 18 more
Nov 30, 2011 4:07:56 PM org.apache.catalina.core.StandardContext
startInternal SEVERE: Error listenerStart Nov 30, 2011 4:07:56 PM
org.apache.catalina.core.StandardContext startInternal SEVERE: Context
[/EchoSpringMVC] startup failed due to previous errors Nov 30, 2011
4:07:56 PM org.apache.catalina.core.ApplicationContext log INFO:
Closing Spring root WebApplicationContext Nov 30, 2011 4:07:56 PM
org.apache.catalina.core.StandardContext listenerStop SEVERE:
Exception sending context destroyed event to listener instance of
class org.springframework.web.context.ContextLoaderListener
java.lang.ExceptionInInitializerError at
org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80)
at
org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4763)
at
org.apache.catalina.core.StandardContext$4.run(StandardContext.java:5473)
at java.lang.Thread.run(Thread.java:722) Caused by:
java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be
successfully initialized. See also
http://www.slf4j.org/codes.html#unsuccessfulInit at
org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:282) at
org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at
org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
at
org.springframework.web.context.ContextCleanupListener.(ContextCleanupListener.java:43)
... 4 more
Where do I go wrong?
Please help.
I've solved changing log4j 1.2.15 with 1.2.16 in pom.xml
New dependency look like this
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
That's all
It looks like you are having this exception:
https://issuetracker.springsource.com/browse/STS-2128
Your code will run fine. This is a caching problem with WTP (Web Tools Project). A clean build should remove the error.