I Installed Docker, Docker Compose and then Jenkins on CentOS 8. Seems Jenkins is installed correctly. However I could see the message Jenkins appears to be offline and get an exception as mentioned below. I changed the URL https://updates.jenkins.io/update-center.json in hudson.model.UpdateCenter.xml from https to http. Still the exception reappears. Plugins are not getting upgraded.
Any help on this is appreciated. Thanks.
Exception:
$: docker logs -f jenkins
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2020-05-16 07:08:57.939+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized #4453ms to org.eclipse.jetty.util.log.JavaUtilLog
2020-05-16 07:09:02.052+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file
2020-05-16 07:09:04.197+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2020-05-16 07:09:04.990+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.27.v20200227; built: 2020-02-27T18:37:21.340Z; git: a304fd9f351f337e7c0e2a7c28878dd536149c6c; jvm 1.8.0_242-b08
2020-05-16 07:09:12.128+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2020-05-16 07:09:12.439+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2020-05-16 07:09:12.439+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2020-05-16 07:09:12.476+0000 [id=1] INFO o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 600000ms
2020-05-16 07:09:14.143+0000 [id=1] INFO hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2020-05-16 07:09:14.794+0000 [id=1] INFO o.e.j.s.handler.ContextHandler#doStart: Started w.#2235eaab{Jenkins v2.237,/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
2020-05-16 07:09:14.871+0000 [id=1] INFO o.e.j.server.AbstractConnector#doStart: Started ServerConnector#5315b42e{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2020-05-16 07:09:14.872+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: Started #21390ms
2020-05-16 07:09:14.881+0000 [id=20] INFO winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2020-05-16 07:09:18.067+0000 [id=26] INFO jenkins.InitReactorRunner$1#onAttained: Started initialization
2020-05-16 07:09:18.316+0000 [id=25] INFO jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2020-05-16 07:09:22.668+0000 [id=26] INFO jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2020-05-16 07:09:22.694+0000 [id=26] INFO jenkins.InitReactorRunner$1#onAttained: Started all plugins
2020-05-16 07:09:22.881+0000 [id=25] INFO jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2020-05-16 07:09:24.037+0000 [id=25] INFO jenkins.InitReactorRunner$1#onAttained: System config loaded
2020-05-16 07:09:24.037+0000 [id=25] INFO jenkins.InitReactorRunner$1#onAttained: System config adapted
2020-05-16 07:09:24.037+0000 [id=25] INFO jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2020-05-16 07:09:24.038+0000 [id=26] INFO jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2020-05-16 07:09:24.194+0000 [id=39] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata
2020-05-16 07:09:24.255+0000 [id=39] INFO hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2020-05-16 07:09:27.052+0000 [id=25] INFO o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext#6069d6b7: display name [Root WebApplicationContext]; startup date [Sat May 16 07:09:27 UTC 2020]; root of context hierarchy
2020-05-16 07:09:27.053+0000 [id=25] INFO o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext#6069d6b7]: org.springframework.beans.factory.support.DefaultListableBeanFactory#6481ce76
2020-05-16 07:09:27.084+0000 [id=25] INFO o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#6481ce76: defining beans [authenticationManager]; root of factory hierarchy
2020-05-16 07:09:27.739+0000 [id=25] INFO o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext#3b4860bb: display name [Root WebApplicationContext]; startup date [Sat May 16 07:09:27 UTC 2020]; root of context hierarchy
2020-05-16 07:09:27.739+0000 [id=25] INFO o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext#3b4860bb]: org.springframework.beans.factory.support.DefaultListableBeanFactory#5c405df3
2020-05-16 07:09:27.747+0000 [id=25] INFO o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#5c405df3: defining beans [filter,legacy]; root of factory hierarchy
2020-05-16 07:09:27.955+0000 [id=25] INFO jenkins.InitReactorRunner$1#onAttained: Completed initialization
2020-05-16 07:09:28.492+0000 [id=19] INFO hudson.WebAppMain$3#run: Jenkins is fully up and running
***2020-05-16 07:09:44.531+0000 [id=39] INFO hudson.util.Retrier#start: The attempt #1 to do the action check updates server failed with an allowed exception:
java.net.UnknownHostException: updates.jenkins.io***
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1226)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:990)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at hudson.model.DownloadService.loadJSON(DownloadService.java:114)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:212)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:207)
at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1767)
at hudson.util.Retrier.start(Retrier.java:63)
at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1738)
at jenkins.DailyCheck.execute(DailyCheck.java:93)
at hudson.model.AsyncPeriodicWork.lambda$doRun$0(AsyncPeriodicWork.java:100)
at java.lang.Thread.run(Thread.java:748)
2020-05-16 07:09:44.536+0000 [id=39] INFO hudson.util.Retrier#start: Calling the listener of the allowed exception 'updates.jenkins.io' at the attempt #1 to do the action check updates server
2020-05-16 07:09:44.544+0000 [id=39] INFO hudson.util.Retrier#start: Attempted the action check updates server for 1 time(s) with no success
2020-05-16 07:09:44.547+0000 [id=39] SEVERE hudson.PluginManager#doCheckUpdatesServer: Error checking update sites for 1 attempt(s). Last exception was: UnknownHostException: updates.jenkins.io
2020-05-16 07:09:44.566+0000 [id=39] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 20,358 ms
2020-05-16 07:10:31.488+0000 [id=56] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Periodic background build discarder
2020-05-16 07:10:31.492+0000 [id=56] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Periodic background build discarder. 2 ms
I got the same exception with Kubernetes environment.
My Setup:
-Docker CE
-Kubernetes
Deployment of Jenkins:
deployment.apps/jenkins created
persistentvolume/jenkins created
persistentvolumeclaim/jenkins-claim created
serviceaccount/jenkins created
role.rbac.authorization.k8s.io/jenkins created
rolebinding.rbac.authorization.k8s.io/jenkins created
service/jenkins created
In the pod's log, I could saw this
2020-06-19 05:04:12.590+0000 [id=39] INFO hudson.util.Retrier#start: The attempt #1 to do the action check updates server failed with an allowed exception:
java.net.UnknownHostException: updates.jenkins.io
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
at hudson.model.DownloadService.loadJSON(DownloadService.java:114)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:212)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:207)
at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1767)
at hudson.util.Retrier.start(Retrier.java:63)
at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1738)
at jenkins.DailyCheck.execute(DailyCheck.java:93)
at hudson.model.AsyncPeriodicWork.lambda$doRun$0(AsyncPeriodicWork.java:100)
at java.lang.Thread.run(Thread.java:748)
<b>2020-06-19 05:04:12.591+0000 [id=39] INFO hudson.util.Retrier#start: Calling the listener of the allowed exception 'updates.jenkins.io' at the attempt #1 to do the action check updates server</b>
2020-06-19 05:04:12.593+0000 [id=39] INFO hudson.util.Retrier#start: Attempted the action check updates server for 1 time(s) with no success
2020-06-19 05:04:12.594+0000 [id=39] SEVERE hudson.PluginManager#doCheckUpdatesServer: Error checking update sites for 1 attempt(s). Last exception was: UnknownHostException: updates.jenkins.io
2020-06-19 05:04:12.597+0000 [id=39] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 20,180 ms
After some time if logs are fetched, you'd see the token for first time Jenkins setup.
get the token and in my case, I had to do a port-forward to 8080.
Once you access Jenkins on the browser, fill in the token and see if Jenkins is offline.
if it is, goto manage Jenkins then advanced tab, scroll down and locate the update.jenkins.io URL at last.
Here you just need to click on submit without tempering anything and apply.
Now check for the updates in the plugins
If this does not work then you can choose HTTP over HTTPS for updates.jenkins.io URL in the same advanced section and submit, apply the changes. Again check for updates in plugins.
If above 2 don't work then it is very much possible you'd have to configure the proxy settings of Jenkins so that Jenkins instance can reach to internet.
The exception is simply saying that Jenkins instance could not fetch the available plugins/updates from updates.jenkins.io site since it can not resolve the URL.
The main idea here is to resolve the URL.
There are a couple of issues related to this URL exception on git issue trackers as well.
Guess you've just hit the common issue.
In my case I had to consider https://kubernetes.io/docs/tasks/debug-application-cluster/dns-debugging-resolution/ for proper debugging of dns.
I guess you can check if you have the network interface with nameserver 8.8.8.8 or the /etc/resolve.conf has the same.
After trying different things, these commands worked for me:
Disable and stop the firewall on my Centos Host
sudo systemctl disable firewalld
sudo systemctl stop firewalld
Then, restart docker
sudo service docker restart
Am trying to use example given here
http://openejb.apache.org/hello-world.html
With OpenEJB I am able to output HelloWorld
I am trying same in Apache Tomee
I have Remote EJB bean like this
#Remote
public interface Hello{
public String sayHello();
}
#Stateless
public class HelloBean implements Hello{
public String sayHello(){
return "Hello World!!!!";
}
}
packed it in a jar
jar cvf hello.jar org
Deployed on Apache Tomee
Tomee Log after deploying hello.jar
03-Oct-2017 15:55:51.778 INFO [localhost-startStop-1] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/home/ashish/apache-tomee-plus-7.0.2/webapps/manager)
03-Oct-2017 15:55:51.805 INFO [localhost-startStop-1] sun.reflect.DelegatingMethodAccessorImpl.invoke 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.
03-Oct-2017 15:55:51.826 INFO [localhost-startStop-1] sun.reflect.DelegatingMethodAccessorImpl.invoke Deployment of web application directory /home/ashish/apache-tomee-plus-7.0.2/webapps/manager has finished in 137 ms
03-Oct-2017 15:55:51.831 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Starting ProtocolHandler [http-nio-8080]
03-Oct-2017 15:55:51.839 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Starting ProtocolHandler [ajp-nio-8009]
03-Oct-2017 15:55:51.845 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Server startup in 5735 ms
03-Oct-2017 15:56:51.874 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.ConfigurationFactory.configureApplication Configuring enterprise application: /home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar
03-Oct-2017 15:56:51.914 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.InitEjbDeployments.deploy Auto-deploying ejb HelloBean: EjbDeployment(deployment-id=HelloBean)
03-Oct-2017 15:56:51.915 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.AppInfoBuilder.build Enterprise application "/home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar" loaded.
03-Oct-2017 15:56:51.925 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createAppClassLoader Creating dedicated application classloader for hello
03-Oct-2017 15:56:51.926 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createApplication Assembling app: /home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar
03-Oct-2017 15:56:51.945 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=HelloBeanRemote) --> Ejb(deployment-id=HelloBean)
03-Oct-2017 15:56:51.945 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=global/hello/HelloBean!org.acme.Hello) --> Ejb(deployment-id=HelloBean)
03-Oct-2017 15:56:51.945 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.JndiBuilder.bind Jndi(name=global/hello/HelloBean) --> Ejb(deployment-id=HelloBean)
03-Oct-2017 15:56:51.969 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.startEjbs Created Ejb(deployment-id=HelloBean, ejb-name=HelloBean, container=Default Stateless Container)
03-Oct-2017 15:56:51.987 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.startEjbs Started Ejb(deployment-id=HelloBean, ejb-name=HelloBean, container=Default Stateless Container)
03-Oct-2017 15:56:51.988 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createApplication Deployed Application(path=/home/ashish/apache-tomee-plus-7.0.2/webapps/hello.jar)
Now I have created void main class and trying to access this EJB
It throws error
My Main Class
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class HelloClient {
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
//props.put(Context.PROVIDER_URL, "ejbd://127.0.0.1:4201");
//props.put(Context.PROVIDER_URL, "ejbd://localhost:8080");
//props.put(Context.PROVIDER_URL, " http://localhost:8080/openejb/ejb");
Context ctx = new InitialContext(props);
Object ref = ctx.lookup("HelloBeanRemote");
Hello h = (Hello) PortableRemoteObject.narrow(ref, Hello.class);
String result = h.sayHello();
System.out.println(result);
}
}
using : props.put(Context.PROVIDER_URL, "ejbd://127.0.0.1:4201");
run:
Oct 03, 2017 7:12:26 PM org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy connect
WARNING: Cannot connect to server(s): 127.0.0.1:4201 Exception:
java.net.ConnectException: Cannot connect to server 'ejbd://127.0.0.1:4201'. Check that the server is started and that the specified serverURL is correct.
at org.apache.openejb.client.SocketConnectionFactory$SocketConnection.open(SocketConnectionFactory.java:55)
at org.apache.openejb.client.SocketConnectionFactory.getConnection(SocketConnectionFactory.java:35)
at org.apache.openejb.client.ConnectionManager.getConnection(ConnectionManager.java:43)
at org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy.connect(StickToLastServerConnectionFactoryStrategy.java:70)
at org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy.connect(StickToLastServerConnectionFactoryStrategy.java:47)
at org.apache.openejb.client.ServerMetaData.connect(ServerMetaData.java:57)
at org.apache.openejb.client.Client.processRequest(Client.java:58)
at org.apache.openejb.client.Client.request(Client.java:42)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at java8demo.HelloClient.main(HelloClient.java:25)
Exception in thread "main" javax.naming.NamingException: Cannot lookup '/HelloBeanRemote'. [Root exception is java.rmi.RemoteException: Cannot connect to any servers: Server #0: ejbd://127.0.0.1:4201]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at java8demo.HelloClient.main(HelloClient.java:25)
Caused by: java.rmi.RemoteException: Cannot connect to any servers: Server #0: ejbd://127.0.0.1:4201
at org.apache.openejb.client.StickToLastServerConnectionFactoryStrategy.connect(StickToLastServerConnectionFactoryStrategy.java:66)
at org.apache.openejb.client.ServerMetaData.connect(ServerMetaData.java:57)
at org.apache.openejb.client.Client.processRequest(Client.java:58)
at org.apache.openejb.client.Client.request(Client.java:42)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
... 2 more
/home/ashish/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
using: props.put(Context.PROVIDER_URL, "ejbd://localhost:8080");
run:
Exception in thread "main" javax.naming.NamingException: Cannot lookup '/HelloBeanRemote'. [Root exception is java.rmi.RemoteException: Cannot open object output stream to server: ; nested exception is:
java.net.SocketException: Broken pipe (Write failed)]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:240)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at java8demo.HelloClient.main(HelloClient.java:25)
Caused by: java.rmi.RemoteException: Cannot open object output stream to server: ; nested exception is:
java.net.SocketException: Broken pipe (Write failed)
at org.apache.openejb.client.Client.processRequest(Client.java:107)
at org.apache.openejb.client.Client.request(Client.java:42)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:87)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
... 2 more
Caused by: java.net.SocketException: Broken pipe (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877)
at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786)
at java.io.ObjectOutputStream.<init>(ObjectOutputStream.java:247)
at org.apache.openejb.client.Client.processRequest(Client.java:104)
... 5 more
/home/ashish/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
By default Tomee doesn't allow Remote EJB lookup
you need to enable it inside Apache-Tomee/conf/system.properties file
// enable remote access
tomee.remote.support = true
// blacklist none
tomee.serialization.class.blacklist = -
// whitelist all classes or you can define your classes
tomee.serialization.class.whitelist = *
openejb.system.apps = true
openejb.servicemanager.enabled = true
once these configuration are changeed, restart tomee and tomee deploy your EJB's
and all EJB's can be accessed using following url
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
p.put(Context.PROVIDER_URL, "http://localhost:8080/tomee/ejb");
final InitialContext ctx = new InitialContext(p);
Hello hbr = (Hello) ctx.lookup("HelloBeanRemote");
One other mistake I was doing that
I used openejb-client-3.0.jar from OpenEJb container
instead of openejb-client-7.0.2.jar from apache lib folder
Use client jar above 3 version
From last two years on tomcat I am using this configuration for database connection pooling in tomcat
<Resource auth="Container"
driverClassName="com.mysql.jdbc.Driver"
logAbandoned="true"
maxActive="100"
maxIdle="30"
maxWait="10000"
name="jdbc/maindb"
password="xxxxx"
removeAbandoned="true"
removeAbandonedTimeout="60"
type="javax.sql.DataSource"
url="jdbc:mysql://localhost:3306/maindb?zeroDateTimeBehavior=convertToNull"
connectionProperties="useEncoding=true;"
username="sqladmin" validationQuery="select 1"/>
On production server, from last one month, with this configuration - suddenly tomcat stop responding to any requests. And results in timeout. There is no errors in logs, but as soon as I shutdown tomcat a huge amount of error log comes, which seems to show some kind of deadlock in database connections.
To rectify it, I used database connection pooling configuration from http://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html . After using this configuration, now I face two problems, on production, either a table lock occurs even after using INNODB engine, or some queries start returning empty result set even when query is perfectly fine.
<Resource name="jdbc/maindb"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
maxActive="100"
minIdle="10"
maxWait="10000"
initialSize="10"
removeAbandonedTimeout="60"
removeAbandoned="true"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jmxEnabled="true"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="sqladmin"
password="xxxxx"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/maindb"/>
In case of first configuration, after shutting down tomcat following error logs start coming
04-Feb-2015 20:44:46.048 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
04-Feb-2015 20:44:46.049 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-apr-8080"]
04-Feb-2015 20:44:46.100 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-apr-8009"]
04-Feb-2015 20:44:46.151 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
04-Feb-2015 20:44:46.157 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 81 instance(s) to be deallocated for Servlet [dispatcher]
04-Feb-2015 20:44:47.158 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 81 instance(s) to be deallocated for Servlet [dispatcher]
04-Feb-2015 20:44:48.160 INFO [localhost-startStop-2] org.apache.catalina.core.StandardWrapper.unload Waiting for 81 instance(s) to be deallocated for Servlet [dispatcher]
04-Feb-2015 20:44:48.260 INFO [localhost-startStop-2] org.springframework.context.support.AbstractApplicationContext.doClose Closing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue Feb 03 18:26:26 UTC 2015]; parent: Root WebApplicationContext
04-Feb-2015 20:44:48.307 INFO [localhost-startStop-2] org.springframework.context.support.AbstractApplicationContext.doClose Closing Root WebApplicationContext: startup date [Tue Feb 03 18:26:24 UTC 2015]; root of context hierarchy
04-Feb-2015 20:44:48.310 INFO [localhost-startStop-2] org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.shutdown Shutting down ExecutorService 'taskExecutor'
04-Feb-2015 20:44:48.329 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation. Stack trace of request processing thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
org.apache.tomcat.dbcp.pool2.impl.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:582)
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:439)
org.apache.tomcat.dbcp.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:360)
org.apache.tomcat.dbcp.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:118)
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1412)
com.myproj.dao.ConnectionPool.getConnection(ConnectionPool.java:41)
And in second case following error logs comes, while doing certain operation
22-Jan-2015 16:36:04.077 SEVERE [http-apr-8080-exec-2] com.myproj.dao.cart.impl.VisitorCartDaoImpl.addCartItem Lock wait timeout exceeded; try restarting transaction
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2141)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2077)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2062)
at com.myproj.dao.cart.impl.VisitorCartDaoImpl.addCartItem(VisitorCartDaoImpl.java:96)
Is there anything wrong with the configuration or with the database? I am using MySQL 5.6 as the database and on production, mySQL is running on amazon RDS. And I am using tomcat 8.0.15
can someone figure out whats the error in jboss. when i enter localhost:8080 in url it says INVALID REQUEST. PLEASE CHECK URL.
I am using jboss 5.0.1
JBOSS_HOME: D:\Jboss\jboss-5.0.1.GA
JAVA: C:\Program Files\Java\jdk1.6.0_13\bin\java
JAVA_OPTS: -Dfile.encoding=UTF-8 -Dprogram.name=run.bat -server -Xms512m -Xmx1024m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
CLASSPATH: D:\Jboss\jboss-5.0.1.GA\bin\run.jar
===============================================================================
20:46:16,640 INFO [ServerImpl] Starting JBoss (Microcontainer)...
20:46:16,640 INFO [ServerImpl] Release ID: JBoss [Morpheus] 5.0.1.GA (build: SVNTag=JBoss_5_0_1_GA date=200902231221)
20:46:16,640 INFO [ServerImpl] Bootstrap URL: null
20:46:16,656 INFO [ServerImpl] Home Dir: D:\Jboss\jboss-5.0.1.GA
20:46:16,656 INFO [ServerImpl] Home URL: file:/D:/Jboss/jboss-5.0.1.GA/
20:46:16,656 INFO [ServerImpl] Library URL: file:/D:/Jboss/jboss-5.0.1.GA/lib/
20:46:16,656 INFO [ServerImpl] Patch URL: null
20:46:16,656 INFO [ServerImpl] Common Base URL: file:/D:/Jboss/jboss-5.0.1.GA/common/
20:46:16,656 INFO [ServerImpl] Common Library URL: file:/D:/Jboss/jboss-5.0.1.GA/common/lib/
20:46:16,656 INFO [ServerImpl] Server Name: default
20:46:16,656 INFO [ServerImpl] Server Base Dir: D:\Jboss\jboss-5.0.1.GA\server
20:46:16,671 INFO [ServerImpl] Server Base URL: file:/D:/Jboss/jboss-5.0.1.GA/server/
20:46:16,671 INFO [ServerImpl] Server Config URL: file:/D:/Jboss/jboss-5.0.1.GA/server/default/conf/
20:46:16,671 INFO [ServerImpl] Server Home Dir: D:\Jboss\jboss-5.0.1.GA\server\default
20:46:16,671 INFO [ServerImpl] Server Home URL: file:/D:/Jboss/jboss-5.0.1.GA/server/default/
20:46:16,671 INFO [ServerImpl] Server Data Dir: D:\Jboss\jboss-5.0.1.GA\server\default\data
20:46:16,671 INFO [ServerImpl] Server Library URL: file:/D:/Jboss/jboss-5.0.1.GA/server/default/lib/
20:46:16,671 INFO [ServerImpl] Server Log Dir: D:\Jboss\jboss-5.0.1.GA\server\default\log
20:46:16,671 INFO [ServerImpl] Server Native Dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp\native
20:46:16,687 INFO [ServerImpl] Server Temp Dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp
20:46:16,687 INFO [ServerImpl] Server Temp Deploy Dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp\deploy
20:46:17,296 INFO [ServerImpl] Starting Microcontainer, bootstrapURL=file:/D:/Jboss/jboss-5.0.1.GA/server/default/conf/bootstrap.xml
20:46:17,859 INFO [VFSCacheFactory] Initializing VFSCache [org.jboss.virtual.plugins.cache.CombinedVFSCache]
20:46:17,859 INFO [VFSCacheFactory] Using VFSCache [CombinedVFSCache[real-cache: null]]
20:46:18,140 INFO [CopyMechanism] VFS temp dir: D:\Jboss\jboss-5.0.1.GA\server\default\tmp
20:46:18,156 INFO [ZipEntryContext] VFS force nested jars copy-mode is enabled.
20:46:20,218 INFO [ServerInfo] Java version: 1.6.0_13,Sun Microsystems Inc.
20:46:20,234 INFO [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
20:46:20,234 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 11.3-b02,Sun Microsystems Inc.
20:46:20,234 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
20:46:20,265 INFO [JMXKernel] Legacy JMX core initialized
20:46:22,593 INFO [ProfileServiceImpl] Loading profile: default from: org.jboss.system.server.profileservice.repository.SerializableDeploymentRepository#126c5a5(root=D:\Jboss\jboss-5.0.1.GA\server, key=org.jboss.profileservice.spi.Pro
fileKey#143b82c3[domain=default,server=default,name=default])
20:46:22,593 INFO [ProfileImpl] Using repository:org.jboss.system.server.profileservice.repository.SerializableDeploymentRepository#126c5a5(root=D:\Jboss\jboss-5.0.1.GA\server, key=org.jboss.profileservice.spi.ProfileKey#143b82c3[doma
in=default,server=default,name=default])
20:46:22,593 INFO [ProfileServiceImpl] Loaded profile: ProfileImpl#1e779a7{key=org.jboss.profileservice.spi.ProfileKey#143b82c3[domain=default,server=default,name=default]}
20:46:24,421 INFO [WebService] Using RMI server codebase: http://127.0.0.1:9283/
20:46:30,656 INFO [NativeServerConfig] JBoss Web Services - Stack Native Core
20:46:30,671 INFO [NativeServerConfig] 3.0.5.GA
20:46:42,218 INFO [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:2290/jmxconnector
20:46:42,375 INFO [MailService] Mail Service bound to java:/Mail
20:46:44,015 WARN [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installat
ion default. Please see the JBoss Messaging user guide for instructions on how to do this.
20:46:44,031 WARN [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
20:46:44,203 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
20:46:44,203 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
20:46:44,656 INFO [TransactionManagerService] Initializing recovery manager
20:46:44,843 INFO [TransactionManagerService] Recovery manager configured
20:46:44,843 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
20:46:44,875 INFO [TransactionManagerService] Starting transaction recovery manager
20:46:45,453 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
20:46:45,453 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8218
20:46:45,453 INFO [StandardService] Starting service jboss.web
20:46:45,453 INFO [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.2.GA
20:46:45,531 INFO [Catalina] Server startup in 146 ms
20:46:45,562 INFO [TomcatDeployment] deploy, ctxPath=/invoker
20:46:46,156 INFO [TomcatDeployment] deploy, ctxPath=/jbossws
20:46:46,203 INFO [TomcatDeployment] deploy, ctxPath=/web-console
20:46:46,265 INFO [[/web-console]] SystemFolder: Failed to init plugin, Resource not found: SystemFolder.bsh
20:46:46,296 INFO [[/web-console]] J2EEFolder: Failed to init plugin, Resource not found: J2EEFolder.bsh
20:46:46,421 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
20:46:46,531 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
20:46:46,578 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/jms-ra.rar/META-INF/ra.xml
20:46:46,609 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/mail-ra.rar/META-INF/ra.xml
20:46:46,640 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/Jboss/jboss-5.0.1.GA/server/default/deploy/quartz-ra.rar/META-INF/ra.xml
20:46:46,796 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
20:46:46,843 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
20:46:46,843 INFO [RAMJobStore] RAMJobStore initialized.
20:46:46,843 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
20:46:46,843 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
20:46:46,843 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
20:46:47,531 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
20:46:48,062 INFO [ServerPeer] JBoss Messaging 1.4.1.GA server [0] started
20:46:48,296 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4657 has leasing enabled, lease period 10000 milliseconds
20:46:48,296 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory#3dc250 started
20:46:48,359 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4657 has leasing enabled, lease period 10000 milliseconds
20:46:48,359 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory#188ef97 started
20:46:48,406 INFO [QueueService] Queue[/queue/A] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/ex] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/B] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,406 INFO [QueueService] Queue[/queue/C] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 WARN [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory wil
l *not* support failover
20:46:48,421 WARN [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factor
y will *not* support load balancing
20:46:48,421 INFO [ConnectionFactory] Connector bisocket://127.0.0.1:4657 has leasing enabled, lease period 10000 milliseconds
20:46:48,421 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory#2de670 started
20:46:48,421 INFO [QueueService] Queue[/queue/D] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 INFO [QueueService] Queue[/queue/MailQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 INFO [TopicService] Topic[/topic/testDurableTopic] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,421 INFO [QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,437 INFO [TopicService] Topic[/topic/securedTopic] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,437 INFO [QueueService] Queue[/queue/testQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,437 INFO [TopicService] Topic[/topic/testTopic] started, fullSize=200000, pageSize=2000, downCacheSize=2000
20:46:48,640 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
20:46:48,703 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=PostgresDSDYPK' to JNDI name 'java:PostgresDSDYPK'
20:46:48,734 INFO [TomcatDeployment] deploy, ctxPath=/
20:46:50,312 INFO [TomcatDeployment] deploy, ctxPath=/ap
20:46:50,406 WARN [JAXWSDeployerHookPreJSE] Cannot load servlet class: org.jboss.jmx.adaptor.html.HtmlAdaptorServlet
20:46:50,406 WARN [JAXWSDeployerHookPreJSE] Cannot load servlet class: org.jboss.jmx.adaptor.html.ClusteredConsoleServlet
20:46:50,421 INFO [TomcatDeployment] deploy, ctxPath=/jmx-conso1e
20:46:50,500 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
20:46:50,531 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8218
20:46:50,546 INFO [ServerImpl] JBoss (Microcontainer) [5.0.1.GA (build: SVNTag=JBoss_5_0_1_GA date=200902231221)] Started in 33s:859ms
You will also have to specify the binding address for the jboss server. For jboss5.x, the command will be like
Jboss\jboss-5.0.1.GA\bin\run.jar -b0.0.0.0
Check your port number under /deploy/jbossweb.sar/server.xml, I think the problem is right there.
It should be like this ==>
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
Check the port number!