java-ee-7

Java EE 7 Application not deploying on Glassfish 4 Sever after switching from Mojarra to MyFaces

こ雲淡風輕ζ 提交于 2020-01-16 07:16:08
问题 Currently we have a problem when we try to deploy our Java EE 7 application to a glassfish 4.0 server. Before we changed the JSF implementation from JSF Mojarra 2.2.0 to MyFaces 2.2.2 it worked pretty well. Heres the error log: >2014-03-24T16:05:42.356+0100|Schwerwiegend: Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI? 2014-03-24T16:05:42.357+0100|Schwerwiegend: Die Anwendung wurde bei Systemstart nicht einwandfrei

Java EE 7 Application not deploying on Glassfish 4 Sever after switching from Mojarra to MyFaces

狂风中的少年 提交于 2020-01-16 07:16:05
问题 Currently we have a problem when we try to deploy our Java EE 7 application to a glassfish 4.0 server. Before we changed the JSF implementation from JSF Mojarra 2.2.0 to MyFaces 2.2.2 it worked pretty well. Heres the error log: >2014-03-24T16:05:42.356+0100|Schwerwiegend: Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI? 2014-03-24T16:05:42.357+0100|Schwerwiegend: Die Anwendung wurde bei Systemstart nicht einwandfrei

How to send data from android to google app engine web app made in java

梦想的初衷 提交于 2020-01-16 02:05:51
问题 private String s; EditText numDisplay; Button calculateNow; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); numDisplay= (EditText)findViewById(R.id.editText1); calculateNow = (Button)findViewById(R.id.button1); //s=numDisplay.toString(); calculateNow.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { { new MyAsyncTask().execute(numDisplay.getText().toString()); } } } ); }

Find websocket session by id in Java EE 7

旧巷老猫 提交于 2020-01-14 10:09:43
问题 I've read Java EE documentation and for me is unclear one thing. According to API, the only way to find another Session is a code like this: (assuming that we've identifier of other session): import javax.websocket.Session; ... private static Session findOtherSessionById(Session user, String id) { for (Session session : user.getOpenSessions()) { if (id.equals(session.getId())) { return session; } } return null; } But when we've thousands of users, this code is a performance bottleneck. So, is

Find websocket session by id in Java EE 7

白昼怎懂夜的黑 提交于 2020-01-14 10:09:26
问题 I've read Java EE documentation and for me is unclear one thing. According to API, the only way to find another Session is a code like this: (assuming that we've identifier of other session): import javax.websocket.Session; ... private static Session findOtherSessionById(Session user, String id) { for (Session session : user.getOpenSessions()) { if (id.equals(session.getId())) { return session; } } return null; } But when we've thousands of users, this code is a performance bottleneck. So, is

How to write main() using CDI in Java EE?

时光总嘲笑我的痴心妄想 提交于 2020-01-14 04:24:34
问题 I have a no-client application that I wish to run. It will have no clients but it will make HTTP calls and act as client for other services. It would run for perhaps a few hours or days (but it will not require periodic runs -- just one-shot). I want to run it in a Java EE 7 container, because of the benefits of standard Context Dependency Injection (CD), and a standard JAX-RS client (new since Java EE 7). It is also nice to have services such as JMS, JPA. The question is how do I write /

Getting a reference to EntityManager in Java EE applications using CDI

人盡茶涼 提交于 2020-01-09 08:43:31
问题 I'm using Java EE 7. I would like to know what is the proper way to inject a JPA EntityManager into an application scoped CDI bean. You can't just inject it using @PersistanceContext annotation, because EntityManager instances are not thread safe. Let's assume that we want our EntityManager to be created at the beginnig of every HTTP request processing and closed after the HTTP request is processed. Two options come into my mind: 1. Create a request scoped CDI bean which has a reference to an

Application context path at JAX-RS 2.0 resource instance construction

北战南征 提交于 2020-01-06 14:45:15
问题 Is it possible to get the context path for a Java EE 7 application at JAX-RS 2.0 resource class instance construction time (and possibly at static class initialization time, too), or is it only available during requests to endpoints in the resource class? By context path I mean the String that would be returned by a call to a HttpServletRequest#getContextPath() within the Java EE 7 application. I imagine that you probably could have multiple context path aliases for a deployed application. If

Application context path at JAX-RS 2.0 resource instance construction

删除回忆录丶 提交于 2020-01-06 14:45:14
问题 Is it possible to get the context path for a Java EE 7 application at JAX-RS 2.0 resource class instance construction time (and possibly at static class initialization time, too), or is it only available during requests to endpoints in the resource class? By context path I mean the String that would be returned by a call to a HttpServletRequest#getContextPath() within the Java EE 7 application. I imagine that you probably could have multiple context path aliases for a deployed application. If

Derby java sql exception

僤鯓⒐⒋嵵緔 提交于 2020-01-06 06:59:34
问题 I am trying to start an application on Glassfish 4 server but it gives me some strange exception: Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect. Could it be because I don't have SQL? I am not sure how to fix it. 回答1: You need to start the Derby Network Server, and have it listen on port 1527 on