java-ee

Need help understanding JNDI and a particular ClassCastException in J2EE

与世无争的帅哥 提交于 2019-12-12 12:27:22
问题 I have an enterprise application A and B deployed (in WLS 10.0). A is the "framework", B is a client app. The client issues the following calls: Object o = ctx.lookup(jndiName); // line 1 cf = (ConnectionFactory) o; // line 2 ConnectionFactory is an interface, defined as: public interface ConnectionFactory extends java.io.Serializable, javax.resource.Referenceable { ... } What happens is: If the jar containing the interface class is on the system classpath, line 2 is executed fine If the

How to deploy a simple war file on JBOSS 7?

别来无恙 提交于 2019-12-12 12:25:19
问题 I deployed a simple war file (vivek.war) which contains a simple index.jsp file successfully in Jboss-5.X.X and Jboss-6.X.X. I simply placed the war file in server\default\deploy And then went to localhost:8080/vivek/index.jsp and everything was fine. But Similarly, for Jboss-as-7.1.1, I deployed the war file in standalone standalone\deployments and started \bin\standalone.sh and then went to localhost:8080/Hello/index.jsp does not display the file. it shows HTTP Status 404-/vivek/

log4j in a multi-module Maven project

半城伤御伤魂 提交于 2019-12-12 12:18:26
问题 How do I implement log4j in a multi-module Maven project? Do I add a "log4j.properties" file to the src/main/resources directory of every submodule? If so, do I have to specify a different output file for each file appender? Or is there a way to have one overarching log4j.properties file for the whole project, without having a configuration nightmare. Which approach (many log4j.properties files versus one) is more common and better practice? Thanks for all feedback in advance. 回答1: It depends

File upload using REST service

坚强是说给别人听的谎言 提交于 2019-12-12 12:17:21
问题 I use following REST service (from this tutorial) to do file uploads from various number of clients to my GlassFish server, using jersey multipart implementation: import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.sun.jersey.core.header

The web application [ROOT] is still processing a request that has yet to finish. [Tomcat]

随声附和 提交于 2019-12-12 12:15:07
问题 I saw this error today when I tried shutting down the server. Here's the full stacktrace. 06-Jul-2015 05:47:10.407 WARNING [RMI TCP Connection(5)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation. Stack trace

Servlet 3.0 logout doesn't work

女生的网名这么多〃 提交于 2019-12-12 12:08:29
问题 I've got a problem with the authentication features of Servlet 3.0: With this code in a Servlet v3: log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); log.info("===^==="); request.logout() ; log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); request.authenticate(response) ; log.info("===v==="); log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); I would always expect to see the Username/login windows, because of the

Quartz Job Scheduler - Multi-Tenant Setup

拈花ヽ惹草 提交于 2019-12-12 12:08:01
问题 Since I haven't found anything related to that which would have lead me to inspiration, I thought I'd come up with this here. I recently worked a lot with the Quartz Job Scheduler which I've already implemented within a RESTful Java Servlet that is supposed to offer a Sencha ExtJS-based UI for job creation. We use an Authenticator class in combination with a DatabaseManager that take care of authenticating users and all other database-specific stuff (using Hibernate). Since we want to use it

Reflection in unit tests for checking code coverage

泪湿孤枕 提交于 2019-12-12 12:03:08
问题 Here's the scenario. I have VO (Value Objects) or DTO objects that are just containers for data. When I take those and split them apart for saving into a DB that (for lots of reasons) doesn't map to the VO's elegantly, I want to test to see if each field is successfully being created in the database and successfully read back in to rebuild the VO. Is there a way I can test that my tests cover every field in the VO? I had an idea about using reflection to iterate through the fields of the VO's

How can I specify a shared library reference at the web module level in Websphere 6.1 deployment descriptors?

懵懂的女人 提交于 2019-12-12 12:02:52
问题 I am working on a web application that is deployed to Websphere as a war file contained inside a wrapper ear. There are no other modules within the ear. A shared library has been created at the cell scope in the Websphere admin console, and I can specify a shared library reference at the web module level in the admin console. Everything works great when I do this, until I undeploy and redeploy the application, which of course causes the shared library reference to disappear. I would like to

how to get Set data type from mysql to java

拈花ヽ惹草 提交于 2019-12-12 11:39:47
问题 So here is my question. I create a table which contains a SET data type column in mysql DB. I want to get the values of the of this (SET) column. I have done all the connection configurations and everything is working well on my code. How to get the Set dataType with resultSet in Set java object???? I've tried this. Java bean code public class Valeur { private Long id; private Set categoriesValues = new HashSet(); \\getters and setters for the id and the categoriesValues } ReultSet Code