java-ee

Get the class of java.util.Arrays$ArrayList

夙愿已清 提交于 2019-12-20 06:08:07
问题 How can I know the instance of java.util.Arrays$ArrayList . I've tried this code snippet but it does not work at all : if (myList instanceof Arrays) { //Do something here. } I have compared the object classtype with ArrayList and I had the same issue. But while I was inspecting the object, the classType was a : class java.util.Arrays$ArrayList The conditional statement below was the only solution I found: else if (myList.getClass().toString().equals("class java.util.Arrays$ArrayList")) { //do

Static resources are not cached referenced from glassfish secure page

与世无争的帅哥 提交于 2019-12-20 04:32:09
问题 I'm using JSF 1.2 and glassfish declarative security with j_security_check.. My xhtml page is in secure_pages folder and i secure all the resources in it by setting security constrant with web resources constraint as "/secure_pages/*" ... My javascripts and CSS are in another (non-secure) folder,which are referenced from the xhtml.... I've made resources cacheable according instruction given by link... http://blogs.oracle.com/cwebster/entry/caching_static_resources_in_glassfish Also in one of

How to change database settings for a deployed war file?

偶尔善良 提交于 2019-12-20 04:23:40
问题 We have a WAR file that is deployed however we want to change the database settings. How do I get about doing that? I opened the WAR file in an IDE and there are like 2-3 places that have the database settings. What is the proper way of changing it? Thank You 回答1: The tomcat instance should be set up to provide a datasource through JNDI. 回答2: The proper way is to use a datasource at the application level and to administer it at the application server level. Check the MySQL DBCP Example in the

@FacesComponent on shared library

早过忘川 提交于 2019-12-20 04:13:11
问题 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 expected, but when its on a sharedlib it gives me "Undefined component type MyUIActionList" error. Any ideas on how to make this work? 回答1: Web fragment JARs belong in WAR/WEB-INF/lib and absolutely not in EAR/lib nor

Java Memory : Runtime.getRuntime().maxMemory()

孤街醉人 提交于 2019-12-20 03:25:10
问题 Runtime.getRuntime().maxMemory() shows which memory ? Is it Survivor , Eden , Old, Permanent ? 回答1: It is the maximum size of the heap. It is loosely based on the -mx or -Xmx command line argument but for reasons I don't understand can be 1-5% less (It doesn't seem to be ever exactly the same) What this doesn't include is the perm gen, the direct memory, memory mapped files, stack spaces or shared libraries. While it doesn't include everything is it usually 80-90% the total memory usable for

Glassfish 3.1.2 and Eclipse Indigo Plugin

☆樱花仙子☆ 提交于 2019-12-20 03:09:49
问题 My freshly installed Eclipse Indigo SR2 with the new Glassfish 3.1.2 Plugin creates on every start a new "Internal GlassFish 3.1.2" Server. How can I prevent this behavior? Does somebody already use this configuration? 回答1: I've faced the same issue and my workaround is uninstall the " Glassfish 3.1.2 Application Server Runtime " from the Eclipse. Please make a full backup for our Eclipse first. It can be done by the following step: - Go to " Help " menu ---> " About Eclipse ". Click "

Glassfish 3.1.2 and Eclipse Indigo Plugin

a 夏天 提交于 2019-12-20 03:09:03
问题 My freshly installed Eclipse Indigo SR2 with the new Glassfish 3.1.2 Plugin creates on every start a new "Internal GlassFish 3.1.2" Server. How can I prevent this behavior? Does somebody already use this configuration? 回答1: I've faced the same issue and my workaround is uninstall the " Glassfish 3.1.2 Application Server Runtime " from the Eclipse. Please make a full backup for our Eclipse first. It can be done by the following step: - Go to " Help " menu ---> " About Eclipse ". Click "

JavaMail API and Tomcat 7 Implementation

只谈情不闲聊 提交于 2019-12-20 03:04:08
问题 There are several Java EE APIs that exist as just that - APIs (interfaces, domain objects, enums, etc. but no actual classes that do stuff). APIs like JPA, JDBC or JTA. These APIs must then have implementations; for JPA there are impls like Hibernate, MyBatis or TopLink. For JDBC there are drivers for each specific RDBMS. For JTA there is Bitronix and Atomikos. But what about JavaMail? Is it just an API? If so, what are some common implementations of it? If I deploy my Java app (as a WAR) to

Simple ways to keep data on redeployment of Java EE 7 web application

主宰稳场 提交于 2019-12-20 03:02:52
问题 My Java EE 7 web service generates statistics once per day, and because data is stored only in an ApplicationScoped bean, it does not survive redeployment, so clients cannot retrieve statistics until the next run completed. Does Java EE 7 provide a simple way to keep application state so that it will be available after redeployment, similar to an in-memory database? As it is only one big object (list), I would prefer something simpler (and maybe better performing too) than a database. 回答1: In

Share Session between 2 Java EE applications deployed in JBoss AS

末鹿安然 提交于 2019-12-20 02:58:14
问题 I have 2 Java EE applications which need to share some common user related data of a logged in user. Is there anyway by which I can store this data in the session from one application and retrieve that data in a second application? I.e. something similar to sticky sessions in .NET. 回答1: Two separate Java EE applications will be having separate session data. If they are on the same domain and you want to share couple of attributes, then you could use a cookie and set attributes into the cookie