You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Matthew Broadhead (JIRA)" <ji...@apache.org> on 2015/10/12 18:15:05 UTC

[jira] [Resolved] (TOMEE-1637) JAX-RS cannot access GlobalNamingResources

     [ https://issues.apache.org/jira/browse/TOMEE-1637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthew Broadhead resolved TOMEE-1637.
--------------------------------------
    Resolution: Not A Problem

> 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)