javabeans

JSF Managed bean in jar not instantiated

南笙酒味 提交于 2019-12-06 14:22:24
I have created two jsf projects in JSF. One of them is a base project that has a single session bean. This base project is packaged into a .jar file (with a /META-INF/faces-config.xml file) and included in the other project (the clientproj). The problem is that when I run the client project, the session bean in the base project is not instantiated, and I get a NullPointerException. Details are as follows: Base Project - Session Bean package sbeans; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped public class SessionBean { private String

Spring boot preloading data from database in bean

◇◆丶佛笑我妖孽 提交于 2019-12-06 13:40:52
问题 I'm asking for elements that have a recursive relationship in one table: child id | parent id 1 | null 2 | 1 3 | 1 4 | 2 And so on...To ask for this whole datastructure it takes about 10 secondsAt the moment I can't redesign this table because it cost too much time (for more information: Spring Repository performance issues with recursive ORM Class) Now, I am thinking about preloading all data during spring startup in a bean, so that the client "communicates" with the bean and I update the

How to call a EJB session bean from PHP?

你离开我真会死。 提交于 2019-12-06 13:01:29
问题 Is there any way to call an EJB session bean from PHP? Are there any specific functions to do that? 回答1: Not really. If you can make CORBA calls, most container support CORBA as a protocol to talk to a remote EJB, but I wouldn't recommend it. You'd have better luck exposing the EJB Session Bean call as a SOAP Web Service, or simply facade it with a Servlet and invoke that as an ad hoc web service. Now, if you're running PHP within a Java EE server (Resin I believe can run PHP), then you might

Spring ReloadableResourceBundleMessageSource bean unable to find external properties

百般思念 提交于 2019-12-06 12:24:42
问题 I've tried to use the Mkyong's guide to access external properties file, without any success. This is my bean definition in web-osgi-context.xml file located in WEB-INF: <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basenames"> <list> <value>classpath:bundles/resource</value> <value>classpath:bundles/override</value> <value>file:c:/test/messages</value> </list> </property> <property name="cacheSeconds" value="10"/>

Difference between JavaBean, POJO and normal class? [duplicate]

六眼飞鱼酱① 提交于 2019-12-06 11:26:16
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: What is the difference between a JavaBean and a POJO? Difference between DTO, VO, POJO, JavaBeans? Could you please explain the difference between JavaBean, POJO class and normal class in Java technology? 回答1: Not much. A JavaBean has to follow certain naming conventions laid down in the JavaBean spec, but otherwise they are all the same. 来源: https://stackoverflow.com/questions/3149932/difference-between

Apache camel getbody as custom class

不打扰是莪最后的温柔 提交于 2019-12-06 11:23:37
问题 The question is rather simple, perhaps because I'm a little confused in the process. What I'm trying to do is shown in the code example: cc.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("file://files?noop=true") .split() .tokenize("\n") .split() .method(SplitToken.class, "hashTokens") and: class SplitToken { @SuppressWarnings("unchecked") public static List<HashMap<String, Integer>> hashTokens(final Exchange exchange) { List<String> oldstr = exchange

JavaEE Wildfly EJB not injected, war-only project

╄→尐↘猪︶ㄣ 提交于 2019-12-06 11:23:13
I'm new to JavaEE and I created a "hello world" project, using Hibernate as JPA provider, build using gradle and deployed to Wildfly . I want to use @Stateless bean for database-aware class, that will do all operations on DB, and then inject it to all "JAX-RS" classes, that contain REST endpoints. Database class: @Stateless public class DatabaseManager { @PersistenceContext EntityManager entityManager; public DatabaseManager() { } public String sayHello() { // do some db-stuff return "EHLO"; } } REST class: @Path("/") @SessionScoped public class RestMainEndpoint implements Serializable { @EJB

java beans: difference between persistent field and persistent property?

被刻印的时光 ゝ 提交于 2019-12-06 10:59:18
问题 I got the impression that if we use persistent fields, there is no need for getter methods since the entity manager references the instance variables directly. However, when I removed the getter and setter methods from an entity to have persistent fields, the values for the corresponding instance variable was not retrieved from the database! Does that mean we must have getter and setter methods even though we have persistent fields? 回答1: If the entity class uses persistence, fields

binding form parameters to a bean using just Servlets and JSP - possible?

非 Y 不嫁゛ 提交于 2019-12-06 10:47:44
I am using Servlet and JSP without a framework to study for my SCWCD. I have a simple form that I want the parameters to bind to a bean automatically. Is this possible without writing binding code or using a framework? Thanks No, it isn't. You should use some framework, which I guess would be an overkill. So what you can do, is iterate request.getParameterMap() keys and set the values to object with the corresponding field names (via reflection) Well, without a "framework" you can't do this. But you can use the Jakarta BeanUtils ( http://commons.apache.org/beanutils/ ), more precisely the

GWT RF: How to share the same code in client and server

社会主义新天地 提交于 2019-12-06 10:46:23
I would like to use the same code to sort and manipulate objects in client and server sides. But I am facing a problem since in client we need a proxy interface representing the class of the server. Is there a way to use the same interface in both?, I know RF has a mechanism to copy bean attributes from the server instance to the client instance when it is sent through the wire. Manolo Carrasco Moñino As Thomas says in his answer , the only way in current GWT to have shared code in client and sever is implementing the same interface in both sides and using it in your shared code. Since RF