java-ee

Exception occurs with JAX-RPC handler

被刻印的时光 ゝ 提交于 2019-12-24 18:58:44
问题 I have some SOAP webservices build with JAX-RPC. These work fine. But as soon as I add a handler, I get an exception. When the binding is removed from the webservices.xml, everything works fine again. The weird thing is, the handler itself isn't included in the stacktrace of the exception. I also noticed, the init and getHeaders methods of the handler are called, before the exception is raised. The handler is added to webservices.xml with the following xml: <handler> <handler-name>My Message

getting following struts tile error

天大地大妈咪最大 提交于 2019-12-24 18:23:41
问题 I am getting this below error while deploying my application on tomcat 5.5, Please advise how to overcome from this.. SEVERE: Error configuring application listener of class org.apache.struts2.tiles.StrutsTilesListener java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284) at org.apache.catalina

java.net.HttpURLConnection Check / TEST Connection while only POST Method is available

我只是一个虾纸丫 提交于 2019-12-24 17:57:44
问题 There is a webservice on some other server which I am calling in my Java Code. It responses only for POST method (there is NO GET method) available. This request / response works correctly while I implement the full method with request XML and call the Webservice, i.e. it works correctly. But requirement is --> there will be three webservice URLs (configurable from my Application by Admin User). First, I have to check whether the first URL one is connection or not. If Not connecting, then go

java.net.HttpURLConnection Check / TEST Connection while only POST Method is available

偶尔善良 提交于 2019-12-24 17:55:15
问题 There is a webservice on some other server which I am calling in my Java Code. It responses only for POST method (there is NO GET method) available. This request / response works correctly while I implement the full method with request XML and call the Webservice, i.e. it works correctly. But requirement is --> there will be three webservice URLs (configurable from my Application by Admin User). First, I have to check whether the first URL one is connection or not. If Not connecting, then go

app not reading input text files

随声附和 提交于 2019-12-24 17:42:32
问题 I have successfully deployed a Java EE app to openshift with tomcat7. I deployed the war file and the welcome page loads but when my app tries to read an input .txt file to the application it can't find it. Any help would be appreciated. My input files (2) are in the /WEB-INF folder in my project in eclipse. This is my relevant code from my startup servlet: public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // 11 lines of code setting

app not reading input text files

醉酒当歌 提交于 2019-12-24 17:42:14
问题 I have successfully deployed a Java EE app to openshift with tomcat7. I deployed the war file and the welcome page loads but when my app tries to read an input .txt file to the application it can't find it. Any help would be appreciated. My input files (2) are in the /WEB-INF folder in my project in eclipse. This is my relevant code from my startup servlet: public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // 11 lines of code setting

Use index.html as welcome page

前提是你 提交于 2019-12-24 17:27:22
问题 I have a simple java application. I want to set index.html as my welcome page. I tried it but its not working. Although index.jsp is working. Is it possible to use index.html? <display-name>sample</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <servlet> <servlet-name>sample</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet

How to find the parent directory of a deployed Java EE application?

混江龙づ霸主 提交于 2019-12-24 17:22:44
问题 I have a Java EE project that I will turn into a war file. When it runs, it will generate a log file, I would like the file to be generated at the same parent directory as the war file. For example, my war file is: C:\project.war then my log file's path would be: C:\log.txt But all I found was how to find resources inside the project. How can I find the parent directory of my project before it generates a log file? 回答1: You should not rely on paths like this. The WAR that you create may get

@InterceptorBinding / CDI/ EJB 3.2 - problems with injection

匆匆过客 提交于 2019-12-24 17:00:14
问题 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({ TYPE, METHOD }) @Retention(RUNTIME) @Documented public @interface DetectIntegrityConstraintsViolation { } @javax.annotation.ManagedBean // make it a CDI bean. @Interceptor itself should be

How to know the number of the current day in the current years using Java?

本小妞迷上赌 提交于 2019-12-24 16:48:49
问题 I have to calculate in Java what is the number of the current day in the year. For example if today is the 1 of January the resut should be 1 . If it is the 5 of February the result should be 36 How can I automatically do it in Java? Exist some class (such as Calendar ) that natively supports this feature? 回答1: You can use java.util.Calendar class. Be careful that month is zero based. So in your case for the first of January it should be: Calendar calendar = new GregorianCalendar(2015, 0, 1);