java-ee

“JNDI name is already in use” in Weblogic 12c with EJB3

我是研究僧i 提交于 2020-01-03 10:56:45
问题 I have the following code that I'm trying to deploy as an EJB to WebLogic 12c, but I'm getting an error: "Error deploying the EJB GeopoliticalServiceBean(Application: campaigner-ejb, EJBComponent: campaigner-service.jar), the JNDI name java:global/campaigner-ejb/campaigner-service/GeopoliticalServiceBean!com.dr_dee_sw.campaigner.service.GeopoliticalServiceLocal is already in use. You must set a different JNDI name in the weblogic-ejb-jar.xml deployment descriptor or corresponding annotation

How do I get the name of the WAR file?

折月煮酒 提交于 2020-01-03 09:05:10
问题 How can a class get the name of the WAR file that is using it? This is for diagnostic purposes. 回答1: in servlet String warName = new File(getServletContext().getRealPath("/")).getName(); you can use this. 回答2: ServletContext.getContextPath() This returns the context path of the application (or "" for the root context). Within a servlet container, no two applications will ever have the same value for this. EDIT: And for those who don't know what the context path is: it's the URI prefix for the

Download and install button in greyed out in Eclipse for Apache Tomcat v8.0

半城伤御伤魂 提交于 2020-01-03 08:33:17
问题 I want Eclipse to download and install Apache Tomcat server environment but that option is greyed out for me Any idea what might be missing? Eclipse details : Eclipse Java EE IDE for Web Developers. Version: Mars.2 Release(4.5.2) Java 8 回答1: You can download tomcat separatly, than you can specify particulare installation path 回答2: It appears that this is caused by the lack of installable runtimes being defined for a given version of Tomcat in eclipse's org.eclipse.jst.server.tomcat.core

Download and install button in greyed out in Eclipse for Apache Tomcat v8.0

隐身守侯 提交于 2020-01-03 08:32:14
问题 I want Eclipse to download and install Apache Tomcat server environment but that option is greyed out for me Any idea what might be missing? Eclipse details : Eclipse Java EE IDE for Web Developers. Version: Mars.2 Release(4.5.2) Java 8 回答1: You can download tomcat separatly, than you can specify particulare installation path 回答2: It appears that this is caused by the lack of installable runtimes being defined for a given version of Tomcat in eclipse's org.eclipse.jst.server.tomcat.core

Spring 3 SimpleMappingExceptionResolver warnLogCategory log4j

China☆狼群 提交于 2020-01-03 07:21:37
问题 <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <map> <entry key="java.lang.Exception" value="error"/> </map> </property> <property name="warnLogCategory" value="abcdefg"/> </bean> I would like to log the exception above into a .log file, but it does not log =(. Could someone comment on what might be wrong with my log4j properties...or anything else? Using Spring 3.0.5 thanks log4j.rootLogger

J2EE:error in displaying ERROR page

放肆的年华 提交于 2020-01-03 06:04:07
问题 i have created a jsp contains <% int i=10; if(i==10) throw new ArithmeticException("ItsMyGenExcepetion"); %> i have made entry in web.xml <error-page> <exception-type>java.lang.ArithmeticException</exception-type> <location>/errordisplay.jsp</location> </error-page> i have my errordisply.jsp contains <%@ page isErrorPage="true" %> in body The page contain error <%= exception %> but its not showing the error page.... 回答1: Try adding: <%@ page errorPage="/errordisplay.jsp" %> to the JSP that is

How to implement Parallel Zip Creation with ScatterZipOutputStream with Zip64 Support?

回眸只為那壹抹淺笑 提交于 2020-01-03 05:47:29
问题 I am wondering if any one can help implementing Parallel Zip Creation using ScatterZipOutputStream . I have searched a lot but no where I am finding an example for the same. https://commons.apache.org/proper/commons-compress/zip.html I have tried making Zip, Zipping a directory etc with ZipArchiveOutputStream . Now, I am trying to do that in parallel. public static void makeZip(String filename) throws IOException, ArchiveException { File sourceFile = new File(filename); final OutputStream out

POST call to another server

China☆狼群 提交于 2020-01-03 04:51:06
问题 HI, Can we make the POST call from one server to another web server. For example, one web application deployed in server1. When we call the web application deployed in the server2, can we call using the POST method type. or always it can be GET method with explicit URLs 回答1: Two ways: If your current request is already POST, just send a 307 redirect. response.setStatus(307); response.setHeader("Location", "http://other.com"); This will however issue a security confirmation warning at the

many-to-many JPA mapping inserting but not fething the child collections

孤街浪徒 提交于 2020-01-03 04:40:09
问题 i've hit a block once again with hibernate.I've posted numerous times on different aspects of the user and contact management that i've been building. The sad thing is that i didn't really have the time to play with it and understand it better before actually starting working with it. Sorry but English is not my native language, i rather speak french. And again i've started coding in java in an autodidact way.i'm doing all of this by reading books and haven't gone to school for it. with time

Security exceptions when injecting an EJB in wildfly

心已入冬 提交于 2020-01-03 04:36:08
问题 I try to migrate from JBoss AS 7 to Wildfly 8.2. and from Java 1.6 to Java 1.7. and I get some security exceptions when injecting an ejb bean to my batch job. Here is my scheduler: (runs every minute) @Startup @Singleton public class MyBatchScheduler { @Inject MyBatch myBatch; @Schedule(second = "30", minute = "*/1", hour = "*", persistent = false) public void runBackgroundTasks() { myBatch.runBackgroundTasksAsync(); } } Here is my batch: (called by scheduler every minute) @Stateless public