java-ee

ThreadLocal usage in enterprise application

安稳与你 提交于 2019-12-18 12:21:19
问题 If my web application and ejb application are on the same machine (on same JVM) and all the ejb calls are local calls , will the use of ThreadLocal create any issue while passing information from web to ejb? Any workaround if the ejb calls are remote? Will ThreadLocal information be available from web application to ejb application? Is use of ThreadLocal advisable in such scenario? 回答1: For the first question, there is no problem as long as you remove the ThreadLocal variables at the end of

How to consume a SOAP web service in Java

心不动则不痛 提交于 2019-12-18 12:18:59
问题 Can someone please help me with some links and other on how to consume a web service WSDL in Java? 回答1: I will use CXF also you can think of AXIS 2 . The best way to do it may be using JAX RS Refer this example Example: wsimport -p stockquote http://stockquote.xyz/quote?wsdl This will generate the Java artifacts and compile them by importing the http://stockquote.xyz/quote?wsdl. I 回答2: There are many options to consume a SOAP web service with Stub or Java classes created based on WSDL. But if

Serializing JPA entities to JSON using Jackson

爷,独闯天下 提交于 2019-12-18 12:08:38
问题 Question regarding combination of Jackson/JPA If there are about 20 entities in current application and I have add Jackson dependency in POM, does it mean all entities are by default ready to convert to JSON object? I saw a sample project seems only class annotated as @JsonIgnored is skipped by JSON . If so, then how can this happen, what is behind such mechanism? how JACKSON handle those entities which don't have any Jackson annotation, by default ignored or not? I've been looking for

Java EE declarative security, Cannot load group for JDBC realm user

拟墨画扇 提交于 2019-12-18 12:06:19
问题 It is my first post here. I would have two questions with regard to declarative Java EE security: (1) file-based authentication and (2) DB-based authentication. I enclosed the relevant parts of the configuration for both questions. I run the code on Glassfish 3.1.1. Thank you for your assitance also in advance. I was also looking for answers to my questions and found some useful examples which I put also at the bottom of the message. I tried to follow them so the present state of the

In what situations are EJBs used ? Are they required in websites/ web-application development?

家住魔仙堡 提交于 2019-12-18 12:03:02
问题 Are EJBS used in database backed websites(that are accessible to all)? 回答1: Nothing is ever required of course. If you wanted you could build a web-application as a single large C function behind CGI . That said, EJBs do make web application development a lot easier. It's not for nothing that they are included in the ultra-lightweight Web Profile of Java EE 6. EJB does not contain any Database APIs of itself, but it integrates extremely well with JPA. You can inject the EntityManager in it,

java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver

拜拜、爱过 提交于 2019-12-18 12:00:54
问题 I'm using Eclipse EE Kepler and I'm trying to run derby in my program. I added to my build path derby.jar and derbyclient.jar and still I'm getting the following error: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver . Can someone help me with solving this problem? 回答1: I stuck with the same problem 'java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver'. In my case, scope attribute is set to test <!-- https://mvnrepository.com/artifact/org.apache.derby

Is it possible to make @Formula annotation lazily loaded?

别来无恙 提交于 2019-12-18 11:59:32
问题 I have used @Formula annotation to use it for getting calculated properties. What I need is that those fields/getters which is annotated with @Formula annotation should be lazily loaded. Is this even possible and if so how? thanks 回答1: Yes . Just annotating the fields/getter of the @Formula property by @Basic(fetch=FetchType.LAZY) and use this ant task provided by hibernate to do the bytecode instrumentation for the entity class. Otherwise , LAZY loading for the @Formula property is silently

AnnotationException Referenced property not a (One|Many)ToOne

烂漫一生 提交于 2019-12-18 11:57:45
问题 I tried to make one-to-one relationship. But I get error: AnnotationException Referenced property not a (One|Many)ToOne on com.student.information.service.Department.departmentId in mappedBy of com.student.information.service.DepartmentHead.department Both the entities are almost identical. Department can exists with out department head. Department.Java @Entity @Table(name="department", catalog="student") public class Department { @Id @GeneratedValue(strategy=GenerationType.AUTO) private

Class “model.Address” is listed in the persistence.xml file but not mapped

↘锁芯ラ 提交于 2019-12-18 11:43:25
问题 I have created a JPA project. In that Eclipse displays the following error on the entity class. Class "model.Address" is listed in the persistence.xml file but not mapped How am I supposed to map the entity class in persistance.xml ? Here is the model.Address entity: package model; import java.io.Serializable; import javax.persistence.*; @Entity public class Address implements Serializable { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) private long id; private String city; private

tcnative-1.dll Can't load AMD 64-bit .dll on a IA 32-bit platform

半城伤御伤魂 提交于 2019-12-18 11:42:24
问题 I'm getting this error when I try to run tomcat: "java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\apache-tomcat-7.0.34\bin\tcnative-1.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform". However, I have the 64 bit JRE downloaded, and double-checked my java version: C:\Program Files (x86)\apache-tomcat-7.0.34\bin>java -version java version "1.7.0_10" Java(TM) SE Runtime Environment (build 1.7.0_10-b18) Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode) I've seen this