Play Framework GUID - configuration

I have created a play application. When i am running the application i'm getting this error both in dev and prod
07:59:58,445 INFO ~ Precompiling ...
08:00:08,884 ERROR ~ Unable to set localhost. This prevents creation of a GUID. Cause was: sys3: sys3: Name or service not known
java.net.UnknownHostException: sys3: sys3: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
at net.sf.ehcache.Cache.<clinit>(Cache.java:155)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:298)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:214)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:552)
at net.sf.ehcache.CacheManager.init(CacheManager.java:323)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:279)
at net.sf.ehcache.CacheManager.create(CacheManager.java:641)
at play.cache.EhCacheImpl.<init>(EhCacheImpl.java:31)
at play.cache.EhCacheImpl.newInstance(EhCacheImpl.java:41)
at play.cache.Cache.init(Cache.java:241)
at play.Play.start(Play.java:511)
at play.Play.init(Play.java:300)
at play.server.Server.main(Server.java:158)
Caused by: java.net.UnknownHostException: sys3: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
at java.net.InetAddress.getLocalHost(InetAddress.java:1434)
... 13 more
I don't know what is this, what this will do. How to solve this issue. Pl help me.

java is unable to resolve mynap3 as localhost, so you'll have to add the line
127.0.0.1 localhost mynap3
to your /etc/hosts file
you can do this by executing
sudo bash
echo "127.0.0.1 localhost mynap3" >> /etc/hosts

Related

Deploy Spring Cloud Data Flow 2.6.0 to Openshift

I'm trying to deploy SCDF 2.6.0 to Openshift.
I can verify DB schema is updated successfully, but seems like the Tomcat failed to start with below error and I have no idea what is going on.
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
Caused by: java.net.SocketException: Permission denied
Steps reproduce
Use MariaDB, then import the *.yaml in below sequence
server-roles.yaml
server-rolebinding.yaml
service-account.yaml
server-config.yaml (make sure to change the DB connection here )
server-svc.yaml
server-deployment.yaml
I uploaded all the yml and full log file in my repo :
https://github.com/gry77/app-issue-repo/tree/master/Openshift-SCDF-issue/k8s-config
Apparently this error gone after I changed the server port from 80 to something else.
so just change the server.port in the environment to other then 80
OpenShift will not allow you to run containers as privileged by default, so you'll need to specifically allow that using a SecurityContextConstraint. There is a good documentation on how to get SCDF to run on OpenShift here: https://donovanmuller.blog/spring-cloud-dataflow-server-openshift/docs/1.1.0.RELEASE/reference/htmlsingle/#_creating_and_configuring_service_accounts
Basically, you'll need to add the anyuid SCC to the ServiceAccount running the Pods:
oc adm policy add-scc-to-user anyuid system:serviceaccount:scdf:scdf

Cannot start Drill: Exception in thread "main" org.apache.drill.exec.exception.DrillbitStartupException: Could not get canonical hostname

When running Apache drill in kubernetes cluster, this exception is throwed a moment after startup:
Starting drillbit, logging to /opt/drill/log/drillbit.out
Exception in thread "main" org.apache.drill.exec.exception.DrillbitStartupException: Could not get canonical hostname.
at org.apache.drill.exec.server.BootStrapContext.getCanonicalHostName(BootStrapContext.java:169)
at org.apache.drill.exec.server.BootStrapContext.<init>(BootStrapContext.java:81)
at org.apache.drill.exec.server.Drillbit.<init>(Drillbit.java:161)
at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:518)
at org.apache.drill.exec.server.Drillbit.start(Drillbit.java:498)
at org.apache.drill.exec.server.Drillbit.main(Drillbit.java:494)
Caused by: java.net.UnknownHostException: aks-nodepool1-20640609-1: aks-nodepool1-20640609-1: Try again
at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
at org.apache.drill.exec.server.BootStrapContext.getCanonicalHostName(BootStrapContext.java:167)
... 5 more
Caused by: java.net.UnknownHostException: aks-nodepool1-20640609-1: Try again
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
aks-nodepool1-20640609-1 is name of the node, where the container is running.
Every other application than Drill is running ok on this stack.
How can this be fixed ...?
Looks like InetAddress.getLocalHost().getCanonicalHostName() could not get canonical host name, you can investigate why this is happening, maybe you need to configure something in your env. Another option is to use custom host name, it can be set using env variable: DRILL_HOST_NAME -> System.getenv("DRILL_HOST_NAME").

