java-ee-6

Is it illegitimate to name an JPA entity “Group”?

安稳与你 提交于 2019-12-05 05:29:05
I'm developing a JEE6-application, using JPA 2.0 and Hibernate 3.5.2-Final as the Provider (and MySQL 5.1.41). My Application Server is Glassfish V3.0.1. I already have a working CRUD-app with some entities and relationships. Now i added an (really simple) entity with the name "Group". The entity class looks like this: package model //Imports... @Entity public class Group { @Id @GeneratedValue private Long id; @NotNull private String name; //Getters and Setters } Of course I also added it to the persistence.xml, like <class>model.Group</class> . My persistence.xml drops and recreates all

Execute subprocesses in JavaEE 6

怎甘沉沦 提交于 2019-12-05 03:42:09
问题 I'm trying to execute subprocesses from within my application server (Glassfish 3.1.2) Therefore I discovered the Apache Commons Exec library. The problem is that this library creates threads which should not be done on an application server because the server is not aware of these threads. What could be a solution to this problem? Would it be possible to create a message component written in Java SE who consumes messages containing information about pending jobs and register it with the

Are CDI event observer methods compatible with EJBs?

妖精的绣舞 提交于 2019-12-05 03:39:47
I have a Singleton EJB (javax.ejb.Singleton version. sigh.) which has a CDI observer method on it. When I try to deploy this to glassfish 3.1 the server fails to deploy the EAR file without any real explanation - simply saying there was an exception during deployment without any more details. SEVERE: Exception while loading the app SEVERE: Exception while shutting down application container .... SEVERE: Exception while shutting down application container : java.lang.NullPointerException This is the CDI event listener : public void updateFromGranule(@Observes @CloudMask GranuleAvailableEvent

How can I pull messages from Activemq Asynchronously

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 02:59:30
问题 I want to write code for pulling messages from Activemq .I don't want to pull all the messages from Activemq at a time,because my requirement is whenever my Java Application receives 1 message from Activemq ,based on message body I will find corresponding HTTP Link and forward to that Link. For this entire logic I wrote 2 .java files names are MessageConsumer.java MyListener.java MessageConsumer.java file only for connection establishing.The corresponding code is in below. package PackageName

How does @SessionScoped work with EJB? Is CDI only for web-tier?

大兔子大兔子 提交于 2019-12-05 02:11:59
How is the session defined in @SessionScoped CDI bean? Is this annotation valid only when called from Servlet container, where the session is well defined in form of HttpSession ? If not, than how an EJB with @Inject @SessionScoped MyBean myBean can know what the session really is ? I mean, methods of this EJB could have been invoked by a standalone client, RESTful WS or by some other view. What should happen in such case? Should the annotation have no meaning, should it inject fresh MyBean instance for each request or maybe it should retain the same instance across all requests? Taken from

Async Servlet - preferred implementation

末鹿安然 提交于 2019-12-05 02:02:25
问题 Lately, during my research about asynchronous processing in Servlets , I came across at at least three ways to implement some functionality using this approach. The questions are: Which one is the best? Maybe some of these approaches are not recommended? Maybe there is another one approach better than all of mentioned below? Found approaches: Using AsyncContext.start(Runnable) . This approach is quite simple and straightforward. But many serwers executes such a job in thread pool created for

AJAX render attribute doesn't work with rendered=“false” component [duplicate]

a 夏天 提交于 2019-12-04 23:40:34
问题 This question already has an answer here : Ajax update/render does not work on a component which has rendered attribute (1 answer) Closed 3 years ago . I have a component that I want to show/hide after user hits a commandButton . It's like this: <h:commandButton id="showButton" value="#{bean.wasPressed ? 'Hide' : 'Show'}"> <f:ajax listener="#{bean.toggle()}" render="explanation showButton" /> </h:commandButton> and <h:panelGroup id="explanation" rendered="#{bean.wasPressed}"> <h:outputText

QuartzScheduler injection in JBoss AS 6

二次信任 提交于 2019-12-04 23:13:58
问题 How can i inject QuartzScheduler service into my Stateless bean on JBoss AS 6 ? Quartz service does start during JBoss AS 6 startup 00:58:38,025 INFO [QuartzScheduler] Scheduler meta-data: Quartz Scheduler (v1.8.3) 'JBossQuartzScheduler' with instanceId 'NON_CLUSTERED' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. Using job-store

how to use new scala 2.8.0 nested annotations

梦想与她 提交于 2019-12-04 21:02:30
问题 looks like when scala 2.8.0 is out, we can use nested @annotations in our persistence layers. But how? Can anyone please transform this from java to scala? Thanks. @NamedQueries({ @NamedQuery(name = "findAll", query="select p from Person p"), @NamedQuery(name = "findTheOne", query="select p from Person p where p.name = 'Neo'") }) 回答1: You have to wrap the elements in an Array() and write the nested annotations like a constructor call: @NamedQueries(Array( new NamedQuery(name = "findAll",

Resteasy and fileupload: get no content-disposition error

瘦欲@ 提交于 2019-12-04 19:17:23
I have a rest resource to which files can be uploaded. @Path("/rest/input") public class InputResourceBean { @POST @Path("{directory: .*}") @Consumes("multipart/form-data") public void post(final String directory, final MultipartFormDataInput input) { } I've used SOAPUI, curl and a HTML form to test this code and for all of them I get the same error: Could find no Content-Disposition header within part 12:55:19,739 WARN [org.jboss.resteasy.core.SynchronousDispatcher] Failed executing POST /rest/input/myDir: org.jboss.resteasy.spi.ReaderException: java.lang.RuntimeException: Could find no