Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Configure id="Server" class="org.eclipse.jetty.server.Server">
- <New id="myLocalDB" class="org.eclipse.jetty.plus.jndi.Resource">
- <Arg></Arg>
- <Arg>jdbc/myLocalDB</Arg>
- <Arg>
- <New class="org.apache.commons.dbcp2.BasicDataSource">
- <Set name="driverClassName">org.postgresql.Driver</Set>
- <Set name="url">jdbc:postgresql://localhost:5432/my_local_db</Set>
- <Set name="username">user</Set>
- <Set name="password">***</Set>
- <Set name="defaultAutoCommit">false</Set>
- </New>
- </Arg>
- </New>
- </Configure>
- @Override
- public DataSource getJtaDataSource() {
- try {
- Context ctx = (Context) new InitialContext().lookup("java:jboss/datasources");
- return (DataSource) ctx.lookup("sensurisDB");
- } catch (NamingException e) {
- e.printStackTrace();
- return null;
- }
- }
Add Comment
Please, Sign In to add comment