tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Broadhead (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TOMEE-1637) JAX-RS cannot access GlobalNamingResources
Date Mon, 12 Oct 2015 15:17:05 GMT
Matthew Broadhead created TOMEE-1637:
----------------------------------------

             Summary: JAX-RS cannot access GlobalNamingResources
                 Key: TOMEE-1637
                 URL: https://issues.apache.org/jira/browse/TOMEE-1637
             Project: TomEE
          Issue Type: Bug
          Components: TomEE Core Server
    Affects Versions: 1.7.2
            Reporter: Matthew Broadhead


Trying to use mysql jdbc in JAXRS results in javax.naming.NameNotFoundException: Name "jdbc/MySQL"
not found.global naming resources even though it is defined in server.xml

@Path("/search")
@Produces(MediaType.APPLICATION_JSON)
public class SearchService {
	@Path("/test")
	@GET
	public List<Someobejct> test) {
		rContext context = null;
			Connection connection = null;
			PreparedStatement preparedstatement = null;
			ResultSet resultset = null;
			try {
				context = new InitialContext();
				DataSource datasource = (DataSource) context
						.lookup("java:comp/env/jdbc/MySQL");
				connection = datasource.getConnection();
				preparedstatement = connection.prepareStatement(temp,
						Statement.RETURN_GENERATED_KEYS);
...ETC
	}
}





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message