Inconsistent AOT classnotfoundexception

2019-09-11 Thread Kimmo Koskinen
Hi!

Not a direct answer, but have you looked at clj-headlights 
https://github.com/logrhythm-oss/clj-headlights, a Apache Beam wrapper for 
Clojure. It might have pointers related to Beam/AOT specifically.

- Kimmo

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/d8501302-c86e-4e35-8ea1-868df0c73c28%40googlegroups.com.


Re: [Q] How to load Clojure as part of Wildfly module?

2019-02-07 Thread Kimmo Koskinen
Hi!

I ran into the same issue while helping a colleague in working on the 
[sonar-clojure Sonarqube|https://github.com/hjhamala/sonar-clojure/] 
plugin. A quick search on Clojure JIRA reveals couple of discussions, [this 
one|https://dev.clojure.org/jira/browse/CLJ-260?focusedCommentId=23453=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-23453]
 
maybe the most relevant.

In our case, we also wrote a piece of Java code to set up the threads 
context classloader so that RT can load itself.

ClassLoader ccl = Thread.currentThread().getContextClassLoader();
   try {
   Thread.currentThread().setContextClassLoader(this.getClass().
getClassLoader());
   RT.init();
   Var.pushThreadBindings(RT.map(RT.USE_CONTEXT_CLASSLOADER, RT.F));
   } finally {
   Thread.currentThread().setContextClassLoader(ccl);
   }



I think it might be neat to have a way to allow the RT to load itself from 
the classloader that loaded the RT class itself, instead of the thread's 
context classloader. A system property might be enough, but I started to 
think about a way to specify this even in a gen-classed. This would need 
less "glue", since a gen-classed class causes the RT class to load, in 
which case there is a need for callsite glue to setup the thread's context 
classloader.

Maybe a new JIRA ticket might be a good place for the discussion :)

- Kimmo

torstai 7. helmikuuta 2019 23.02.24 UTC+2 henrik42 kirjoitti:
>
> Rastko - thanks for the reply. My 
> /modules/buttle/main/module.xml looks like this:
>
> 
> 
>   
> 
>   
>   
> 
>  
>   
>  
>
> And the driver in standalone.xml:
>
> 
>   
> 
>
> The loading of my classes incl. clojure.lang.RT works "in
> principle". Only when Clojure uses the TCCL to load clojure/core.clj 
> things fail. To see what's
> happening I changed
> java/buttle/SetContextClassLoaderInStaticInitializer.java to:
>
> package buttle;
> public class SetContextClassLoaderInStaticInitializer {
> static {
> ClassLoader tccl = 
> Thread.currentThread().getContextClassLoader();
> System.out.println("tccl = " + tccl);
> System.out.println("tccl sees clojure/core.clj at " + 
> tccl.getResource("clojure/core.clj"));
> ClassLoader myCl = 
> SetContextClassLoaderInStaticInitializer.class.getClassLoader();
> System.out.println("myCl = " + myCl);
> System.out.println("myCl sees clojure/core.clj at " + 
> myCl.getResource("clojure/core.clj"));
> 
> Thread.currentThread().setContextClassLoader(SetContextClassLoaderInStaticInitializer.class.getClassLoader());
> }
> }
>
> I get:
>
> tccl = ModuleClassLoader for Module "org.jboss.as.controller" version 
> 4.0.0.Final from local module loader @6adca536
>(finder: local module finder @357246de (roots: 
> C:\henrik\wildfly-12.0.0.Final\modules,C:\henrik\wildfly-12.0.0.Final\modules\system\layers\base))
> tccl sees clojure/core.clj at null
> myCl = ModuleClassLoader for Module "buttle" from local module loader 
> @6adca536 (finder: local module finder @357246de
>(roots: 
> C:\henrik\wildfly-12.0.0.Final\modules,C:\henrik\wildfly-12.0.0.Final\modules\system\layers\base))
> myCl sees clojure/core.clj at 
> jar:file:/C:/henrik/wildfly-12.0.0.Final/modules/buttle/main/./buttle-standalone.jar!/clojure/core.clj
>
> I checked that my class and clojure.lang.RT are loaded with the same 
> classloader. So the TCCL which Wildfly puts into
> place cannot load clojure/core.clj. But the (module) classloader which 
> loaded my class and clojure.lang.RT CAN load it. That's
> why I came up with the idea of replacing the TCCL before 
> clojure.lang.RT runs.
>
> I believe that the way Wildfly uses the different classloaders is 
> absolutly on purpose. In [1] you find
> arguments for why libraries should not use the TCCL for certain things. 
> And one could argue, that Clojure
> is doing it the wrong way.
>
> I believe that the existence of clojure.core/*use-context-classloader* is 
> due to someone realizing that there are
> cases when you cannot use the TCCL (like in mine). In my case though I 
> just can't set that var because of the chicken-egg-problem
> as I pointed out.
>
> I think that adding additional dependencies or adding exports won't
> change the Module-"org.jboss.as.controller"-classloader. But I'll check 
> tomorrow.
>
> One solution that comes to mind is to change clojure.lang/RT so that the 
> *use-context-classloader* var is not initialized to
> true but to (Boolean/parseBoolean (System/getProperty 
> "clojure.use-context-classloader" "true"))
>
> Henrik
>
> [1] https://developer.jboss.org/wiki/ModuleCompatibleClassloadingGuide
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that 

Re: [ANN] clj-memory meter – measure the memory used by arbitrary objects

2018-04-17 Thread Kimmo Koskinen
We just tried this library with a colleague while trying to track down a 
memory leak when parsing a jdbc result set and saw a stunning victory :)
With clj-memory-meter we were able to see that lazy parsing of json strings 
left references to quite large buffers (in comparison to actual data) to 
each item in the sequence, while strict parsing naturally removed the 
problem.

clj-memory-meter showed it's usefulness, so a big thanks for the library! :)

keskiviikko 7. maaliskuuta 2018 18.13.23 UTC+2 Alexander Yakushev kirjoitti:
>
> Looks like it's because of JDK9. I created a Github issue, let's take it 
> there: https://github.com/clojure-goes-fast/clj-memory-meter/issues/1
>
> On Wednesday, March 7, 2018 at 5:49:07 PM UTC+2, 路Ricardo M. wrote:
>>
>> Java Version:
>> java version "9.0.4"
>> Java(TM) SE Runtime Environment (build 9.0.4+11)
>> Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
>> System: Arch Linux
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Any better client then telnet for connecting to a socket repl server?

2018-03-04 Thread Kimmo Koskinen
Hi!

There are quite impressive socket repl clients such as 
https://github.com/Unrepl/unravel and https://github.com/Unrepl/spiral (for 
Emacs) both of which use the unrepl protocol https://github.com/unrepl/unrepl.

- Kimmo

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] lein-jlink: A leiningen plugin for custom JRE creation

2018-02-11 Thread Kimmo Koskinen
Just whistling in that there's a project, that has tree-shaker similar to 
proguard, but written (partly) in 
Clojure: https://github.com/portkey-cloud/portkey
Portkey has been a bit dormant for a while, but we had some success as 
minimizing amount of bytecode that's shipped to AWS Lambda, to keep a 
repl-like development experience.

tiistai 30. tammikuuta 2018 18.10.32 UTC+2 Laurens Van Houtven kirjoitti:
>
> This is great! Thanks Ning! Do you have any experience/pointers/projects 
> around reducing deployable size on the code side (as opposed to runtime)? 
> They seem like very related concerns. I've messed with proguard but it 
> mostly seems to be great at producing jars that are 10% of the size and 
> don't actually work ;-)
>
> On Tue, Jan 30, 2018 at 8:24 AM, Ning Sun  > wrote:
>
>> Hi clojurians,
>>
>> I just created a Leiningen plugin that creates custom Java Runtime
>> Environment based on you configuration. The custom JRE can be as small
>> as 29MB, and it's fully capable to run a Ring web app.
>>
>> With this plugin:
>> 0. You can test your Clojure application against the custom JRE;
>> 1. You can distribute your Clojure application with runtime attached and
>> don't have to assume your user has JRE installed;
>> 2. You can create minimal Docker image for your Clojure service, it
>> takes less than 50MB at minimal setup, comparing to others can be 350MB+;
>> 3. You discover.
>>
>> The plugin is here:
>> https://github.com/sunng87/lein-jlink
>>
>> I have a blog post about it:
>> https://sunng.info/blog/custom-jre-for-clojure-app-distribution.html
>>
>> And I'd like to hear your ideas about it.
>>
>> Don't forget it requires JDK9 or 10. Because jlink is a feature
>> introduced in JDK9.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reducing Jar file size for AWS Lambda

2017-07-24 Thread Kimmo Koskinen
Hi!

Not yet Clojars -ready so lein install for now. There is also #portkey on 
Clojurians Slack for chatting. Happy hacking! :)

- Kimmo

maanantai 24. heinäkuuta 2017 8.24.29 UTC+3 Jose Trigueros kirjoitti:
>
> This looks like a viable solution! Is Portkey on Clojars or will I have to 
> build myself? Not a problem either way, just making sure I'm doing it 
> right. Thanks Kimmo.
>
> On Sunday, July 23, 2017 at 2:35:37 AM UTC-6, Kimmo Koskinen wrote:
>>
>> Hi!
>>
>> Although still at early stages, check out portkey 
>> https://github.com/cgrand/portkey. 
>>
>> Portkey does tree-shaking by starting from a closure to minimize 
>> resulting jar size. Uses kryo and implementation of var tracing started in 
>> powderkeg project (https://github.com/HCADatalab/powderkeg)
>> . 
>>
>> pk/deploy can lift (an anonymous) function with [in out ctx] args as a 
>> Lambda function. pk/mount can expose a defn through API gateway with query 
>> params mapped to function arguments. 
>>
>> Christophe Grand and I have been working on portkey for now, but we'd 
>> welcome additional help on making it more awesome :) 
>>
>> - Kimmo
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reducing Jar file size for AWS Lambda

2017-07-23 Thread Kimmo Koskinen
Hi!

Although still at early stages, check out portkey 
https://github.com/cgrand/portkey. 

Portkey does tree-shaking by starting from a closure to minimize resulting jar 
size. Uses kryo and implementation of var tracing started in powderkeg project 
(https://github.com/HCADatalab/powderkeg)
. 

pk/deploy can lift (an anonymous) function with [in out ctx] args as a Lambda 
function. pk/mount can expose a defn through API gateway with query params 
mapped to function arguments. 

Christophe Grand and I have been working on portkey for now, but we'd welcome 
additional help on making it more awesome :) 

- Kimmo

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2016-03-19 Thread Kimmo Koskinen
This could be React on desktop, +1 for that :)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Embedded systems and transpiling Clojure to Nim

2015-05-02 Thread Kimmo Koskinen
Hi,

Wanted to mention two more languages, that might be interesting:

Hy: http://docs.hylang.org/en/latest/ (Lisp that targets Python's AST, has 
Clojure flavoured syntax)
newLISP: http://www.newlisp.org/ (at least FFI seems simple: 
http://www.newlisp.org/newlisp_manual.html#import)

- Kimmo

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.