Unable to connect a node to Erlang debugger ErlyBerly - erlang

I am learning the Erlang debugger ErlyBerly. Started ErlyBerly as follows.
java -jar target/*runnable.jar
I have written a simple Erlang application with an infinite loop so that it keeps running. I started the node from erl CLI. Please note that both the Erlang node and ErlyBerly are running on the same Linux machine. The node is listed in ErlyBerly. When I tried to connect to the node, I am getting an error "cannot connect to peer node". What could be the reason?
$erl -sname node
(node1#vm-alarm)1>maths:f().
.....
I have tried with a long node name node#oc.com as well. The same error is seen.
The Erlyberly readme page says that "Just make sure that the runtime_tools application is available in the code path. If the node was run using erl directly then it will be available by default". I did not understand this fully. What is runtime_tools? How to run the node using erl directly? Please help me in understanding this.
Following error message is shown:

Mostly it is because of the error "rejected since it cannot handle ["BIG_CREATION"]" while connecting to the node.
To fix it:
You must edit jinterface package part in pom.xml and make it download from com.github.rafaelmsoares instead of com.github.andytill
eg:
<dependencies>
<dependency>
<groupId>com.github.rafaelmsoares</groupId>
<artifactId>jinterface</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>junit</groupId>
more info: https://github.com/andytill/erlyberly/issues/175

Related

Yaws is not loading yaws_dynopts module

I am running Yaws server version 2.0.2 with Erlang/OTP 18 [erts-7.3] on ubuntu 16.04 and installed it using apt. Now when i try to run this example i get
undef yaws_dynopts random_seed. I have verified that module yaws_dynopts is not loaded OR compiled.
error is:
{undef,[{yaws_dynopts,random_seed,[6885,441906,806568],[]},
{m1,'-out/1-fun-0-',1,
[{file,"/home/my_account/.yaws/yaws/default/m1.erl"},{line,16}]}]}
which corresponds to line in example:
yaws_dynopts:random_seed(erlang:phash(node(), 100000),
erlang:phash(A2, A3),
A3),
Do anyone have solution to this? And is it a bug?
Does l(yaws_dynopts). also cause an error? I'm starting to believe whoever packaged your version of Yaws didn't do it correctly, leaving out this critical module. You should look to see if version 2.0.3 is available, or alternatively consider building your own from source. We're currently at 2.0.4.

rebar3: console not opening

This is a rebar3 release compiled and released without any error. (There was this line ( ===> Missing beam file elf_format <<"/usr/local/lib/erlang/lib/hipe-3.11.3/ebin/elf_format.beam">>) I guess that's something else).
There is a line in the error which says that there is another link using the same hostname. Seeing this I deleted all such projects of the same name and recompiled and re released.
Also when i try start option no output is shown and localhost:8080 is not started.(I have been trying to do the example on this link in rebar3 :- http://jordenlowe.com/title/Explain_like_I_am_5_-_Erlang_REST_Framework_Cowboy)
What is/could be the reason for this error.
The main error is: the name hello_erlang#you_host seems to be in use by another Erlang node which says that there is another running Erlang node with the same name. You can see a list of running Erlang node with following Erlang Port Mapper Daemon (epmd) command:
epmd -names
You must stop or kill currently running node with the desired node name and then start the new one.

Erlang - Is it possible to make the messages that appear on erlang shell appear on linux shell too?

I have created a small test application and when on a linux machine I would like to see the messages that appear on the erlang shell to appear on the linux as well. I am not sure how it could be done, but is it possible?
I am running the application in detached mode(erlang shell).
EDIT:
I meant the message passing to the linux shell.
Example:
When I start my application using,
test application <start/stop>
I would get a message on the Linux shell Test Application has successfully started
But if I was like copying files, I would like the progress of the file copy to be displayed on the Linux shell like,
Copy successful. Number of files copied : 1
Copy successful. Number of files copied : 2
....
So is it possible to do the above using the message passing from Erlang to Linux?
I believe you can use some logger for this purposes. For example lager can redirect logs to several facilities at the same time, e.g. file and erlang console.
Other option is to use "run_erl", utility which comes with erlang distribution and allows "redirect the standard input and standard output streams so that all output can be logged".
Try erl -man run_erl or you can see can generate "release" with rebar, it will generate startup scripts which use "run_erl".

Embedded Jetty cannot access static web content in jar within Spring Boot uber-jar

I'm running a Spring Boot web app with an underlying Neo4j database. In order to be able to view the Neo4j browser (direct web view onto the db), the Neo4j web server is embedded into the application using the following configuration.
#Bean(initMethod = "start", destroyMethod = "stop")
public WrappingNeoServerBootstrapper neo4jWebServer() {
return new WrappingNeoServerBootstrapper((GraphDatabaseAPI) graphDatabaseService());
}
and by including the following in the maven pom:
<dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-server</artifactId>
<classifier>static-web</classifier>
<version>2.0.2</version>
</dependency>
This all works fine when running from STS (i.e. unpackaged).
When I package the application up using the spring-boot-maven-plugin. This creates the uber-jar correctly containing the neo4j-server-2.0.2-static-web.jar file in the /lib folder of the uber-jar.
When I run the application directly using the uber-jar file and then attempt to hit the http://localhost:7474/browser/ URL for the Neo4j browser, it returns a 404.
The reason for this is that the Jetty DefaultServlet attempts to getResource() from the WebAppContext which, in turn, calls JarFileResource.exists() which tries to operate on the following URL string:
jar:file:/home/dev/myapp/target/myapp-0.0.1-SNAPSHOT.jar!/lib/neo4j-browser-2.0.2.jar!/browser/
Jetty fails to match anything in its resource list as it's looking for a resource called /lib/neo4j-browser-2.0.2.jar!/browser/ as the code, e.g. at http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarFileResource.java#n123 (and a couple of other places) is looking for the first !/ in the string.
I am going to submit a Jetty bug for this with a suggestion that they use String.lastIndexOf("!/") in their code, which will resolve the issue.
In the meantime, apart from producing our oun standard maven assembly, does anyone have any suggestions for how I could get this to work within a Spring Boot uber-jar?
Many thanks.
Spring Boot uber-jars use some special techniques to allow content to be loaded from nested jars. Jetty (quite understandably) assumes that jar URLs will only contain a single ! which unfortunately is not the case here.
Your easiest solution is probably to switch to the maven-shade-plugin. This creates an uber-jar by unpacking all of your dependencies before repacking them into a single jar.
Some other alternatives are suggested in the Spring Boot reference documentation
If you're using SpringBoot+Maven you can add the following:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-browser</artifactId>
</dependency>
</requiresUnpack>
</configuration>
<executions>
...
</plugin>
Obtained from this gradle suggestion

Call to i:im() in application debugger failed in ejabberd

I'm trying to debug ejabberd. I have compiled the files with debug_info. I start ejabberd, then use ejabberd debug to get into the shell. Once in there, running im() produces "Call to i:im() in application debugger failed". I can't figure out what's causing this. Any ideas on how to debug?
Edit
I've tried running this in just the erl shell independent of ejabberd and it still fails. So it looks like it's related to my erlang setup as opposed to a problem with my ejabberd setup.
Foolish me: apt-get install erlang-debugger solved the problem.

Resources