java-ee

AsyncContext and I/O error handling (when peer disconnects)

人盡茶涼 提交于 2019-12-12 07:19:15
问题 I'm implementing Server-Sent Events using Servlet 3.0's javax.servlet.AsyncContext interface. However I can't understand how I should handle I/O errors like peer disconnect. For a given AsyncContext ac = request.startAsync() , I can call ac.getResponse().getWriter().print(something) and then ac.getResponse.getWriter().flush() and it works fine. However when a client disconnects, I don't get an error - even if I attach a listener, its onError method is not called. I tested it with both Jetty 8

How to find out where the Property name defined inside Linux Machiene?

狂风中的少年 提交于 2019-12-12 06:57:21
问题 I am using Linux machine, remotely through putty, for deploying our Java EE Application. Inside the Tomcat server folder I need to find a property called bayer.home . I have used the following command: grep bayer.home /home/HHHuser/tomcat to check if the property exists inside the Tomcat folder. Please tell me is this correct or not? If it's incorrect could anybody please tell me where the property names, say bayer.home , most probably would be defined? 回答1: grep 'bayer.home' /home/HHHuser

Spring + Hibernate populating holder class with values from DB

◇◆丶佛笑我妖孽 提交于 2019-12-12 06:47:40
问题 For my web app I will loading a few details from the static DB tables which I plan to load when the container starts up on a HolderClass in a singleton bean. I will inject this class wherever I wish to use the static data. So basically I want to avoid loading the static data everytime from DB Current Implementation: public Class CountryHolder(){ List<Country> allCountries; public void init(){ this.countries = loadAllCountries; } public List<Country> loadAllCountries(){ // Perform DB select

JPA entity is not correctly passed from EJB to Presentation Tier

独自空忆成欢 提交于 2019-12-12 06:37:42
问题 I am trying to pass a set of JPA entity from the business tier to the presentation tier. All is deployed on the same app server (Glassfish 4). The client is deployed as a .war file, while the Business Tier as an .ear with the ejb reachable trough a Remote interface. For this I have those very simple methods, with absolutely no logic: Client public List<CompletedDesign> selectCompletedDesigns() { try { List<CompletedDesign> designs = customerFacade.selectCompletedDesigns(); return designs; }

Select certain CDI event observer

房东的猫 提交于 2019-12-12 06:17:11
问题 I have a few classes that observe some CDI event. Is it possible to declare which class should be used in different cases? For example I have class that produce events: class Producer { @Inject private Event<SomeEvent> event; public void fire() { event.fire(new SomeEvent()); } } And I have two consumer classes: class ConsumerA { public void onEvent(@Observes SomeEvent event); } class ConsumerB { public void onEvent(@Observes SomeEvent event); } How can I use ConsumerA instances in one case

Third Party Download Managers issue with Struts2 File download link

余生颓废 提交于 2019-12-12 05:57:39
问题 I am getting java.lang.IllegalStateException: getOutputStream() has already been called for this response when user clicks on a download link in my struts2 web application. This exception occurs only when the client has third-party download managers installed in their machines like Internet Download Manager. Without IDM or any other third party download managers, our code runs fine without any exception. Solutions we have tried are : We have observed that IDM sends requests to the server in

Is it possible to write on a properties file inside a .war?

好久不见. 提交于 2019-12-12 05:47:19
问题 I see a lot of how to read the file or locate it, but I've been trying to run Properties.store() and it simple does not modify the file. I can read, get and set properties but store doesn't work. Should it work or is not meant to work? If it doesn't work, how can I modify the file, so when the server restart those properties do not get lost? 回答1: No; it's inside a WAR. Technically you could un-zip it, modify it, zip it back up. But don't. Properties like that should be stored in a DB, in JNDI

Placeholder in resource bundles

喜你入骨 提交于 2019-12-12 05:38:22
问题 I need some placeholders with automatic filling in my resource bundle. An user of my application has two possible configuration, for example "1" and "2". Depending on this configuration, an entry should returned with the correct value. I know, that conditions are possible: currentConfig=The configuration is currently the {0,choice,0#first|1#second} In my faces-config.xml the resource bundle is configured for access in JSF. Now, I want to get this value in JSF without specifying parameters: <h

Caused by: javax.naming.NameNotFoundException - Name [Class/object] is not bound in this Context

落爺英雄遲暮 提交于 2019-12-12 05:34:24
问题 have a problem that am dealing with since 6 hours but don't get to solve it. Am developping a Dynamic web project using JSF/Tomcat 7/ Maven/Java 7 Everytime I run the project on the server I get this: javax.naming.NameNotFoundException: Name [....ProjectManagement/service] is not bound in this Context. Unable to find [de.hhn.team3.artzpraxismanagement.ProjectManagement]. at org.apache.naming.NamingContext.lookup(NamingContext.java:820) at org.apache.naming.NamingContext.lookup(NamingContext

Exception when using taglibs in Glassfish 3.1

与世无争的帅哥 提交于 2019-12-12 05:27:57
问题 I'm getting the following error while trying to deploy my app in Glasfish 3.1 org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP PWC6197: An error occurred at line: 16 in the jsp file: /WEB-INF/jsp/signup/signup.jsp PWC6199: Generated servlet error: string:///signup_jsp.java:233: package org.springframework.web.servlet.tags.form does not exist The spring jars are in the lib directory of my webapplication. I'm using: Spring 3.1.3 Glassfish 3.1.1 (started using the