java-ee

Multithreading in a stateless session bean?

女生的网名这么多〃 提交于 2019-12-18 01:05:00
问题 The EJB 3.0 specification does not allow a business method of a stateless session bean to create new threads. Why is that? What is wrong with creating additional worker threads that only do raw computations and never call into the app server? Say, my session bean implements a service that lets users to upload images, and the business method does cpu-intensive image processing on these images. Then it can only use one cpu core to do this job, even if the machine has 8 or more cores? If i

Recommended Source Control Directory Structure?

a 夏天 提交于 2019-12-17 23:45:04
问题 I am going to be using Subversion for source control on a new J2EE web application. What directory structure will you recommend for organizing code, tests and documentation? 回答1: I usually have Project Directory src - actual source doc - documentation lib - libraries referenced from source dep - installation files for dependencies that don't fit in lib db - database installation script In work with Visual Studio, I'm not sure if this works the same in the java world. But i usually put stuff

What are these warnings in catalina.out? [duplicate]

馋奶兔 提交于 2019-12-17 23:44:56
问题 This question already has answers here : Memory leak when redeploying application in Tomcat (5 answers) Closed 6 years ago . I have a web application in Tomcat 7. When I shut down Tomcat I see these warning (but not always) SEVERE: The web application [/MyApplication] created a ThreadLocal with key of type [org.apache.xml.security.algorithms.MessageDigestAlgorithm$1] (value [org.apache.xml.security.algorithms.MessageDigestAlgorithm$1@2e2c2e2c]) and a value of type [java.util.HashMap] (value [

Why is the 'anonymousUser' authenticated in Spring Security?

折月煮酒 提交于 2019-12-17 23:38:10
问题 This is my main controller: package org.demian.demibox.controllers; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class MainController { private String getUsername() { Authentication auth = SecurityContextHolder

JPA Lazy Loading

烂漫一生 提交于 2019-12-17 23:37:38
问题 I have a problem with lazy loading property in JPA entity. I read many similar questions, but they are related to spring or hibernate and their answears are either not applicable or helpful. The application is JEE with JPA2.1 running on Wildfly application server. There are two entities, DAO session bean and servlet that puts it together: @Entity @Table(name = "base_user") public class User implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id")

EJB - Home/Remote and LocalHome/Local interfaces

▼魔方 西西 提交于 2019-12-17 23:28:01
问题 Revising some past exam papers for an exam mainly focus on component-oriented design and J2EE, I have come across the following question: A preliminary investigation of scenario 3: “Exchange Request” suggests that two EJBs will provide a suitable solution: a session bean called EnterExchangeRequest to control the processing and an entity bean called ExchangeRequest to represent the persistent properties of the request. Discuss the role of the following interfaces: Home Remote LocalHome Local

Stateless session bean with instance variables

倖福魔咒の 提交于 2019-12-17 22:41:23
问题 I have a stateless session bean that contains one public method, several private methods, and some instance level variables. Below is a pseudo code example. private int instanceLevelVar public void methodA(int x) { this.instanceLevelVar = x; methodB(); } private void methodB() { System.out.println(instanceLevelVar); } What I'm seeing is that methodB is printing values that weren't passed into MethodA. As best I can tell it's printing values from other instances of the same bean. What would

Java Web Project referencing another Java project

♀尐吖头ヾ 提交于 2019-12-17 22:37:22
问题 I have a Java Project , for which I'm now creating a Web interface, using a Dynamic Web Project from Eclipse. The Web project consists of a single servlet and two JSP 's. Something like this: /JavaApplication /src /lib /resources /WebApplication /src /Servlet.java /WebContent /WEB-INF index.jsp other.jsp Now, I need to reference JavaApplication from WebApplication , in order to use its classes to process web requests. What's the best way to accomplish this ? My idea is to create a .jar of the

Best current framework for unit testing EJB3 / JPA [closed]

我只是一个虾纸丫 提交于 2019-12-17 22:32:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . Starting a new project using EJB 3 / JPA, mainly stateless session beans and batch jobs. I've used JUnit in the past on standard Java webapps and it seemed to work pretty well. In EJB2 unit testing was a pain and required a running container such as JBoss to make the calls

how to resolve the NullPointerException in JEE? [duplicate]

风格不统一 提交于 2019-12-17 22:29:00
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Is it safe to use a static java.sql.Connection instance in a multithreaded system? (2 answers) How should I connect to JDBC database / datasource in a servlet based application? (2 answers) Closed 20 days ago . I'm beginner in JEE and i'm trying to fetch object from my db but i has encountered an error of nullpointerexception, i tried to locate the origin of the nullpointerexception(i