ejb

Differences : @SessionScoped vs @Stateful and @ApplicationScoped vs @Singleton [closed]

梦想与她 提交于 2019-12-18 13:08:31
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I would like to know, what are the principal differences between : javax.enterprise.context.SessionScoped and javax.ejb.Stateful javax.enterprise.context.ApplicationScoped and javax.ejb.Singleton I know that a @SessionScoped and a @Stateful allows to create a new instance for each

Persistence.xml where to put in eclipse project

匆匆过客 提交于 2019-12-18 13:08:30
问题 Simple question... I have a few projects in Eclipse enviroment MainApp(Enterprise Application Project) which "includes" WebController (EJB Project) WebModel (JPA Project) WebView(Dynamic Web Project) Problem is where to put persistance.xml file? Getting exception: java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName DataModel 回答1: The JPA 2.0 specification in section 8.2 states the requirements for packaging. It says A persistence unit is defined by a

How to enable Kerberos authentication for remote EJB call on WebSphere?

与世无争的帅哥 提交于 2019-12-18 12:57:09
问题 My application is a stand-alone Swing client invoking EJB Stateless Session beans thanks to classical JNDI lookup and RMI-IIOP method calls. It is started as a Java WebStart application. My aim is to retrieve the client user's identity from EJBContext with getCallerPrincipal method thanks to Kerberos SSO between the Windows workstation, ActiveDirectory and WebSphere server running on Linux. I have already successfully configured my WebSphere cell in network deployment mode to support Kerberos

Have an EJB schedule tasks with “crontab syntax”

被刻印的时光 ゝ 提交于 2019-12-18 12:33:19
问题 I am trying to figure out the possibilities I have to solve the following problem. a) I want to have a database table that uses "crontab syntax" to schedule tasks, the structure would be something like this: |-Id-|---Crontab Syntax---|---------Task----------| | 1 | 30 * * * * * | MyClass.TaskA(args[]) | | 2 | 0 1 * * 1-5 * | MyClass.TaskB(args[]) | | | | | The above table will be modified at any time by an external application. Tasks added or removed should instantly affect the scheduler. b)

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

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

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,

How to get SessionContext in JBOSS

元气小坏坏 提交于 2019-12-18 11:56:26
问题 I tried several ways in the session bean, like: @Resource private SessionContext ctx; OR private SessionContext ctx; @Resource private void setSessionContext(SessionContext ctx) { this.sctx = ctx; } OR InitialContext ic = new InitialContext(); SessionContext ctx = (SessionContext) ic.lookup("java:comp/env/sessionContext"); None of them worked, differnet exceptions occured in JBOSS. I really get mad about it. Anyone could tell me what's wrong. Thanks a lot! 回答1: The two first solutions (field

What to put into jta-data-source of persistence.xml?

◇◆丶佛笑我妖孽 提交于 2019-12-18 11:41:20
问题 What value should I place into <jta-data-source> of my persistence.xml ? In glassfish admin panel I created a datasource name "abcDS" . In my jndi.properties (inside src/test/resources ) I defined it like this: [...] abcDS=new://Resource?type=DataSource abcDS.JdbcDriver=org.hsqldb.jdbcDriver abcDS.JdbcUrl=jdbc:hsqldb:mem:testdb abcDS.JtaManaged=true [...] What shall I place into persistence.xml ? I've found a lot of variants in the Net, like: "jdbc/abcDS" , "java:/abcDS" , "abcDS" . Which one

EJB explanation regarding EAR vs WAR

╄→гoц情女王★ 提交于 2019-12-18 11:10:22
问题 I have just begun reading up on EJBs. Even as I venture into it I have a few questions based on what I have heard about them. Do applications using EJBs always have to be deployed as an EAR? Can applications containing EJBs be deployed just like other other java web projects using ECLIPSE and without using ANT? 回答1: 1.Do applications using ejb's always have to be deployed as EAR ? No. The EJB module is assembled into a JAR, lets call it myapp-ejb.jar as a naming convention. This contains the