Skip to content

Instantly share code, notes, and snippets.

View josetesan's full-sized avatar

Jose Luis Sánchez josetesan

View GitHub Profile
@josetesan
josetesan / gist:295b2cbba36a4e43f653
Created November 9, 2015 21:29
tomcat jndi spring boot error
o.a.catalina.core.NamingContextListener : Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory]
@josetesan
josetesan / permgen.md
Created November 14, 2017 10:16 — forked from JDatta/permgen.md
JAVA: Debugging a permgen leak

JAVA: Debugging a permgen leak

Out of memory errors in java can some time mean a memory leak in application. One class of those memory errors are related to memory pressure in permgen. This is typically identified by exception message like Root Cause Exception: java.lang.OutOfMemoryError: PermGen space

As memory management is done by jvm, identifying and debugging memory leaks in java can be tricky. In case of permgen leaks, more so. Reasons for this include:

  • Permgen leaks are rare
  • More often than not; out of memory errors due to permgen space is not a leak but a legitimate case of memory crunch. In which case you either need to allocate more memory to permgen using -XX:MaxPermSize jvm parameter or strip down your libraries and dependencies.
@josetesan
josetesan / AiApp.java
Created February 22, 2024 15:35
Use jbang to query Ollama to help you with AI
//DEPS io.quarkus.platform:quarkus-bom:3.7.4@pom
//DEPS io.quarkiverse.langchain4j:quarkus-langchain4j-openai:0.8.3
//Q:CONFIG quarkus.langchain4j.openai.base-url=http://localhost:11434/v1/
//Q:CONFIG quarkus.langchain4j.openai.api-key=ollama
//Q:CONFIG quarkus.langchain4j.openai.chat-model.model-name=gemma
//Q:CONFIG quarkus.langchain4j.openai.timeout=60s
import dev.langchain4j.model.chat.ChatLanguageModel;
import io.vertx.ext.web.Router;
import jakarta.enterprise.event.Observes;
// run with jbang AiApp.java