FAQ Database Discussion Community


Collections.sort isn't sorting

java,sorting,java-ee,collections
I am building a web application using Java EE (although my problem is more Java based) In a Servlet, I am getting a list of orders from the EJB. In this list of orders, there is a list of states for this order (sent, on dock, non received ...) I...

Injecting EntityManager in servlet, it seems not thread safe

java-ee,servlets,jpa,dependency-injection,entitymanager
I want to make a login app in Java EE. I thought of implementing it using a html page, a servlet and an entity class for the user, but it seems that EntityManager is not thread safe (can't be injected in the servlet and I need it to check the...

Hibernate criteria accepting %% value

java,hibernate,java-ee,orm,hibernate-criteria
I am using the below Hibernate code to filter workFlowName. crt.add(Restrictions.like("workFlowName", workFlow, MatchMode.ANYWHERE)); // crt is the criteria The problem is when I pass the value to workFlow from web (TextBox).it fetching the value correctly (I am passing sym in text box if fetch 10 records.if i pass the same...

Websocket (java ee) how to get role of current user

security,java-ee,websocket,wildfly
I just added a Websocket endpoint to my java ee jax-rs application. Within Jax-Rs endpoints i can access the role of the user via SecurityContext. But within websocket i can't inject context stuff. So how to know the role of the user that tries to open a websocket session?...

Client-Server architecture: 100% Android (Android as a server) or J2EE+Android?

android,java-ee,architecture,client-server,distributed-computing
Context I am considering going into a client-server architecture with Java. The idea is that several Android tablets (let's say around 15) need to display a content from a server. Content can vary times to times (e.g. day display v/s night display). Furthermore, tablets will also display a Yes /...

JAX-RS @FormParam one time for all methods

java,web-services,java-ee,jax-rs,java-ee-6
I am developing Java "JAX-RS" Web Services for books and contents. There will be 100s of URLs something similar ... https://api.example.com/v1.3/book1/chapter/1 https://api.example.com/v1.3/book1/chapter/2 ... https://api.example.com/v1.3/book1/chapterN To fetch the chapter content user needed to POST authToken, which I validate in server and return content or error. The sample code ... @Path("/book1") public...

Vaadin - How to have two columns of data (Gridlayout with field and Label data with wrapping text)

java,java-ee,vaadin,vaadin7
I'm trying to create a CustomComponent where I have two columns (possibly four) where the two columns are rows of Labels. The first column is the identifier such as "Firstname: ", "Lastname: ", etc. and the second column is the actual value for the identifier such as "John", "Smith", etc....

Maven GroupID and ArtifactID for J2EE Utility Project

java,eclipse,maven,java-ee,naming-conventions
I have a collection of 3 existing Eclipse projects that I want to make into Maven projects and I'm having a hard time understanding the relationship between the GroupID, ArtifactID and my Java Packaging, and the different directory structure that is created for Maven vs. Java projects. I'm pretty new...

Persistence.xml overridden in Arquillian tests

java,java-ee,integration-testing,wildfly,jboss-arquillian
Arquillian examples mainly show how to construct WarArchive, JavaArchive, etc. I can't find any good example how to override one of jar files which exists in already compile war file. The reason is that one of the jars contains persistence.xml which I wan't to override to defined for instance hbm2ddl.auto...

How to manage with Atom XML response in Spring

spring,rest,spring-mvc,java-ee
I have write web application in Spring. In one service i have receive ATOM XML data using RestTemplate, but i use String.class to represent them. I want to represent ATOM data in class with appropriate attributes and i dont know how.

How to call EJB 3.0 by external Servlet

java,java-ee,servlets,ejb
I am learning EJB 3 and trying some simple stuff on it. I am using eclipse -> Luna Service Release 1 (4.4.1) with JBOSS AS 7.1.1 (final) I created a simple EJB project in eclipse with name -> SalutationEJBProj. Under this project created a simple session, stateless Bean. code: package...

Simple JavaEE HTML GET/POST application

java,java-ee,intellij-idea,glassfish,jax-rs
I'm just starting out with JavaEE (I'm decently fluent in JavaSE) and am having trouble wrapping my brain around all the new things that are required to make even the simplest of applications. Right now I am trying to use JAX-RS annotations to generate a simple "Hello World" html page...

Does JBoss 7.x Support J2EE 5.0 and EJB 2.0?

java,java-ee,jboss,jboss7.x,ejb-2.x
I have an application build on J2EE EJB 2.0 deployed on JBoss 5.1.0. I want to migrate that application to JBoss 7. Does JBoss 7.x Support J2EE 5.0 and EJB 2.0? If Yes, then how to Migrate Jboss 5.1.0 to JBoss 7.x?

JBPM 4.4 vs JBPM 6.2

java,java-ee,jboss,jbpm
I am planning to use advance version of JBPM i.e. JBPM 6.2. Currently my project is using JBPM 4.4 but there are issues with JBPM4 DB tables which are accessed internally by JBPM API. I need inputs regarding this udgradation activity: Since existing workflows will be continue to use. So...

I cannot instantiate my bean using @Inject and Vaadin CDI

java-ee,vaadin,cdi,vaadin7
I am trying to inject my components and beans using Vaadin-cdi. Note the code below is simplified a bit. @Theme("valo") @CDIUI("") public class MyUI extends UI { @Inject private CDIViewProvider provider; @Override protected void init(VaadinRequest request) { Navigator navigator = new Navigator(); navigator.addProvider(provider); navigator.navigateTo("mypanel"); } } And here goes MyPanel:...

Creating jpa entities of several types [closed]

java,java-ee,jpa
My project has 3 types of users. One type has all attributes of the other two types. I have a entity call User. And I extended UserType1 and UserType2 from User. And I want all properties of Type1 and Type2 to be there in Type3. How can I do it...

What causes different search results for same elastic search query on two nodes

java-ee,elasticsearch
I have a two node elastic search setup where the same search query on the one node results in different results than on the other and I would like to find out why that is the case. Details: The same documents (equal content and id) have a different score on...

Criteria API and Entity Graph

java-ee,criteria-api,jpa-2.1
I have two entities with unidirectional lazy relations. And one of them has a named entity graph. Here are the entities (getters and setter are not listed due to readability): @Entity @NamedEntityGraph ( name = "Sms.fetchSims", attributeNodes = { @NamedAttributeNode("sim") } ) public class Sms { @Id @GeneratedValue (strategy =...

@FacesComponent on shared library

jsf,java-ee,websphere,jsf-2.2
I'm trying to use a custom jsf component on Websphere 8.5. The component class is annotated with @FacesComponent. The component is on a shared lib jar on the server. I already have an faces-config inside the jar META-INF folder. If the jar is inside my ear file it works as...

How to map JSON with nullable array properties to POJO using WildFly RestEasy

json,java-ee,resteasy,wildfly,pojo
I have JSON { "name": "volo", "friends": ["joe", "alex"] } and Java POJO class Person { private String name; private Set<String> friends; //constructor, getters, setters } POST method: @POST @Consumes("application/json") public Response createPerson(Person person) { //logic } This is work nice when POST or PUT request are coming and JSON...

JPA Criteria Api - Not in relation entities query

java,java-ee,jpa,criteria-api
I have a problem with building CriteriaQuery, to check not mapped entity in this relation. @Entity @Table(name="table1") public class Entity1 { //Some attributes @Column private Integer entity2ID; } @Entity @Table(name="table2") public class Entity2 { private Integer id; //Some attributes @Column private Boolean value; } CriteriaBuilder code: public Query buildSelectQuery(EntityManager em,...

ClassCastException Error from List to Single Object

hibernate,java-ee,ejb
I have a problem to get a Single Location Object from a List. Calling getLocations() in primefaces dataTable works. And I can display all Locations. But when I want to get a Single Location from the locations List, then I get always a ClassCastException. I use JPA (Hibernate). Entity Bean:...

Are batchlets the correct way of implementing ETL steps in JavaEE Batch?

java,java-ee,java-ee-7,java-batch
I am studying Javaee Batch API (jsr-352) in order to test the feasibility of changing out current ETL tool for our own solution using this technology. My goal is to build a job in which I: get some (dummy) data from a datasource in step1, some other data from other...

How to call MySQL view in Struts2 or Hibernate

java,mysql,hibernate,java-ee,struts2
I have a view in MySQL database CREATE VIEW CustInfo AS SELECT a.custName, a.custMobile, b.profession, b.companyName, b.annualIncome FROM customer a INNER JOIN cust_proffessional_info b ON a.cust_id=b.cust_id Is there any way that i can call this view using Struts2 or in Hibernate. I have tried to search it but could not...

How to share the same email session between all instances of the application?

java,session,java-ee,javamail
Maybe this question is already answered, but I couldn't find the proper answer. I have a web application based in JSF, and I want to share the same email session between all the instances of the application, yet I haven't found how to do that. My questions are: a) What...

Why paging query does not work

java,jsp,java-ee,servlets,jdbc
The main function of this program is to write a page displays the contents of the database and can achieve Pagination When you first visit the page can display the contents of the database,But when you click on the link below when the page is not able to properly display...

Custom RuntimeException not caught

java,java-ee,exception-handling,runtimeexception
I have my own ApplicationException witch extends RuntimeException: package com.haslerrail.aura.common.exception; public class ApplicationException extends RuntimeException { private static final long serialVersionUID = 1L; private final ErrorCode errorCode; private final Object[] arguments; public ApplicationException(final ErrorCode errorCode, final Object... arguments) { super(); this.errorCode = errorCode; this.arguments = arguments; } public ErrorCode getErrorCode()...

Java MongoDB Morphia: find a object by ObjectId id [duplicate]

java,mongodb,java-ee,morphia
This question already has an answer here: Querying Morphia by Id 3 answers I am using Morphia and a DAO Class. I have a Class with an Id ObjectId: @Entity @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class GeoProfileVo extends ResponseVo implements Serializable{ private static final long serialVersionUID = -4975628041316056892L; @Id private ObjectId...

Which Should i use for date,time,email in servlet?

java,html5,java-ee,servlets
In servlet we use for text data String uname=request.getParameter("uname"); For numeric data we use int contact=Integer.parseInt(request.getParameter("contact")); Which should i use for email,date and time in servlet? Actually I'm using HTML5 where I use email as <input type="email" id="txtEmail" name="email" required> Date as <input type="date" id="dateBirthday" name="birthday" required> Time as <input...

JSF Controller, Service and DAO

jsf,java-ee,jpa,ejb,dao
I'm trying to get used to how JSF works with regards to accessing data (coming from a spring background) I'm creating a simple example that maintains a list of users, I have something like <h:dataTable value="#{userListController.userList}" var="u"> <h:column>#{u.userId}</h:column> <h:column>#{u.userName}</h:column> </h:dataTable> Then the "controller" has something like @Named(value = "userListController") @SessionScoped...

Java project, include frontend library(Polymer)

javascript,java-ee,dependencies,frontend
I try to work on apache2 licensed project on github, it is a j2ee webap, as user UI I want to use Polymer libraries... Now I don't know to include all needed js/html files in depository or to leave only bowler file ? If i will include all files it...

Configure specific SFSB stateful-timeout in standalone.xml (JBOSS)

java,java-ee,jboss
For my JEE 3.1 application I have a SFSB for which I have set a specific timeout. I need to have easy access to this value to allow it to be easily configurable. First I had the annotation in my SFSB class: @StatefulTimeout(value = 2, unit = TimeUnit.HOURS) This works...

How to find servlet API version for glassfish server?

java,java-ee,servlets,glassfish
While coding a servlet I found a method that says Since: Servlet 3.1 I guess that if I have the autohint from NetBeans to use it is because I have that Servlet version. But I cannot find a place to confirm that. I'm using glassfish4.1 as container. If I go...

filter mapping to last path segment

java,java-ee,web.xml,servlet-filters,servlet-mapping
I am trying to map a filter to a specific url in web.xml. The problem is that there is a dynamic path segment in the url and I need to map my filter only to URLs ending with a specific path. For given URLs: http://company.com/webApp/aaa/end http://company.com/webApp/bbb/end http://company.com/webApp/ccc/end I need to...

Modular form-based Java web application with pluggable modules for each year

java,java-ee,web-applications
I have a conceptual design for a web application in my head, but I have no idea if it's possible to implement it with current frameworks. Basically, what I'd like to do is have a "core" web application that can be deployed as a war. Then I'd to be able...

Java ee session scope attributes for drop down lists

jsp,session,java-ee,scope
I'm trying to gain some performance on my application that search members in groups in ldap. My page shows 5 drop down lists which countains groups from different domains (around 150+ in each). I noticed that my application spend most of the time loading those drop down lists and little...

Getting Connection timed out: connect

java,java-ee
I am getting Connection timed out: connect exception in java code please see below. I have searched in google but haven't got much help,U can run this code in your machine,its complete code I am giving below. code- public class download { // final static int size=1024; public static void...

Getting R6034 error when starting Eclipse for Java EE Developers

eclipse,java-ee,jboss,windows-7-x64,eclipse-luna
I use Windows 7 64-bit, Java 8. I'm getting the following error: and the following screen is left behind after the process is manually terminated: I believe it started happening right after I installed a plugin from JBoss Tools - xulrunner.site - ­ Update Site that was supposed to help...

setMessageDrivenContext is not invoked

java,java-ee,jboss,ejb,jboss5.x
I am using EJB 2.0 without annotation. I have a ejb-jar.xml like: <?xml version="1.0"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <enterprise-beans> <message-driven> <ejb-name>XMLEventQueueBean00</ejb-name> <ejb-class>com.test.XMLEventRequestService</ejb-class> <transaction-type>Bean</transaction-type>...

How are JSP/Servlet's executed in a Java-Capable webserver? [closed]

java,jsp,tomcat,java-ee,servlets
I'm playing with writing a Java-capable webserver. How do you get from your WAR/JSP to executable Java code? I've figured at this point FCGI is not available(I do have a client impl). What kind of mechanisms or specs are here? Are there any standards?

In a JavaEE stateless session bean, why is the SessionContext responsible for rolling transactions back and not the EntityManager?

java-ee,jboss,hibernate-entitymanager
To me (someone who is new to JavaEE development), I would think that a container managed EntityManager would be responsible for rolling back failed transactions and not a SessionContext instance. Suppose the following scenario... @Stateless public class MySessionBean implements MySessionBeanRemoteInterface { @PersistenceContext(unitName="MYPu") private EntityManager em; @Resource private SessionContext sctx; @Override...

Alternative of JTATransaction

spring,tomcat,java-ee,jta
I have an Spring based J2EE application which runs well on Weblogic, I wanted to move it to Tomcat. It seems tomcat doesn't support JTA Transaction Manager without external jar help like Atomikos, JOTM, Bitronix, SimpleJTA. I am reluctant to make changes into my application where i am already using...

EJB injection not working in different classes

java-ee,netbeans,jersey,ejb,jax-rs
I have tried to inject an Entity EJB(Facade and entity from MySQL database) but it doesn't work depending on the class it is in. I use a Rest webService and it work in the webService class. I use a multi layered architecture and I don't want my EJB to be...

[Ljava.lang.Object; cannot be cast to List from a request SQL

java,jsp,java-ee
I have a problem for the view of a List with a ForEach in a jsp: I have this error for the timelineservlet: Etat HTTP 500 - [Ljava.lang.Object; cannot be cast to fr.gabbler.models.Gabs type Rapport d''exception message [Ljava.lang.Object; cannot be cast to fr.gabbler.models.Gabs description Le serveur a rencontré une erreur...

What to do when you want to create your first java web application?

java,java-ee,web-applications
So i want to create my first web application. But there is simply too mush choose to know where to start i keep jumping from one thing to another. The first thing is which ide should i use: is one better for web development than another or is it just...

Cannot use properly (@Inject)

java,java-ee,cdi
When i try to use @Inject to inject my DAO class, in a manager to make it able to give a gson file to a current address i get this exception when i go to the specific web address.Can someone explain me what is the problem. I thought that the...

How to trigger a doGet before displaying a jsp page

jsp,java-ee,web.xml
I have a webpage which is named export.jsp, when the user acces domain/export.jsp, I want him to automatically download a csv file via the doGet method of a servlet. Afterwards I want to display the actual jsp file, which is export.jsp My doGet method is as follows: protected void doGet(HttpServletRequest...

How to delete a portlet in Liferay 6.1 programmatically from code

java,javascript,java-ee,liferay,liferay-6
I'm working on Liferay 6.1 I want to delete a portlet in Liferay 6.1 from my code. What I have done so far is: <a onclick="Liferay.Portlet.close('#p_p_id_28_'); return false;">Remove</a> Above code is working fine. But it is working on the current page only i.e. it can delete the portlet(s) which is...

JAX-RS Custom JSON representation of primitive Resource return type

java,java-ee,jax-rs
Suppose we have a service with the following contract: public interface CategoryService { public int createNew(String languageCode, String name, String descriptionMarkdown, Integer parentCategoryID, String createdByUserName) throws ServiceException; }; How do I map the int return type to produce a JSON value like the following? PS: I know that the createNew...

Where does maven dependency fetch packages from?

maven,java-ee,eclipse-plugin
As per this below snapshot, I see list of packages for hibernate: I regularly see update index activity by m2e plugin(maven) in eclipse, for which I have no clue, What does it mean? Where are these packages fetched from and displayed? What is groupId/ArtifactId? Why can't one just say package/class...

Define bean using factory method in plain Java EE - WITHOUT Spring

java,java-ee,dependency-injection,autowired,inject
I want to create a bean which can be automatically injected (autowired) by plain Java EE, not with Spring. The code I have is this: import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @ApplicationScoped public class MyConnector { .... private Client client = ClientBuilder.newClient(); .... } I'd like to use dependency injection like that...

Comparing if two list of strings are equal using hashcode?

java,java-ee,collections,jax-rs
I am writing a Java/JEE client server application. I have a requirement were the files present in the server should match with the files present in the client. I am only trying to validating if there is an exact match to the file names and number of files in a...

Getting WELD-001303 error when implementing custom CDI extension for @SessionScoped scope

java-ee,cdi,java-ee-7,named-scope,java-ee-web-profile
I'm trying to implement a custom CDI scope and I thought it's the easiest to start by extending the existing @SessionScoped. I started by following this tutorial. However, when visiting an XHTML page which references a CDI bean with my scope, this leads to org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for...

Difference between two types of a super class instantiation in Java [duplicate]

java,object,java-ee,instantiation,superclass
This question already has an answer here: Java: difference between A x = new A() and A x = new B() when B extends A [duplicate] 6 answers I have an abstract super class called Document and two child classes called Magazine and Book. What is the difference between...

Spring-boot+JPA EntityManager inject fails

spring,java-ee,jpa,spring-boot,cdi
In my J2EE application I try to use spring-boot and JPA technologies with injection of EntityManager into DAO layer. However, I have some problems... My repository for user CRUD: @Repository public class UserRepositoryImpl implements UserRepository { @PersistenceContext(unitName = "data") private EntityManager entityManager; // and crud methods } My spring-boot application...

What's the difference beetwen EntityManager and DAO? [closed]

java,java-ee,dao,entitymanager
What's the difference beetwen EntityManager and DAO? Is it same thing?

what annotation to create a web service that is created only once when the server starts?

java,web-services,java-ee
I am stuck on what annotation to use to create a web service where only one instance is created when the server starts I have written a service which contains a time stamp which should be the same time each refresh of the page but the time changes with each...

Maven, tomcat7, Simple Web App. java.lang.LinkageError: loader constraint violation

maven,java-ee,tomcat7
I'm following directions from book "Introducing Maven, Apress", to create a simple web app: HelloWorld!! in a JSP . With Maven and Tomcat7 and using following artifact: (by the way I'm using win7) mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp The structure created is as follow: gswm-web |_pom.xml |_src |_main |_resources |_webapp |_WEB-INF |...

weblogic 12c basic authentication not prompting for userid

java,java-ee,servlets,weblogic,weblogic12c
I am trying to configure basic authentication for a servlet deployed on Weblogic 12c. Here is my web.xml <security-constraint> <web-resource-collection> <web-resource-name>TestServlets</web-resource-name> <url-pattern>/ReasonServlet</url-pattern> </web-resource-collection> <auth-constraint> <role-name>TestServiceRole</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method>...

How to time out long-running web requests on WebSphere Application Server? [duplicate]

java-ee
This question already has an answer here: How to timeout a thread 13 answers I'm trying to make a JavaEE application production-ready on IBM WebSphere Application Server v. 8.5.5.4. In case of web requests that result in too long calculations (for any reasons from unexpectdly big amounts of data...

jQuery DataTables server-side processing with Java

jquery,java-ee,jquery-datatables
I am looking for how to implement jQuery DataTables with server-side processing in Java. I have tried the following way by using the below parameters. Below is my jQuery ready function code. $(document).ready(function() { //url = http://localhost:8080/jQuery-DataTable-Java-Integration/serverExample $('#myTableId').DataTable({ "serverSide" : true, "processing" : true, /*"bProcessing" : true, "bServerSide" : true,*/...

What framework is the best option for creating a gaming website?

java-ee
I am starting a gaming website which will require exchanging data between a gamer and the gaming server on regular basis. Since i am new to Java and i have worked with a bit of Java Beans, i would like to know that based on my requirements, which framework would...

How to enable Design View in jsp file in Web application project in Netbeans?

jsp,java-ee,design,netbeans,web-applications
I'm working on a Web application project and I've added a jsp file but I can't see the Design View. I don't know if this feature has been removed in new versions, but here here's a pic of Design View in a jsp: How do I enable it? thanks....

Use jstl core as a local resource

java-ee,jstl,libraries,taglib
I would like to download those libraries and import them from the computer to the application. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> How can I do that ? If you want to know why, the server can't reach the Internet, so...

References of objects in Java EE. Difference for remote and local interfaces?

java,java-ee,call-by-value
As far as I know, Java is only call-by-reference. If an entity has to go through a remote interface, can it still have a reference? Now the entity is basically in another container, how can it still have the reference of the object? In other words: Is it possible that...

BeanCreationException: Error creating bean with name: Injection of autowired dependencies failed;

java,spring,java-ee,jetty,war
I am getting the following error stack when trying to deploy a war using a jetty server I have written. INFO : jetty.StartJetty - starting jetty using war file ..\serialisation-preview-service\target\serialisation-preview-service-1.3.0-SNAPSHOT.war SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/username/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in...

What are the techniques to manage “session” or invocation context for Stateless EJBs during Remote calls?

session,java-ee,ejb,rmi,java-ee-6
I am writing an application that uses RMI to invoke EJBs. The EJBs are Stateless; the business requirements do not require conversational state with the client. One of the parameters to the EJB method calls is a "User" object used to determine if the user associated with the call has...

HTTP GET request get HTML page code instead of expected json Response

java,java-ee
/Here is the code/ <html><head><meta http-equiv="Refresh" content="0; URL=http://www.fifacoinservice.com/api/v1"></head><body></body></html> HTTP/1.1 400 Bad Request Server: PipeGuard Date: Mon, 15 Jun 2015 10:29:32 GMT Content-Type: text/html Content-Length: 605 Connection: close <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <h1>400 Bad Request</h1> <p>Your...

Spring MVC Validation error

java,spring,spring-mvc,java-ee
I have a Spring controller that accepts one of my business objects as an argument, that spring is automatically building from form data. One of the attributes of the object is an enum that comes from a select dropdown in the form. I am also using the @Valid notation to...

Is it possible to activate the Session Scope and Conversation Scope from the existing Request Scope?

java,java-ee,ejb,weld,conversation-scope
I have an @EJB injected bean TransactionCompleteJob. This bean has an @Asynchronous method on it asyncCompleteTransaction(Integer transactionId). When I try to make use of other injected beans and entities that are either session scoped or conversation scoped within this method I end up getting an error: WELD-001303: No active contexts...

java.lang.NullPointerException at com.sun.ejb.codegen.EjbOptionalIntfGenerator.generateSubclass(EjbOptionalIntfGenerator.java:280)

java-ee,nullpointerexception,glassfish,ejb,subclass
So I was using EJB to create users in DB. It worked. So after that I made a profile page that user can change. Unfortunately I'm hit with an NPE because the EJB can't load. So I've another @Stateless class and that I pretty much copy pasted to create this...

J2EE Outdated Design Patterns

java-ee,design-patterns
I'm writing a paper for my master degree on JEE Design Patterns. I'm using with it the solutions that Spring gives us. I was searching for any info on the web but didn't got to much of info, probably someone with more experience would be of any help? If anyone...

Create build.xml file independant of the location of the libraries on a computer

eclipse,java-ee,ant,build
In order to generate a war file , I've created a build.xml file via eclipse. The build.xml is as shown below: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- WARNING: Eclipse auto-generated file. Any modifications will be overwritten. To include a user specific buildfile here, simply create one in the same directory with...

Java Servlet - get parameters with same name

java,java-ee,servlets,post
I know that I can get parameter like: HTML <input type="text" name="field" value="test"> Servlet String field = request.getParameter("field"); But what if I have multiple input with same name like: HTML <input type="text" name="line[]" value="test1"> <input type="text" name="line[]" value="test2"> <input type="text" name="line[]" value="test3"> In PHP I can just use name="line[]" to...

Java - elastic search [closed]

java,postgresql,java-ee,elasticsearch
Here I'm trying to make a java application and use elasticsearch in the application as a first stage i have made a simple Dynamic Web Java application with spring. In this application(Simple employee records application) I have a privileged login (Admin & User). Admin - He has all permission User...

Exception in using appclient jar in EJB 3 :javax.ejb.EJBException: java.rmi.MarshalException:

java,java-ee,glassfish,ejb-3.0
I am trying to learn ejb 3 and facing an issue in the below mentioned scenario which I am not able to figure out. I am having one Entity (Book) to store book related data. I have created Stateless Bean and Remote interfaces and deployed the jar in glassfish 4....

Glassfish service throws an error

java-ee,netbeans,service,glassfish
I have successfully installed a Glassfish service that runs on my server. When I try to access the application, I get an HTTP 500 error : org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required When I launch NetBeans and Glassfish, it...

Convert a web project to EJB Project with CDI and JPA

maven,java-ee,jpa,ejb
I have a web project that was developed using JSP , Servlets and JDBC. When built it generates a web archive. Now my task is to remove the JDBC , introduce JPA, EJB and CDI which is done for some pages. After this I want to split the same project...

Unable to get a EJB business object

java-ee,ejb-2.x
I have a situation where I need to call methodB() of an EJB from methodA() of the same EJB, with a new transaction starting in methodB(). I read on some threads that getting a reference to the EJB through sessionContext.getBusinessObject(EjbLocalInterface.class); will work. But it gives me a java.lang.Exception: com.ibm.ejs.container.UnknownLocalException: nested...

How exactly are the root context and the dispatcher servlet context into a Spring MVC web application?

java,spring,spring-mvc,java-ee,servlets
I am studying Spring MVC and I have some doubt related So, I have this configuration class that configure my DispatcherServlet that handle the user requests: public class MyWebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = ... //...

Java EJB @Schedule annotation method is being called twice

java,java-ee,ejb,schedule
I am working on a J2EE project that, in short, sends an automated email to a user at a designated time, and allows the user to download files from the webpage that is emailed to them. It works pretty well. However, my timer method that uses the @Schedule annotation is...

@InterceptorBinding / CDI/ EJB 3.2 - problems with injection

java,java-ee,cdi,wildfly-8,java-ee-7
My dev environment is: WildFly 8.1, CDI, EJB 3.2, JDK 1.7. App is packed as an ear archive (one ejb + one war) because probably it gonna have other web modules in the future. I'm struggling with a custom @InterceptorBinding type used inside my EJB stateless bean. @Inherited @InterceptorBinding @Target({...

Propagate J2EE context Websphere

java,java-ee,websphere-8
I am working on Jersey based JAX-RS2 app running on Websphere 8.5. I am using async feature to spawn a new thread. The issue is that the new thread is not getting the j2ee context required for jndi lookups. The error that I get is: A JNDI operation on a...

Hibernate Lazy loading not work in OneToOne relation

hibernate,java-ee
In my company we migrated one old app from Hibernate 2 to Hibernate 4. My task was to move all xml entities to annotations. After moving it lazy loading in OneToOne relationship stop working. entity a xml: <id name="entityAid" type="integer" column="entityAid_id"> <one-to-one name="entityB" entity-name="EntityB" property-ref="entityA" /> entity b xml: <property...

Simulate @Startup on EJB 3.0 (WebLogic 11gR1)

java,java-ee,ejb-3.0,startup,weblogic11g
My goal is to set up a scheduled job that starts running at startup. on EJB 3.1, I could do something like: @Startup @Stateless public class SchedulePoller { @Resource TimerService timerService; @PostConstruct public void defineScheduler() { timerService.createTimer(60000, 60000, null); } @Timeout public void checkSchedule(Timer timer) { System.out.println("time: " + new...

Wildfly Kafka clients module javax/management/JMException not found

java-ee,jboss,wildfly,kafka
I'm try to create Kafka clients module for Wildfly. Here is module.xml: <?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.0" name="org.apache.kafka.clients"> <resources> <resource-root path="kafka-clients-0.8.2.0.jar"/> <resource-root path="lz4-1.2.0.jar"/> <resource-root path="snappy-java-1.1.1.6.jar"/> </resources> <dependencies> <module name="org.slf4j"/> </dependencies> </module> Wildfly (8.2.0-Final) gives this error on boot:...

Persistent authentication filter logging in; not propagating to JSP

jsp,java-ee,jstl,struts,servlet-filters
I've been working on a "Remember Me?"-style persistent authentication system, but after successfully authenticating and logging in the user, my JSPs do not reflect that the user is logged in until the next page request or refresh is processed. The cookie used for this is being written, and the database...

EJB find method and multiple identifiers

java-ee,ejb
I have the following entity bean that contains multiple @Id: @Entity @Table (name="meta_tables") public class MetaTableEnt implements Serializable{ @Id @Column(name="data_ind") private Integer dataInd; @Id @Column(name="sk") private Integer sk; // other columns } and need to implement the find method: MetaTableEnt mte = em.find(MetaTableEnt.class, object); I defined object as follows, however...

request.getParameter without checking the checkbox in UI … Servlets (J2EE)

java,java-ee,servlets
I have seen so many articles but never got this point. Can you explain why ? Here is the code I do have: HTML: <input type="checkbox" name="mailing" /> Would you like to join our mailing list ? SERVLET: request.getParameter("mailing").equals("on") ? true : false; // Error if I have NOT checked...

Custom Log Handler using HTTP PUT Method and creates loop

java,java-ee,logging,bluemix
i working on a Java Webservice. We want to build our own Custom Log Service on Bluemix. To use the log service i created a custom Log handler. The log handler builds the request in the publish method and then try to send via http put method the log to...

Initialize subclasses after @PostConstruct

java-ee,cdi
I'm using the Context Dependency Injection CDI 1.1 framework from JavaEE 7, within the WildFly 8.2 application server I want to initialize subclasses after a @PostConstruct of the super class So I do somthing like that // case 1: it's working but it's not simple to understand public class A...

Setting response header using interceptor?

java,java-ee,jax-rs,resteasy,interceptor
I'm writing jax-rs end points. For some set of end points (existing code), I want to set an extra response header which was actually generated in @AroundInvoke interceptor and set to HttpServletRequest attribute. In @AroundInvoke I'm able to access HttpServletRequest using @Inject. But it seems I cannot access HttpServletResponse in...

Interpretation of an interface driven implementation of the observer pattern in Java

java,swing,java-ee,design-patterns,observer-pattern
I am studying the observer pattern implemented in Java and I have some doubts about how the tutorial implementation exactly works. I know that this pattern is used in all the situation that expect the user interaction with a GUI (for example the user click on a button) or all...

How to check Glassfish4 server is overloaded?

jsp,java-ee,servlets,glassfish,servlet-filters
My java web application runs on Glassfish4. I want to show a webpage have the string - Server too busy. Please try again later. Which solution is the best for this case?...

Is it possible to know from which URL the request came to a Java EE application servlet?

java-ee
If a web application A requests an other Java EE web application B, is it possible to retreive the URL of the web app A (requester) from the HttpServletRequest object in the servlet's doGet() method?

Eclipse compile error 'The left parenthesis is missing from the IN expression'

eclipse,java-ee,jpa
I have compiled my project in Eclipse. It is a Java EE project with JPA entities. I get this error where the @NamedQuery annotation is not understood when it has an IN clause in it. Is this maybe a wrong dependency on a Java EE library?...

withSchedule(ScheduleBuilder) in the type TriggerBuilder is not applicable for arguments (MutableTrigger)

java,java-ee,quartz-scheduler
Following code gives error like : The method withSchedule(ScheduleBuilder) in the type TriggerBuilder is not applicable for the arguments (MutableTrigger) public static Trigger buildTriggerForJob(int hours, int minutes, int seconds, String name, String groupName) { return org.quartz.TriggerBuilder .newTrigger() .withIdentity(name, groupName) .withSchedule( SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(hours).withIntervalInMinutes(minutes) .withIntervalInSeconds(seconds).repeatForever().build()); } ...

Debugging service test client: Netbeans debugger won't recognize Glassfish server

java,debugging,java-ee,netbeans,glassfish
Here's what I've done so far: Did a fresh build of project (web service project). Redeployed project war file to Glassfish server. Restarted server with --debug=true. Attached debugger from Netbeans. Debugger attaches to the server without an error (responds "User Program Running"), however the Debug tab (in the Projects/Files/Services window)...

Send data from bpm workflow to openERP?

java-ee,openerp,xml-rpc,bonita,bpms
After a lot of research, i couldn't find any useful information that could be of use onto my problem. My problem is how i can send business data from BPMS (bonita, tibgo, bizagi ....) to openERP via web services?.

Run multi threads in servlets

java,multithreading,java-ee,servlets
I have couple of processes (calling to a 3rd party service and get response, query database and get results, do some IO operations etc) to be executed in my servlets. Moreover, those processes are time consuming and if the 3rd party call which is the first process, response fails, the...