java-ee

Localized text in Java

≡放荡痞女 提交于 2019-12-25 04:55:24
问题 My requirement is to display localized text messages in a J2EE web application. I know J2EE provides very good support for this. My question is what is the practice followed to have the localized messages stored to be used by the application. If I want to display Japanese / Chinese kind of messages which are not like English like char sets how do we get that messages/text into the properties files or Database tables. 回答1: Resource Bundle. The basic idea is for all text to be localized

java.lang.IllegalStateException: Not Suspended when AsyncContext#complete()

末鹿安然 提交于 2019-12-25 04:47:51
问题 sometimes my Servlet ends with this exception: WARNING: StandardWrapperValve[HeartBeatServlet]: PWC1406: Servlet.service() for servlet HeartBeatServlet threw exception java.lang.IllegalStateException: Not Suspended at com.sun.grizzly.tcp.Response.resume(Response.java:768) at org.apache.catalina.connector.Request.asyncComplete(Request.java:3993) at org.apache.catalina.connector.AsyncContextImpl.complete(AsyncContextImpl.java:242) at com.northcane.talkeen.HeartBeatServlet.doPost

class com.sun.jersey.core.header.FormDataContentDisposition of content type: multipart/form-data;

寵の児 提交于 2019-12-25 04:41:28
问题 I'm trying to upload a file using REST API (I'm using wildfly Server), and I'm getting this error: failed to execute: javax.ws.rs.NotSupportedException: Could not find message body reader for type: class com.sun.jersey.core.header.FormDataContentDisposition of content type: multipart/form-data; This my code: @javax.ws.rs.ApplicationPath("webresources") public class ApplicationConfig extends Application { @Override public Set<Class<?>> getClasses() { Set<Class<?>> resources = new java.util

Having hard time to publish files to Tomcat from Eclipse

ぐ巨炮叔叔 提交于 2019-12-25 04:39:06
问题 Sorry if my question seems dumb. I've started using Eclipse Ganymede 3.4 this week and having hard time publishing my projects to the web app server. First of all you need to know this issue: i installed my Tomcat 6.0.18 from Netbeans that i use for PHP and J2SE project. While i can start that server from either Netbeans or Eclipse, it can not start manually for some reason even though i setup my JAVA_HOME correctly pointing to jdk/bin it's saying it's a jre. it a bit weird but i can use the

What would be the best way to match up two object instances between two different applications in a J2EE server?

谁说胖子不能爱 提交于 2019-12-25 04:32:37
问题 I have a J2ee application where I basically want two objects, created by two separate servlets to communicate directly and I need these intances to be stable, i.e. to "know" each other during the session. The sequence is roughly: Client sends a request to Servlet #1, which creates object A Client sends a second request (after the first returns) to servlet #2 which creates object B. Object B finds A, using JNDI, and the two objects interact. The client now continues to send requests to object

JPA/Hibernate Query Slow with too many queries

老子叫甜甜 提交于 2019-12-25 04:12:07
问题 I have two entities Employee and Department The Employee entity is a read-only dataset for my application (I don't own this table) The table data backing the Department Entity I do own. If I query my Employee entity without annotating a Department to Employee entity relationship, the query is superfast because it produces only one SQL call. As soon as I annotate the Department relationship into the Employee entity, there are a ton of SQL calls. Here are what I think are the pertinent details

How to find the path to a .txt file in glassfish v3.0

十年热恋 提交于 2019-12-25 03:57:16
问题 In my aplication i want to send a html template to the users email. Everithing works correctly when i programatically create the html, but what i want to do now, is read the html text from within a file in my application and send it. I get a FileNotFoundException, and i dont know how to find that .txt file. See the code: public void sendAccountActivationLinkToBuyer(String destinationEmail, String name) { // Destination of the email String to = destinationEmail; String from = "myEmail@gmail

Number format exception when returning values from database(JPA)

倖福魔咒の 提交于 2019-12-25 03:51:30
问题 I want to fill a simple h:datatable tag with some values from a database. But i get an exception and i cant find what is the reason: java.lang.NumberFormatException: For input string: "url" This is how i create the datatable: <h:form> <h:dataTable value="#{managementBB.retrieveRecords()}" var="record"> <h:column> <f:facet name="header">URL</f:facet> #{record.url} </h:column> <h:column> <f:facet name="header">Submition date</f:facet> #{record.submitionDate} </h:column> <h:column> <f:facet name

Number format exception when returning values from database(JPA)

廉价感情. 提交于 2019-12-25 03:51:18
问题 I want to fill a simple h:datatable tag with some values from a database. But i get an exception and i cant find what is the reason: java.lang.NumberFormatException: For input string: "url" This is how i create the datatable: <h:form> <h:dataTable value="#{managementBB.retrieveRecords()}" var="record"> <h:column> <f:facet name="header">URL</f:facet> #{record.url} </h:column> <h:column> <f:facet name="header">Submition date</f:facet> #{record.submitionDate} </h:column> <h:column> <f:facet name

How to use the same ContainerRequestFilter for multiple projects?

谁说我不能喝 提交于 2019-12-25 03:39:10
问题 I have two projects A and B in which B has dependency on A. So all the classes of A are available to B. Now, I've defined a ContainerRequestFilter for intercepting some information from request. This is getting invoked if I call the end points of project A. But it's not getting invoked if I call end points of project B. Obviously, the context roots of project A and project B are different. Example: http://localhost:8080/projecta/..... http://localhost:8080/projectb/..... Both the projects are