java-ee

Different persistence units for different Maven profiles

元气小坏坏 提交于 2019-12-24 09:07:11
问题 I want to use two different databases depending on the selected Maven profile. For the profile "production" I want to use a MySQL database and for the "development" profile I want to use an in-memory HSQLDB. I found out that it is possible to have two persistence.xml files. One in "src/main/resources/META-INF" and the other one stored in "src/test/resources/META-INF". This gives the possibility to choose a different database for testing. But is it also possible to do the database selection

Add a stateful bean using a producer and polymorphism with CDI in JEE

人走茶凉 提交于 2019-12-24 09:05:44
问题 I'm really new to JEE CDI but tried half of last night to find a solution to a problem. I have a Controller Class that, when startup is called, should inject a stateful bean using a Producer depending on a parameter. This mentioned stateful bean itself contains an injected bean itself. To be honest, not sure if this works at all, any feedback is highly appreciated=) Here is some dummy code that should help understand what I want to do (based oin https://docs.jboss.org/weld/reference/1.0.0/en

Automatically create Entities from database

不羁的心 提交于 2019-12-24 08:59:15
问题 Is there a way to automatically create javax.persistence.Entity classes from an existing database (or from the SQL statements that created them)? I am just reading through the persistence part of The Java EE 5 Tutorial and creating all these annotations by hand seems rather wasteful considering that all (or most) of the necessary knowledge is already encoded in the database or even explicitly given in the form of SQL statements. 回答1: There are several attemps to reverse engineer databases to

Custom selectItems

有些话、适合烂在心里 提交于 2019-12-24 08:58:42
问题 i want to customize selectItems to display an image conditionally beside each checkbox so first i tried to display the image for all checkboxes but it gets displayed only once, here's what i tried: <h:selectManyCheckbox value="#{myBean.checkboxesArry}" layout="pageDirection"> <f:selectItems value="#{myBean.mapOfCheckBoxes}" var="entry"> <label> <ice:graphicImage url="/resources/images/myImage.bmp"/> <b>#{entry.value}</b> </label> </f:selectItems> </h:selectManyCheckbox> please advise how to

Where do I verify the load path for my REST webservice

China☆狼群 提交于 2019-12-24 08:47:51
问题 I have just finished coding webservices. I need to be able to debug the webservice load path. When I sudo restart service tomcat7 , the /var/log/tomcat7/catalina.2014-09-29.log provides us with the package path for the webservice INFO: Scanning for root resource and provider classes in the packages: com.swipex.backend.webservices INFO: Root resource classes found: class com.swipex.backend.webservices.Registration class com.swipex.backend.webservices.Activation When I run the junit test code

GWT and Hibernate - NoClassDefFoundError when using Hibernate

大憨熊 提交于 2019-12-24 08:20:46
问题 In my GWT service on server side I use Hibernate. When creating a SessionFactory I get following error: "java.lang.NoClassDefFoundError: java.net.Socket is a restricted class. Please see the Google App Engine developer's guide for more details." What could be the reason? 回答1: It seems to be that you are trying to use Hibernate on Google App Engine, but Hibernate is incompatible with Google App Engine 回答2: This is a common GWT issue in debug mode - eg if you're looking to get postgres data

Spring MVC Hello World application not working

半腔热情 提交于 2019-12-24 07:37:18
问题 I'm new to Spring MVC and I'm trying to write a simple web app to get started with Spring. Here's what I have: web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>HatifimWeb</display

Exclusive url-patterns in Tomcat web.xml descriptor

旧巷老猫 提交于 2019-12-24 07:26:14
问题 I am trying to redirect erroneous page requests - 404 errors - to a custom error page. In order for my servlet, instead of the root servlet, to handle these requests, I entered the following url-pattern: <url-pattern>/</url-pattern> Unfortunately, this also catches embedded requests for files like *.js, *.css, *.png, *.jpg, and other such files. Is there a way in the deployment descriptor to specify an exclusive pattern? Say, "everything EXCEPT requests with x extension"? Or is there another

Communication between all browsers opened for a particular web site from server side

时光毁灭记忆、已成空白 提交于 2019-12-24 07:14:13
问题 As shown in the image, if client1 sends some information to server, and on other side client2, client3, client4 also opened the same page to which client1 made changes, I want to show those changes to all users who are on that same page. We can do the following: Make call to server at some interval Node.js I am using Java, can this be done using sockets? My idea is that client1's changes will be received by client2, client3, client4 by some kind of notification and only then will they call

Communication between all browsers opened for a particular web site from server side

一个人想着一个人 提交于 2019-12-24 07:14:07
问题 As shown in the image, if client1 sends some information to server, and on other side client2, client3, client4 also opened the same page to which client1 made changes, I want to show those changes to all users who are on that same page. We can do the following: Make call to server at some interval Node.js I am using Java, can this be done using sockets? My idea is that client1's changes will be received by client2, client3, client4 by some kind of notification and only then will they call