Starting kafka on Linux or Win - apache-kafka

I have tried for the last 10 hours to start the kafka server but I couldn't.
I managed to install zookeeper and run it on win10 but I had the
classpath is empty. please build the project first e.g. by running 'gradlew
jarall'
error.
So I installed ubuntu and the jre 9, zookeeper workd fine here ,too. But kafka does not. The latest error I get is:
[0.000s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:/home/emi/kafka/bin/../logs/kafkaServer-gc.log instead.
Unrecognized VM option 'PrintGCDateStamps'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I even switched to java 8 and tried different versions of kafka, but I can't get it going. In both cases I don't think it's a problem of environement variables for java since zookeeper works just fine: java -version returns
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

Problem solved on Windows, probabily using the source file instead the scala compiled was the problem

Related

Glassfish5 not starting

i have tomcat working fine, the error is not even about the port, which i know how to change, is this some sort of java version compatibility problem?
i'm a student so i don't know much
here's the output
$ asadmin start-domain domain1
Exception in thread "main" java.lang.NullPointerException
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:152)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:144)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:218)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:224)
at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:88)
at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:217)
at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:255)
at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:231)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:371)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:306)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:57)
the command $ asadmin list-applications says the server is not up
i'm on Mx Linux fully updated
$ java -version
openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb11u1, mixed mode, sharing)
i haven't done anything yet, i can't find any problem similar to this on google
It was the JDK version
Inside netbeans when i clicked on Start to start the server, it says something about JDK 11, netbeans has a feature that let's you download many open JDK versions, i downloaded a random openJDK8 version and it worked
I don't know how to edit the JDK version manually or from any other IDE though, but my (video) class is using netbeans so for now i'm ok (they didn't teach on video because the video is 2 years old so it's outdated)

java web start fails to locate java runtime

Hi I am trying to run javaws but it prompts:
To open this Web Start application you need to download the Java Runtime Environment.
I am sure JRE is installed, maybe javaws does not find it, how do I fix that?
Johns-MacBook-Pro:~ johnmactavish$ java --version
java 13.0.2 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
Johns-MacBook-Pro:~ johnmactavish$ javaws
No Java runtime present, requesting install.
Unable to locate a Java Runtime to invoke.
Johns-MacBook-Pro:~ johnmactavish$
Java Web Start (javaws) was deprecated in Java 9 and removed in Java 11.
As you are using java 13, you can either downgrade from 13 to 8, or look for alternatives.
Perhaps an alternative such as https://openwebstart.com/ can help you out with that.
P.S: In case you're using tools to manage version such as sdkman or such, there might be the case where it's also not available in SDKs # version 8 provided by sdkman.

Kafka start issue with Windows

I am trying to run Kafka on my windows machine and i get the below exception.
C:\Users\Abdul.Qaadir\Desktop\Camunda\Kafka\kafka_2.11-0.10.2.0\kafka_2.11-0.10.2.0\kafka_2.11-0.10.2.0\bin\windows>.\kafka-server-start.bat .\config\server.properties
**The input line is too long.
The syntax of the command is incorrect.**
C:\Users\Abdul.Qaadir\Desktop\Camunda\Kafka\kafka_2.11-0.10.2.0\kafka_2.11-0.10.2.0\kafka_2.11-0.10.2.0\bin\windows>java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) Client VM (build 25.141-b15, mixed mode)
Can anyone help?
enter image description here
I had the same problem in windows too.
As a workaround, unzip kafka in a folder with a shorter name,like C:\Users\YourUser\Desktop\Camunda\Kafka\
You must have the bin, lib, ... folders right there.
That should do the trick.
It was due to directory depth. Moved the kafka installable under c drive and it worked.

Missing spark file from my system?

I'm trying to run a program written in Scala that uses Apache Spark 2.0. However, I keep getting the following error:
/opt/spark-1.6.1/bin/spark-class: line 86: /usr/java/jdk1.8.0_40/bin/java: No such file or directory
Does anyone know what might be causing this?
Edit: Running the java -version command yields the following result:
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)
Edit 2: Took a peek into /usr/java and found that instead of jdk1.8.0_40, I have jdk1.8.0_101. Used export JAVA_HOME to reset it and now env displays JAVA_HOME as the correct path. It's still not working, though! Same error anyway. Do I need to run some kind of update command?

"Error: Writing to server" - Occuring only on ubuntu

I am using a jar file implementing custom functionality which uses jersey as REST client (version 2.22.1). While everything seems to work fine for a few calls, for a specific HTTP call I get a "Error: Writing to server", but only when running in ubuntu.
The error occurs when running a unit test on my two ubuntu development PCs. My development PCs are both Ubuntu 16.04 with Oracle JDK:
~$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
Running the same test from a windows machine, gives me no error. On my windows machine:
java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
The full error's stacktrace is:
javax.ws.rs.ProcessingException: java.io.IOException: Error writing to
server at
org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:287)
at
org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255)
at
org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684)
at
org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at
org.glassfish.jersey.internal.Errors.process(Errors.java:297) at
org.glassfish.jersey.internal.Errors.process(Errors.java:228) at
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
at
org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681)
at
org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437)
at
org.glassfish.jersey.client.JerseyInvocation$Builder.put(JerseyInvocation.java:326)
....
Caused by: java.io.IOException: Error writing to server at
sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:666)
at
sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:678)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at
org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:394)
at
org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
... 40 more
I can only suppose two causes for the error:
the difference of the jvm version
different networking settings among the two operating systems
This error comes up in specific requests with rathed large http loads. Many colleagues in various posts have suggested that this occurs during large http requests, however I have not found any post suggesting a solution or relating it to Ubuntu specifically.
Any hints?
Which would be the networking parameters affecting such functionality? How could I change/adapt them?
Would specific jvm configuration be needed?
The solution is on the TCP level and not on the JVM version or configuration. I have changed the my ubuntu networking settings and the error is gone. I suppose, it occured only to large HTTP requests, because the TCP windows were too small or something.
I followed the instructions in http://www.slashroot.in/linux-network-tcp-performance-tuning-sysctl article to set the following settings:
net.ipv4.tcp_window_scaling = 1
net.core.rmem_max = 16777216
net.ipv4.tcp_rmem = 4096 137380 16777216
net.ipv4.tcp_wmem = 4096 137380 16777216
Please note that the error occured on an HTTP request with a load of about 90kbytes. I needed to play around with the value of the window assigned to each TCP connection (137380) in order to succeed.
Please also note that this could have other side effects in your networking that I cannot really foresee or explain. Testing with larger window values caused delays in other requests that I cannot explain. Therefore, increasing the TCP windows size is not a suits-all solution.