java-ee

@Dependent @javax.ejb.Singleton versus @ApplicationScoped @javax.ejb.Singleton?

拥有回忆 提交于 2019-12-22 13:55:29
问题 In essence, what is the difference between these two classes: @ApplicationScoped @Singleton class A {} @Dependent @Singleton class B {} Contextual EJB instances I prefer not to use @Inject when looking for EJB:s, unless the EJB is a @Stateful and I want the CDI container to manage the stateful's life-cycle which could be very convenient. Otherwise, using @Inject to retrieve a contextual EJB instance is a bit dangerous. For example, a @Remote client-view cannot be retrieved using CDI unless we

Notification between Java EE components

纵然是瞬间 提交于 2019-12-22 13:53:10
问题 I have a design problem . My application has multiple Java EE components ,In simple terms one acts as a service provider(Non UI) and others are consumers(UI webapp) . The consumer gets the configuration data from the service provider(this basically reads the data from DB) during the start up and stores it in the Cache. The cache gets refreshed after periodic time to reflect any changes done at the database. The Problem Apart from the cache refresh, I also want to notify the consumers when

HTML form method POST calls java servlet doGet method

一曲冷凌霜 提交于 2019-12-22 13:49:30
问题 I have an HTML form like this: form.html: <html> <body> your name is :<br><br> <form ACTION="../post2" METHOD="POST"> <input name="name" type="text" id="name"/> <input name="send" type="submit" value="send"/> </form> </body> <html> The servlet to serve this request: post2.class: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.*; public class post2 extends HttpServlet { protected void doDo(HttpServletRequest request,HttpServletResponse response) throws

HTML form method POST calls java servlet doGet method

被刻印的时光 ゝ 提交于 2019-12-22 13:49:22
问题 I have an HTML form like this: form.html: <html> <body> your name is :<br><br> <form ACTION="../post2" METHOD="POST"> <input name="name" type="text" id="name"/> <input name="send" type="submit" value="send"/> </form> </body> <html> The servlet to serve this request: post2.class: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.*; public class post2 extends HttpServlet { protected void doDo(HttpServletRequest request,HttpServletResponse response) throws

How do I know when a Java EE app is undeployed?

我与影子孤独终老i 提交于 2019-12-22 13:09:11
问题 I need to close some streams when my Java EE app is undeployed to avoid pages of exceptions in the server.log every time I undeploy. The Exceptions say: "Input stream has been finalized or forced closed without being explicitly closed". I know how to close (with the close() method), but I dont know when. finallize() comes too late, @PreDestroy is called not only before undeploying but also in normal operation mode. How does the app know, when it is undeployed? Edit: I call this during

How do I know when a Java EE app is undeployed?

久未见 提交于 2019-12-22 13:08:13
问题 I need to close some streams when my Java EE app is undeployed to avoid pages of exceptions in the server.log every time I undeploy. The Exceptions say: "Input stream has been finalized or forced closed without being explicitly closed". I know how to close (with the close() method), but I dont know when. finallize() comes too late, @PreDestroy is called not only before undeploying but also in normal operation mode. How does the app know, when it is undeployed? Edit: I call this during

What tools are there for timed batch processes in Java EE?

只谈情不闲聊 提交于 2019-12-22 12:44:09
问题 My employer just asked me to run a timed batch process in a Java EE WebSphere application they have running. It's supposed to run a certain class at 11:30 pm everyday. I'm not very familiar with Java EE nor WebSphere server (or tomcat, in the development environment), and I've been digging around but all I've found is about the java timer class but not how to set it or invoke it. It seems that editing the web.xml file is required as well. Any help will be appreciated! 回答1: You should look at

Cant inject Bean class into Restfull WebService (JAX-RS) [duplicate]

亡梦爱人 提交于 2019-12-22 12:38:15
问题 This question already has answers here : Inject an EJB into JAX-RS (RESTful service) (7 answers) Closed 3 years ago . I'm trying to save data acquired by Rest web service to database using hibernate/persistence. In one of my web modules i implemented that service. Database ejb connector is placed in EJB module. They are parts of EAR application. Every time when i call pb.addDevice() im getting java.lang.NullPointerException when puting proper url with params in browser(worked till i wanted to

Spring 3.0 Could not load properties

自作多情 提交于 2019-12-22 12:29:29
问题 Im the getting the following Error/exception when deploying web app: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/WebAppProps] Below is the context tag that Im using in applicationContext.xml to point to WebAppsProps.properties file <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" p:location

Connect to hotmail with javamail?

一笑奈何 提交于 2019-12-22 12:25:10
问题 I wonder if it is possible to connect to Hotmail with JavaMail? I've tried this but it doesn't work, connection refused... String host = "pop3.live.com"; String username = "laqetqetqet@hotmail.com"; String password = "rqetqetq"; Session session; Store store; String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; Properties pop3Props = new Properties(); pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY); pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");