Failed to Resolve Target Definition on OpenShift

I'm trying to get a Tycho build to work on an OpenShift server. Locally resolving the target definition and building works fine, but when deploying I get the following error:
Unable to read repository at http://download.eclipse.org/rt/rap/2.2/content.xml. Permission denied
I'm not sure if its a problem in the Tycho configuration (but as far as I can remember, I didn't do anything outside the build reactor to make Tycho work) or the one of OpenShift. Could someone tell me what the problem is or how to narrow it down?
I tried switching from a target platform file to defining the repository in the pom.xml. Then I get a similar error message:
Failed to load p2 repository with ID 'rap' from location http://download.eclipse.org/rt/rap/2.2
I found a Linux bug that might be relevant. It doesn't help me, since I'm not even able confirm the server is a Debian. I tried to get the Jenkins to build on some other platform and tried any abbreviation or combination of "Windows" in the (seemingly undocumented) "platform" field, but neither of these values made it change the OS.
Finally got Maven to work with parameters (for how, see here). The log shows nothing out of the ordinary, as far as I can see:
[INFO] Computing target platform for MavenProject: org.acme.dummy:org.acme.dummy.feature:0.0.1-SNAPSHOT # /var/lib/openshift/537cb333e0b8cd68ad000187/app-root/runtime/repo/org.acme.dummy.feature/pom.xml
[DEBUG] Added p2 repository rap-repository (http://download.eclipse.org/rt/rap/2.2)
[DEBUG] Using default execution environment 'JavaSE-1.6'
[DEBUG] Registered artifact repository org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey(uri=file:/resolution-context-artifacts#/var/lib/openshift/537cb333e0b8cd68ad000187/app-root/runtime/repo/org.acmr.dummy.feature)
May 21, 2014 10:15:59 AM org.apache.http.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.BindException) caught when connecting to the target host: Permission denied
It's retrying to connect a couple of times, then there is the above exception:
!ENTRY org.eclipse.equinox.p2.transport.ecf 2 0 2014-05-21 10:16:00.073
!MESSAGE Connection to http://download.eclipse.org/rt/rap/2.2/p2.index failed on Permission denied. Retry attempt 0 started
!STACK 0
java.net.BindException: Permission denied
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.Socket.bind(Socket.java:631)
at org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ECFHttpClientProtocolSocketFactory.connectSocket(ECFHttpClientProtocolSocketFactory.java:82)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:150)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:575)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)

onnect failed; nested exception is:javax.net.ssl.SSLHandshakeException:

I am getting following error when I try to connect yahoo
pop3s. plus.mail.pop.yahoo.com:995
error while connecting to pop3 mail server javax.mail.MessagingException: Connect failed;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I have already tried adding the certificate into JAVA_Home/jre/lib/security. Also when I am trying to use the same code directly using the Java/javac Cmd it works. But from tomcat it does not work.
Also: the code which I am using that was working since last two years on same server. Recently we have migrated from dedicated server to cloud based server. Backspace is the vendor where we have deployed the code.
Thanks in advance!
Vivek Agrawal
Most probably cause os this is that the system is unable to locate a valid certificate because in your migration something related to the keystore was not properly set.
Review your configuration file $CATALINA_BASE/conf/server.xml and look if the path to the correct keystore is set under Connector tag. If you are using JSSL look for this in that file
<-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
<Connector
port="8443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="${user.home}/.keystore" keystorePass="changeit"
clientAuth="false" sslProtocol="TLS"/>
Your keystoreFile has to be set to the correct path in order your application can validate amd resolve a certificacion path in a request (the keystorepass have to be correct too, indeed).
If you have another configuration (APR or something) look at the documentation about in http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html
Hope this help,
Cheers!!

Exceptions with SSL Code

I'm having a problem that I can't figure it out. I'm testing a SSL code that connects to a remote website, and everything works great on my computer. BTW, I imported the certificate from the website with:
keytool -importcert -keystore /java/path/to/cacerts -trustcacerts -alias “Cert Alias” -file website_certificate.cer
The problem appears when I upload and test the code on the server. I get the following exceptions:
Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed
Caused by: java.security.cert.CertPathValidatorException: timestamp check failed
Caused by: java.security.cert.CertificateExpiredException: NotAfter:
I checked the date on the server and it is up to date, and the certificate expires on 2012.
Any help will be appreciated.