Search Results

Search found 700 results on 28 pages for 'j2ee'.

Page 12/28 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Tomcat does save logged users during restart

    - by mabuzer
    How to force Tomcat to save logged users, so that the they kept logged in even after Tomcat has restarted? Right now the user has to login again everytime. Added the following lines into web-app context.xml: <Manager className="org.apache.catalina.session.PersistentManager"> <Store className="org.apache.catalina.session.FileStore"/> </Manager> but still I see login page after Tomcat restart, I use Tomcat 6.0.26 Update I managed to solve it like this: 1) Make my own extended version of FormAuthentication class: package com.alz.tomcat; import java.io.IOException; import java.security.Principal; import org.apache.catalina.Session; import org.apache.catalina.deploy.LoginConfig; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.authenticator.Constants; import org.apache.catalina.authenticator.FormAuthenticator; /** * * @author mabuzer */ public class Authenticator extends FormAuthenticator { @Override public boolean authenticate(Request request, Response response, LoginConfig config) throws IOException { String username = (String) request.getSession().getAttribute("USERNAME"); String password = (String) request.getSession().getAttribute("PASSWORD"); Principal principal = request.getUserPrincipal(); Session session = request.getSessionInternal(true); if (request.getUserPrincipal() == null && !isNull(username) && !isNull(password)) { principal = context.getRealm().authenticate(username, password); if (principal != null) { session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal); if (!matchRequest(request)) { register(request, response, principal, Constants.FORM_METHOD, username, password); return (true); } } return super.authenticate(request, response, config); } else { return super.authenticate(request, response, config); } } private boolean isNull(String str) { if (str == null || "".equals(str)) { return true; } else { return false; } } } 2) Have your own ContextConfig class: package com.alz.tomcat; import java.util.HashMap; import org.apache.catalina.Valve; /** * * @author [email protected] */ public class ContextConfig extends org.apache.catalina.startup.ContextConfig { public ContextConfig() { super(); // we need to append our authenticator setCustomAuthenticators(customAuthenticators); customAuthenticators = new HashMap(); customAuthenticators.put("Authenticator" , new Authenticator()); } } 3) Have a class extends LifeCycleListener to set replace default ContextConfig the one you made: package com.alz.tomcat; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.core.StandardHost; /** * * @author [email protected] */ public class LifeCycleListener implements org.apache.catalina.LifecycleListener { public void lifecycleEvent(LifecycleEvent lifeCycleEvent) { if (Lifecycle.BEFORE_START_EVENT.equals(lifeCycleEvent.getType())) { StandardHost aStandardHost = (StandardHost) lifeCycleEvent.getLifecycle(); aStandardHost.setConfigClass("com.alz.tomcat.ContextConfig"); } } } 4) Final step which is to add your LifeCycleListener to server.xml in Host tag like this: <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false"> <Listener className="com.alz.tomcat.LifeCycleListener"/> </Host>

    Read the article

  • Reflection in unit tests for checking code coverage

    - by Gary
    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 as part of the solution, but maybe you guys have solved the problem before? I want this test to fail when I add fields in the VO, and don't remember to add checks for it in my tests.

    Read the article

  • Seam-gen isn't working properly.. log4j acuses an error

    - by rgoytacaz
    Hello Seam Users, I'm having a couple problems with my Seam start up. I did the ./seam generate to reverse my current postgres db, which contains 4 tables, first I though everything was okay, just a warning message, but when I imported the project into eclipse, I saw that none of my packages had any class. This is the error that seam generate, got me. [hibernate] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering) [hibernate] 1. task: hbm2java (Generates a set of .java files) [hibernate] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). [hibernate] log4j:WARN Please initialize the log4j system properly. [javaformatter] Java formatting of 0 files completed. Skipped 0 file(s). Any ideas? The seam-gen was supposed to generate some entity classes, but its not. I suppose that error is causing the mis-behavior. Regards

    Read the article

  • Back out plan for a Web App

    - by nobody
    We need a back out plan for a web app whose first maintenance release is going to production soon. The issue we are facing is even if we back out new EAR and deploy old one , the data which was keyed in using new release would not support old business rules(current), since there is enormous changes in business rules. Can you suggest how do we tackle this issue?

    Read the article

  • What is Problem in Runtime.getruntime which does not open notepad.exe

    - by magh
    when try to execute the servlet containing following code Runtime rt = Runtime.getRuntime(); Process p = rt.exec("notepad.exe"); It doesn't launch the application in the environment windows server 2003 and Tomcat 5 but a process is being created as notepad.exe in the windows task manager. In windows xp and tomcat 6 environment launches the notepad i need to work on the windows server 2003 and tomcat 5 Thanks in advance

    Read the article

  • correct way to turn EAR module into OSGI bundle

    - by Osw
    Greetings to all! There is a necessity to turn part of EAR (namely - war) into OSGI bundle and retain it's interoperability. Glassfish 3.0.1 already has osgi-web-container module and I succeeded to deploy standalone OSGI war. But in case of of ex-enterprise war it looks a bit difficult to me. What do I do with EJB calls from inside future OSGI war? Is it enough to replace @EJB injections with true JNDI lookups? What about APIs and libraries shared across EAR? I could split and rearrange them, but still I will have at least one jar needed by both EAR and OSGI war. Duplicate, make it as OSGI-bundle itself and make it available to ear somehow, place it GF domain's library path? Any other ideas, advices which could make that hybrid working? Many thanks in advance, Osw

    Read the article

  • How to create commandlink programmatically

    - by John
    Hi, We have a system built on seam/richfaces. There's this webpage where the tables are rendered from dynamic context (from multiple different datasources, and each of them uses a different layout to represent essentially the same real world concept). As a result, this table is binded to a bean, and it's columns/layout are generated from this bean. Now I need to add a command link on a specific column, equivalent to <a4j:commandLink value="#{actBean.Ids}" action="#{actBean.genDetails}"> <f:setPropertyActionListener target="#{actBean.Ref}" value="#{cont}"/> </a4j:commandLink> in a JSF page. My question is, how do I do this programmatically? Thanks!

    Read the article

  • Java Archtecture Decision !!

    - by santiagobasulto
    Hi everybody! I'm developing a medium Java app, and i'm facing a small problem due to my lack of expirience. I've a custom DAO, which gets "Article" objects from the DataBase. I've the Article class, and the DAO has a method called getArticle(int id), this method returns an Article. The Article has a Category object, and i'm using lazy loading. So, when i request for an Article Category (Article a = new Article(); a.getCategory();) the Article class gets the Category from the DAO and then returns it. I'm now thinking to cache it, so when i request multiple times to an Article's category, the database is only queried one time. My question is: where should i put that cache? I can put it on the Article class (in the DTO), or i can put it on the DAO class. What do you say? Thanks!

    Read the article

  • Duplicate Prefix Error in Jsp page with Struts

    - by Cricandcric.com
    Hi, i am creating and Configuring the Struts for the first time, when I place the following Code in my jsp page <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%> I am getting the error when i move the mouse over the 1st Line "Duplicate Prefix "html" When I move the mouse over the 2nd Line, I am getting as "Duplicate Prefix "html" Similarly for 3rd and 4th Line, Can any one tell me why is this error all about Thanks in advance

    Read the article

  • GWT complex app, many screens. Architecture?

    - by Kurian
    I'm making a GWT application which will have many screens. There will be a menu on the left and clicking a menu option will open the relevant module in the right side content area. Clicking on items in the content area will link to other modules that open in the same content area. How do I implement this architecture? How do I pass objects between the different content modules? How do I isolate each module into its own package? Can all of these be within the same Eclipse project? Anything else that should be considered?

    Read the article

  • dynamic 404.jsp using struts

    - by Kapsh
    I would like to display an intelligent 404 page with some application data. Currently, there is a 'dumb' jsp, so I just forward to the view and I am done with it. But now I guess I really need to forward to an action so that I can set some more data to display on the error.jsp. How do I do it through configuration via struts-config? I need congifuration because I do not want to touch any individual files that might be forwarding to the existing view. I tried doing the fol, but I get an error and I dont see anything in the log. So currently, <forward name="ErrorView" path="/Error404.jsp" type="org.apache.struts.action.ActionForward"> </forward> What I want: <forward name="ErrorView" path="/errorAction.do" type="org.apache.struts.action.ActionForward"> </forward>

    Read the article

  • Do I need to installl Glassfish?

    - by Ayusman
    Hi, I am new to glassfish server. i have a question on glassfish usage: can I just use glassfish like a tomcat server without needing an installation? where in, I just take a folder containing glassfish folders, jars etc... dump it in a folder location setup a few environment variables and it runs.. just like tomcat? is it possible with glassfish? also does glassfish installation does any other background things like creating registry entries etc other than creating the glassfish folder structure? TIA Ayusman

    Read the article

  • JMS - How do message selectors work with multiple queue and topic consumers?

    - by Stephen Harmon
    Say you have a JMS queue, and multiple consumers are watching the queue for messages. You want one of the consumers to get all of a particular type of message, so you decide to employ message selectors. For example, you define a property to go in your JMS message header named, "targetConsumer." Your message selector, which you apply to the consumer known as, "A," is something like "WHERE targetConsumer = "CONSUMER_A." It's clear that consumer A will now just grab messages with the property set like it is in in the example. Will the other consumers have awareness of that, though? IOW, will another consumer, unconstrained by a message selector, grab the "CONSUMER_A" messages, if it looks at the queue before Consumer A? Do I need to apply message selectors like, "WHERE targetConsumer < "CONSUMER_A" to the others? I am RTFMing and gathering empirical data now, but was hoping someone might know off the top of their head.

    Read the article

  • Where are the network boundaries in the Java Connector Architecture (JCA)?

    - by Laird Nelson
    I am writing a JCA resource adapter. I'm also, as I go, trying to fully understand the connection management portion of the JCA specification. As a thought experiment, pretend that the only client of this adapter will be a Swing Java Application Client located on a different machine. Also assume that the resource adapter will communicate with its "enterprise information system" (EIS) over the network as well. As I understand the JCA specification, the .rar file is deployed to the application server. The application server creates the .rar file's implementation of the ManagedConnectionFactory interface. It then asks it to produce a connection factory, which is the opaque object that is deployed to JNDI for the user to use to obtain a connection to the resource. (In the case of JDBC, the connection factory is a javax.sql.DataSource.) It is a requirement that the connection factory retain a reference to the application-server-supplied ConnectionManager, which, in turn, is required to be Serializable. This makes sense--in order for the connection factory to be stored in JNDI, it must be serializable, and in order for it to keep a reference to the ConnectionManager, the ConnectionManager must also be serializable. So fine, this little object graph gets installed in the application client's JNDI tree. This is where I start to get queasy. Is the ConnectionManager--the piece supplied by the application server that is supposed to handle connection management, sharing, pooling, etc.--wholly present on the client at this point? One of its jobs is to create ManagedConnection instances, and a ManagedConnection is not required to be Serializable, and the user connection handles it vends are also not required to be Serializable. That suggests to me that the whole connection pooling machinery is shipped wholesale to the application client and stuffed into its JNDI tree. Does this all mean that JCA interactions from the client side bypass the server-side componentry of the application server? Where are the network boundaries in the JCA API?

    Read the article

  • Java IDE - find all INDIRECT usages/references of a function or class?

    - by GreenieMeanie
    In Netbeans or in Eclipse, you can use "Find Usages" or "References" from the right click context menu. If a() calls b(), using the functionality from b() will show you a(). However, what I want is to be able to see some kind of tree or have an option to see all usages of a given/class or method, such that if z() calls a() that using the functionality will show both z() and a(). Any IDE plugins or external tools that can do this?

    Read the article

  • Weblogic server lib VS instance libext

    - by Sebastien Lorber
    Hello, I use weblogic 10. Its provide an Oracle JDBC driver 10.2.0.2 (in the server/lib on weblogic home). Actually someone at work put a long time ago a 10.2.0.3 driver in instance libext folder. But in production we got a jdbc driver stack (nullpointer :O) and by reverse engineering it seems we are using driver 10.2.0.2. We know that we could change the driver in the server/lib of weblogic but i want to understand. Isn't libext supposed to override server libs like META-INF libs override libext? By the way we are in a strange situation: - We have 2 EAR, and for the exact same treatment in those 2, one will sometime throw the oracle driver nullpointer while the other doesn't - I wonder if one ear isn't using 10.2.0.2 while the other is using 10.2.0.3 (i saw a bug fixed that could fit to our problem for this version). - I need to look better but at first sight both ear use the exact same datasource set in weblogic JNDI resources Any idea?

    Read the article

  • Inject a EJB into a JSF converter with JEE6

    - by Michael Bavin
    Hi, I have a stateless EJB that acceses my database. I need this bean in a JSF 2 converter to retreive an entity object from the String value parameter. I'm using JEE6 with Glassfish V3 @EJB annotation does not work and gets a NPE, because it's in the faces context and it has not access to the ejb context. My question is: Is it still possible to Inject this bean (With a @Resource or other annotation, a JNDI lookup,...), or do i need a workaround? Thank you Solution Do a JNDI lookup like this: try { ic = new InitialContext(); myejb= (MyEJB) ic .lookup("java:global/xxxx/MyEJB"); } catch (NamingException e) { e.printStackTrace(); }

    Read the article

  • In JSF, how to handle repeating over a list that mutates

    - by Jon
    Hello, In a JSF page, I am iterating over a list of items provided by a session-scoped backing bean. The list needs to be kept up-to-date, so it is replaced with a fresh list every X minutes by a thread (in a thread-safe way). On my page, for each item I provide some text inputs and an "Update" button. If the list is refreshed before I hit "Update", the update does not happen (which is my problem). I happen to be using a4j:repeat, but I think this could also apply to other methods of iteration, including using dataTables. Any thoughts on how I can do this in a non-hackish way? Thanks!

    Read the article

  • How to design service that can provide interface as JAX-WS web service, or via JMS, or as local meth

    - by kevinegham
    Using a typical JEE framework, how do I develop and deploy a service that can be called as a web service (with a WSDL interface), be invoked via JMS messages, or called directly from another service in the same container? Here's some more context: Currently I am responsible for a service (let's call it Service X) with the following properties: Interface definition is a human readable document kept up-to-date manually. Accepts HTTP form-encoded requests to a single URL. Sends plain old XML responses (no schema). Uses Apache to accept requests + a proprietary application server (not servlet or EJB based) containing all logic which runs in a seperate tier. Makes heavy use of a relational database. Called both by internal applications written in a variety of languages and also by a small number of third-parties. I want to (or at least, have been told to!): Switch to a well-known (pref. open source) JEE stack such as JBoss, Glassfish, etc. Split Service X into Service A and Service B so that we can take Service B down for maintenance without affecting Service A. Note that Service B will depend on (i.e. need to make requests to) Service A. Make both services easier for third parties to integrate with by providing at least a WS-I style interface (WSDL + SOAP + XML + HTTP) and probably a JMS interface too. In future we might consider a more lightweight API too (REST + JSON? Google Protocol Buffers?) but that's a nice to have. Additional consideration are: On a smaller deployment, Service A and Service B will likely to running on the same machine and it would seem rather silly for them to use HTTP or a message bus to communicate; better if they could run in the same container and make method calls to each other. Backwards compatibility with the existing ad-hoc Service X interface is not required, and we're not planning on re-using too much of the existing code for the new services. I'm happy with either contract-first (WSDL I guess) or (annotated) code-first development. Apologies if my terminology is a bit hazy - I'm pretty experienced with Java and web programming in general, but am finding it quite hard to get up to speed with all this enterprise / SOA stuff - it seems I have a lot to learn! I'm also not very used to using a framework rather than simply writing code that calls some packages to do things. I've got as far as downloading Glassfish, knocking up a simple WSDL file and using wsimport + a little dummy code to turn that into a WAR file which I've deployed.

    Read the article

  • Java data structure suggestion.

    - by techoverflow
    Hi folks, I am a newbie in this field so please excuse my silly mistakes :) So the issue I am facing is: On my webpage, I am displaying a table. For now my issue is concerned with three columns of the table. First is : Area Code Second is : Zone Code Third is: Value The relationship between these three is: 1 Area Code has 6 different Zone code's and all those 6 Zone codes have corresponding "Value" I need a data structer that would give me the flexibility to get a "Value" for a Zone code, which falls under a particular Area code. I have the same zone codes for all the Area codes: Zone codes are: 111, 222, 333, 444, 555, 666 After surfing your stackoverflow, I thought I can go with this structure: Map<Integer, Map<Integer, Double>> retailPrices = new HashMap<Integer, Map<Integer, Double>>(); Map<Integer, Double> codes = new HashMap<Integer, Double>(); where reatailPrices would hold an Area Code and a Map of Zone code as Key and "Value" as Value. but when I am trying to populate this through a SQL resultset, I am getting the following error: The method put(Integer, Map<Integer,Double>) in the type Map is not applicable for the arguments (Integer, Double) on line: `while(oResult.next()) retailPrices.put((new Integer(oResult.getString("AREA"))), (pegPlPrices.put(new Integer(oResult.getString("ZONE_CODE")), new Double(oResult.getString("VALUE"))))); }` please help me figure out this problem. Am I following the right approach?

    Read the article

  • How can I create global context variables in JBOSS?

    - by NobodyMan
    This is a follow-up to a question I posted a while back: "Can I use a single WAR in multiple environments?". I was able to create a single-war solution in Tomcat, but now we are migrating our app to JBoss 4.2 and I can't figure out how to set up global environment variables. In Tomcat 6 this was pretty straightforward: I simply put the following snippet in tomcat/conf/Catalina/myappname.xml: <Context ...> <Environment name="TARGET_ENV" value="DEV" type="java.lang.String" override="false"/> </Context> Then in my app I was able to resolve the environment name with the following: Context context = (Context) InitialContext().lookup("java:comp/env"); String targetEnvironment = (String) context.lookup("TARGET_ENV"); The problem is that I can't find out where/how to place global variables in JBoss. I've tried putting the <Environment> tag in the following files to no avail: server/all/deploy/jboss-web.deployer/context.xml server/default/deploy/jboss-web.deployer/context.xml I know that I can put environment variables in my app's web.xml but that defeats the purpose of having a unified war - I'd still need custom .war's for dev, qa and prod. I'm a JBoss newbie so if there's any additional information that would help just let me know and I'll append to this question. Many thanks! --N

    Read the article

  • Java: Convenient way to refactor the application.

    - by Harshal
    Hi, Everyone We have an agile enterprise application built on JSP and Servlet without any design strategy. This application was built in early 2002 considering 1000 users. After 2002, we received lots of requests from the marketing partners. Currently, the application has lots of spaghetti code with lots of Ifs and elses. One class has more than 20,000 lines of code with a huge body of functions without abstraction. Now, we need to support billions of records, what we need to do immediately and gradually? We have to refactor the application? Which framework, we need to use? How the usage of the framework will be helpful to the end users? How to convince the leaders to do the refactoring? How to gain the faster response time as compare to the current system?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >