Skip to content

Instantly share code, notes, and snippets.

View gist:c73ee974a706491265d9
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%C - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="example.logger.name" level="debug"/>
<Root level="debug">
@kevinhooke
kevinhooke / gist:6f7cd1a83da09dad813d
Created Oct 4, 2014
Log4j 1.x basic log4j.properties
View gist:6f7cd1a83da09dad813d
log4j.rootLogger=DEBUG, console
#console appender
log4j.appender.console=org.apache.log4j.ConsoleAppender
#define patternlayour for console appender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
View gist:d1ead9a8bed8c3c57736
<dependency>
<groupId>javaee</groupId>
<artifactId>javaee-api</artifactId>
<version>5</version>
<scope>provided</scope>
</dependency>
View gist:7db4a60c1b8cc2c2c6c4
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
View gist:52eae47ad0ca9ee0b09e
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
@kevinhooke
kevinhooke / gist:97f5142d4859287c1492
Last active Aug 29, 2015
Disable JAXP DTD loading and validation
View gist:97f5142d4859287c1492
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
dbf.setNamespaceAware(true);
//one of these pairs of properties will work depending on which xml api impl is in use
dbf.setFeature("http://xml.org/sax/features/namespaces", false);
dbf.setFeature("http://xml.org/sax/features/validation", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
View gist:804ae15dbfaffc064805
wsimport -keep -p package.name url_to_wsdl
View gist:c15de1307a3013a8193c
<?xml version="1.0"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd" />
@kevinhooke
kevinhooke / gist:5daf864a0f9a58bd2c96
Created Apr 14, 2015
JPA persistence.xml with JTA and Weblogic transaction manager
View gist:5daf864a0f9a58bd2c96
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="SimplePU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/datasourcename</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create" /> <!-- remove this if not creating tables at init -->
<property name="hibernate.show_sql" value="true" />
@kevinhooke
kevinhooke / gist:85d5b2d5864fd9835cc4
Created Jul 2, 2015
Standalone persistence.xml against MySQL
View gist:85d5b2d5864fd9835cc4
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="TestPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>list entities here if running as standalone app</class>
<properties>