java-ee

On what basis can we decide a particular Java application is a Java EE application?

随声附和 提交于 2019-12-31 04:33:15
问题 I am working on a Java application which uses Servlets, an application server, JMS, JMX etc. So is this a Java EE application? And are there any particular criteria to say a particular application is a Java EE application? 回答1: I don't completely agree with the other answers. You have a Java EE application if you can package it as a .war or an .ear and deploy it according to the Java EE standards. If you have a stand-alone application which uses JMS, it doesn't make it a Java EE application

Java EE 7 Portable solution for Integration and Unit testing

谁说胖子不能爱 提交于 2019-12-31 04:23:05
问题 I am trying to find a portable solution to test my Java EE 7 application. It is especially tricky when to test the EJB and their injections. For example: @org.junit.Test public void testIsValidCredentials() throws Exception { System.out.println("isValidCredentials"); String username = ""; String password = ""; Map properties = new HashMap(); properties.put(EJBContainer.MODULES, new File[] {new File("target/classes")}); EJBContainer container = javax.ejb.embeddable.EJBContainer

Global Filter for all Web Applications

假如想象 提交于 2019-12-31 04:16:30
问题 In a J2EE application, how do I create a global Filter that can access other webapps installed on that app server? 回答1: The Servlet-API does not provide such a security leak. But some containers offer alike. Have a look at the <Valve> Configuration of Apache Tomcat. Maybe there is a similar functionality for webshere, but typically you need to hire a ibm consultant to "find" the configuration. 回答2: Some application servers/servlet containers (Tomcat, JBoss) provide the cross context feature.

Can not include javascript file from WEB-INF directory in JSP.

拈花ヽ惹草 提交于 2019-12-31 04:13:55
问题 How to include a file in the following folder WEB-INF\includes\header.js in jsp using tomcat. I have the included the following in jsp file but it does not work " <script type="text/javascript" src="WEB-INF/includes/header.js"></script> ". It is not getting the header.js and when i view source and try to click on the src link it says resource not found 404 error. 回答1: <script type="text/javascript"> <%@include file="../foo.js" %> </script> foo.js is under WEB-INF/jsp and the file include it

How to deploy war files into cPanel and remove the project name?

会有一股神秘感。 提交于 2019-12-31 04:11:19
问题 I need to run my Java application on cPanel . I have successfully installed Tomcat, I can run my application by copying war file into my www folder but the problem is that it shows the Project name ( war file name) in the address, I need to know how to remove that, so users can access www.example.com rather than www.example.com/MyProject/index.jsp ? 回答1: According to one cpanel hosting service command prompt access is generally turned off for cpanel for security reasons and you have to ask

How to inject EJB with @WebServiceRef from Web-module

谁都会走 提交于 2019-12-31 04:11:07
问题 I have a JEE6 application, with an ejb and a web-module, running on a GlassFish 3.1.1 Now I wanted to access a WebService (JAX-WS) by injecting it (as a Session Bean) into several Managed Beans. @Stateless public class AnyService implements AnyServiceLocal { @WebServiceRef(wsdlLocation = "META-INF/wsdl/AnyService/Any.wsdl") private AnyService service; @Override public String findLastname(Integer key) { Any port = service.getAnyPort(); AnyPerson sp = port.findAnynumber(key); return sp

How to inject EJB with @WebServiceRef from Web-module

落花浮王杯 提交于 2019-12-31 04:10:01
问题 I have a JEE6 application, with an ejb and a web-module, running on a GlassFish 3.1.1 Now I wanted to access a WebService (JAX-WS) by injecting it (as a Session Bean) into several Managed Beans. @Stateless public class AnyService implements AnyServiceLocal { @WebServiceRef(wsdlLocation = "META-INF/wsdl/AnyService/Any.wsdl") private AnyService service; @Override public String findLastname(Integer key) { Any port = service.getAnyPort(); AnyPerson sp = port.findAnynumber(key); return sp

Object is not getting persisted using JPA/JTA/JBOSS/CDI

老子叫甜甜 提交于 2019-12-31 04:07:07
问题 Please help me to understand why object is not getting persisted with following code. It throws javax.persistence.TransactionRequiredException: JBAS011469: Transaction is required to perform this operation (either use a transaction or extended persistence context) public class OrganizationRepositoryImpl implements OrganizationRepository { @PersistenceContext(unitName="usermanagement",type=PersistenceContextType.TRANSACTION) private EntityManager em; public void save(Organization organization)

How to customize error response when deserializing failed

隐身守侯 提交于 2019-12-31 03:51:13
问题 I have a jaxrs endpoint service, in my own ResourceConfig I register an ExceptionMapper , so when somewhere wrong happened, it will return a JSON { errorEnum: "something" } . The service class looks like this. @POST @Path("/query") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response query(final QueryDefinition queryDefinition) { ... } However, in my payload, there is a field which is Enum. If any user made a typo in that field, the error message will be

jars added to WEB-INF/lib doesn't get recognized when I try to import them : says the package doesn't exist

拈花ヽ惹草 提交于 2019-12-31 03:04:53
问题 I have added org.apache.commons.fileupload and org.apache.commons.io package into the WEB-INF/lib directory of my project based on google appengine. But when I try importing in the servlet files the compiler/IDE gives an error that this package doesn't exist. Why is that ? The jar files added : What can be the reason I am getting this error ? What should I do to solve this problem ? 回答1: You might also have to add them to your project's classpath. for eclipse: Right click the jar, select