Posts

Showing posts from 2012

Resolving OutOfMemoryError: unable to create new native thread

(This was tested on Red Hat EL6 JDK 1.6.31 64-bit) If you've ever come across this error, it can be very misleading. Caused by: java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:640) The common suggestion (as the error suggests) is a memory related problem. Some tips but ultimately unhelpful: http://candrews.integralblue.com/2009/01/preventing-outofmemoryerror-native-thread/ http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html The common theme amongst all of them is the stack size. Came across this post with same test code: http://www.odi.ch/weblog/posting.php?posting=411 However the tests were inconsistent, modified it to only go 50 calls deep. Modified code here . We discovered that changing the options made very little difference to the maximum number of threads. Originally we thought it...

Bulk upload of maven artifacts to remote repo

If you have an artifact you want to upload to a remote repository (i.e. internal company repo) then you use the command: mvn deploy:deploy-file -Durl=file://C:\m2-repo \ -DrepositoryId=some.id \ -Dfile=your-artifact-1.0.jar \ [-DpomFile=your-pom.xml] \ However if you have more than a few files and they're in a nested directory structure (like your local repo) then this is not the way to do it. There doesn't seem to be any tool for either maven or nexus to do this, so here's a quick and dirty way I hacked together: /** * run as java Importer [dirtosearch] **/ public class Importer { private String directory; private final static String repositoryId = "repo1"; private final static String url = "http://remoteserver/nexus/content/repositories/repo1/"; private final static String mvn = "C:/java/apache-maven-3.0.3/bin/mvn.bat"; /** * @param directory */ ...