Search Results

Search found 3616 results on 145 pages for 'michael war'.

Page 7/145 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Maven Plugin - Restart Jetty with new WAR?

    - by Walter White
    Hi all, What I would like to do is automatically test against several different maven build profiles. I want to write a maven plugin that iterates through each profile so I don't have to manually list them for the CI process. I just want to verify that the code works in all development, testing, staging, and production once deployed there. I want it to automatically test against those profiles so I could keep it a part of the same maven build? How would I best set that up to log those changes in Sonar or another tool? Walter

    Read the article

  • JBoss Developer Studio exploaded SAR/EAR/WAR deployment

    - by dr_hoppa
    I am new to JBoss DS and I could not figur out is how to make a folder from my project deployable, exploded SAR in my case. If I create a new server in the JBoss server view / JBoss AS perspective and select a SAR and make it a deployable then the SAR file can be deployed on the JBoss server. Another approch that I have tryed is to make the *-service.xml file as a deployable element, same procedure as with the SAR file, and to add the Eclipse project as a dependency to the classpath of the server 'Open launch configuration' / 'Classpath' after dooing this I got an error from JBoss telling me that the JBoss classes are not found. The compromise solution that I have found is to create a junction/symlink from the output of the Eclipse project 'bin' into the JBoss 'serve//deploy/xxx.sar' this is a temporary solution but will not scale in the future as multiple services must be created. What I would need: I would need to have the ability to make the exploded folder as 'mark deployable' and to be have the classes/*service.xml files loaded from there and to have hot-deployability for them. Any sugestions would help.

    Read the article

  • Unpacking an assembly inside of a war

    - by Walter White
    Hi all, I have another project which contains static content (css, images, JS, etc.), and I need that to be copied to the web root directory of jetty for testing. In that project, I output a zip file packaging up all of the images, CSS, etc. I have several of those virtualhost projects for different clients and my question is, how do I unpack the zip file that was already installed into the maven repository to the jetty web root? Walter

    Read the article

  • SMS war continues, ideas welcome

    - by Pavel Radzivilovsky
    I am trying to make U9 telit modem send SMS messages. I think I handle protocol correctly, at least, I manage to send them, but only under these circumstances: the native application was executed beforehand, and killed by task manager (without giving it a chance to initialize things). It looks like the supplied application is good at doing certain initialization/deinitialization which is critical. I also see the difference between the two states in output of AT+CIND command. When I am trying to do things on my own, it returns zeroes (including signal quality), but when I run the same command after killing the native application, the output looks reasonable. I am out nearly of ideas. I have tried many things, including attempts to spy at modem's COM ports (didn't work). Haven't tried setting windows hooks to see what the application is trying to get thru. Perhaps you have encountered a similar situation?

    Read the article

  • GF 3.0.1 + Virtual Server: www.myhost.com:8080/projectname-war => www.myhost.com. How?

    - by Harry Pham
    I need to change www.myhost.com:8080/myproject-war to www.myhost.com. This is what I try. In admin console in Glassfish 3.0.1, I create a http-listener-3 with port 9090 and address 0.0.0.0 (I want to have port 80, but got access-denied or some sort). I then create a virtual server call scholar, with Id=scholar, Hosts=${com.sun.aas.hostName}, Network Listeners: http-listener-3, Default Web Module=project#project-war.war(it is the only option from the drop down list since I only deploy 1 app). Then under Applications, I set the virtual server of the application to be scholar. Save and restart. I try localhost:9090, and expecting that it will load my project like as if I type localhost:9090/project-war. But it does not. I already set the Default Web Module, to be the project, why doesnt it load the project by default?

    Read the article

  • Reference table values in a war against magic numbers

    - by Alex N.
    This question bugged me for years now and can't seem to find good solution still. I working in PHP and Java but it sounds like this maybe language-agnostic :) Say we have a standard status reference table that holds status ids for some kind of entity. Further let's assume the table will have just 5 values, and will remain like this for a long time, maybe edited occasionally with addition of a new status. When you fetch a row and need to see what status it is you have 2 options(as I see it at least) - put it straight ID values(magic numbers that is) or use a named constant. Latter seem much cleaner, the question though is where those named constants should leave? In a model class? In a class that uses this particular constant? Somewhere else?

    Read the article

  • Want to make jar,war,ear files using apache ANT and use hudson for automated build process [closed]

    - by user1314506
    I want to make build.xml for following all task and i want to set up jenkins or Hudson for Continuous Integration How should i make build file using apache Ant and how to build all projects using single build file? mkdir MyProjectsjar Compile following project and create jar file javaproject1 package1 javafile1 javafile2 javaproject2 package1 javafiles package2 javafiles javaproject3 package1 javafiles javaproject4 package1 javaproject5 package1 javafiles package2 javafiles javaproject6 package1 javaproject7 package1 javafiles javaproject8 package1 javafiles javaproject9 package1 javafiles package2 javafiles javaproject10 package1 javafiles package2 javafiles javaproject11 package1 javafiles package2 javafiles javaproject12 package1 javafiles package2 javafiles javaproject13 package1 javafiles package2 javafiles javaproject14 package1 javafiles package2 javafiles javaproject15 package1 javafiles package2 javafiles javaproject16 package1 javafiles package2 javafiles javaproject17 package1 javafiles package2 javafiles Copy the above jar files into the folder created in step 1 Compile EJB projects and Create EAR project Compile web projects and other all project and create WAR files copy EAR and WAR files to jboss/default/deploy folder.

    Read the article

  • OS X not allowing me to rename a folder

    - by YGA
    Hi Folks, Can anyone thing of a reason why OS X would not allow me to do this? I seem to have total permissions... new-host-4:Desktop michael$ whoami michael new-host-4:Desktop michael$ ls -ltdr 2008_12_12/ drwxrwxrwx+ 5 michael wheel 170 Mar 28 18:23 2008_12_12/ new-host-4:Desktop michael$ mv 2008_12_12/ foo mv: rename 2008_12_12/ to foo: Permission denied new-host-4:Desktop michael$ Thanks! /YGA

    Read the article

  • Conditional configuration in maven pom.xml

    - by David Zhao
    I'd like to ONLY exclude certain files in maven-war-plugin when property "skipCompress" set to true, I thought I could do something like this, but it doesn't work for me. BTW, I can't use profile to achieve this even I want to use skipCompress to turn on and off the compression in both development and deployment profiles. <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <if> <not> <equals arg1="${skipCompress}" arg2 = "true"/> </not> <then> <warSourceExcludes>**/external/dojo/**/*.js</warSourceExcludes> </then> </if> </configuration> </plugin> Thanks, David

    Read the article

  • Correct way to make datasources/resources a deploy-time setting

    - by Draemon
    I have a web-app that requires two settings: A JDBC datasource A string token I desperately want to be able to deploy one .war to various different containers (jetty,tomcat,gf3 minimum) and configure these settings at application level within the container. My code does this: InitialContext ctx = new InitialContext(); Context envCtx = (javax.naming.Context) ctx.lookup("java:comp/env"); token = (String)envCtx.lookup("token"); ds = (DataSource)envCtx.lookup("jdbc/datasource") Let's assume I've used the glassfish management interface to create two jdbc resources: jdbc/test-datasource and jdbc/live-datasource which connect to different copies of the same schema, on different servers, different credentials etc. Say I want to deploy this to glassfish with and point it at the test datasource, I might have this in my sun-web.xml: ... <resource-ref> <res-ref-name>jdbc/datasource</res-ref-name> <jndi-name>jdbc/test-datasource</jndi-name> </resource-ref> ... but sun-web.xml goes inside my war, right? surely there must be a way to do this through the management interface Am I even trying to do the right thing? Do other containers make this any easier? I'd be particularly interested in how jetty 7 handles this since I use it for development. EDIT Tomcat has a reasonable way to do this: Create $TOMCAT_HOME/conf/Catalina/localhost/webapp.xml with: <?xml version="1.0" encoding="UTF-8"?> <Context antiResourceLocking="false" privileged="true"> <!-- String resource --> <Environment name="token" value="value of token" type="java.lang.String" override="false" /> <!-- Linking to a global resource --> <ResourceLink name="jdbc/datasource1" global="jdbc/test" type="javax.sql.DataSource" /> <!-- Derby --> <Resource name="jdbc/datasource2" type="javax.sql.DataSource" auth="Container" driverClassName="org.apache.derby.jdbc.EmbeddedDataSource" url="jdbc:derby:test;create=true" /> <!-- H2 --> <Resource name="jdbc/datasource3" type="javax.sql.DataSource" auth="Container" driverClassName="org.h2.jdbcx.JdbcDataSource" url="jdbc:h2:~/test" username="sa" password="" /> </Context> Note that override="false" means the opposite. It means that this setting can't be overriden by web.xml. I like this approach because the file is part of the container configuration not the war, but it's not part of the global configuration; it's webapp specific. I guess I expect a bit more from glassfish since it is supposed to have a full web admin interface, but I would be happy enough with something equivalent to the above.

    Read the article

  • Coding solution to WAR installation error (Websphere Portal 6.0) ?

    - by Scott Leis
    I have a Websphere Portal application containing several portlets for which I'm currently working on some changes. A week ago, the WAR file produced by Rational Application Developer could be installed on the Portal server with no problems. Yesterday I made some seemingly minor changes to two JSP files and their associated "pagecode" Java files, and attempting to update the WAR on the server (using the Portal Administration web interface) now produces an error message. The WAR upload works, and the system shows me the correct list of portlets in the WAR file, but clicking "Finish" gives me a page with the error message "EJPAQ1319E: Cannot install the selected WAR file. View Details". Clicking the "View Details" link gives me a page with the following text: EJPAQ1319E: Cannot install the selected WAR file. com.ibm.portal.WpsException: EJPAQ1319E: Cannot install the selected WAR file. at com.ibm.wps.portlets.portletmanager.actions.DoInstallWebModuleAction.installPortletFromFormFile(DoInstallWebModuleAction.java:633) at com.ibm.wps.portlets.portletmanager.actions.DoInstallWebModuleAction.doExecute(DoInstallWebModuleAction.java:159) at com.ibm.wps.portlets.adminstruts.actions.BaseAction.execute(BaseAction.java:64) at com.ibm.wps.portlets.struts.WpsRequestProcessor.processActionPerform(WpsRequestProcessor.java:338) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at com.ibm.wps.portlets.struts.WpsStrutsPortlet.processActionPerformed(WpsStrutsPortlet.java:1947) at com.ibm.wps.portlets.struts.WpsStrutsPortlet.actionPerformed(WpsStrutsPortlet.java:1637) at com.ibm.wps.portlets.adminstruts.WpsAdminStrutsPortlet.actionPerformed(WpsAdminStrutsPortlet.java:261) at com.ibm.wps.pe.pc.legacy.SPIPortletInterceptorImpl.handleEvents(SPIPortletInterceptorImpl.java:323) EJPPE0020E: It is not allowed to install a JSR 168 compliant over a 4.x portlet application. com.ibm.wps.command.applications.AppWarFileException: EJPPE0020E: It is not allowed to install a JSR 168 compliant over a 4.x portlet application. WrappedException is: com.ibm.wps.pe.mgr.exceptions.InvalidWarFileException: EJPPE0020E: It is not allowed to install a JSR 168 compliant over a 4.x portlet application. at com.ibm.wps.command.applications.AbstractApplicationsCommand.throwAppMgrException(AbstractApplicationsCommand.java:492) at com.ibm.wps.command.applications.UpdatePortletApplicationCommand.execute(UpdatePortletApplicationCommand.java:165) at com.ibm.wps.portlets.portletmanager.actions.DoInstallWebModuleAction.installPortletFromFormFile(DoInstallWebModuleAction.java:510) at com.ibm.wps.portlets.portletmanager.actions.DoInstallWebModuleAction.doExecute(DoInstallWebModuleAction.java:159) at com.ibm.wps.portlets.adminstruts.actions.BaseAction.execute(BaseAction.java:64) at com.ibm.wps.portlets.struts.WpsRequestProcessor.processActionPerform(WpsRequestProcessor.java:338) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at com.ibm.wps.portlets.struts.WpsStrutsPortlet.processActionPerformed(WpsStrutsPortlet.java:1947) EJPPE0020E: It is not allowed to install a JSR 168 compliant over a 4.x portlet application. com.ibm.wps.pe.mgr.exceptions.InvalidWarFileException: EJPPE0020E: It is not allowed to install a JSR 168 compliant over a 4.x portlet application. at com.ibm.wps.pe.mgr.AbstractApplicationManagerImpl.updateWebModule(AbstractApplicationManagerImpl.java:1338) at com.ibm.wps.pe.mgr.AbstractApplicationManagerImpl.updateWebModule(AbstractApplicationManagerImpl.java:1255) at com.ibm.wps.command.applications.UpdatePortletApplicationCommand.execute(UpdatePortletApplicationCommand.java:135) at com.ibm.wps.portlets.portletmanager.actions.DoInstallWebModuleAction.installPortletFromFormFile(DoInstallWebModuleAction.java:510) at com.ibm.wps.portlets.portletmanager.actions.DoInstallWebModuleAction.doExecute(DoInstallWebModuleAction.java:159) at com.ibm.wps.portlets.adminstruts.actions.BaseAction.execute(BaseAction.java:64) at com.ibm.wps.portlets.struts.WpsRequestProcessor.processActionPerform(WpsRequestProcessor.java:338) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at com.ibm.wps.portlets.struts.WpsStrutsPortlet.processActionPerformed(WpsStrutsPortlet.java:1947) All I've been able to find about this error via Google is the following in the Websphere Portal documentation: EJPPE0020E: It is not allowed to install a {0} over a {1} portlet application. Explanation: A portlet application containing legacy portlets can only be updated with another portlet application that contains legacy portlets. The same is true for standard portlet applications. User Response: Modify the portlet.xml of the application such that it matches the original API type, standard or legacy and try again. However, the "portlet.xml" file has not changed in about a month, and I've done several WAR updates for this application in that time with no problems. The problem seems to be caused by the code changes I did yesterday, but I have no clue why a few lines of code would do this. Any ideas?

    Read the article

  • Michael Crump&rsquo;s notes for 70-563 PRO &ndash; Designing and Developing Windows Applications usi

    - by mbcrump
    TIME TO GO PRO! This is my notes for 70-563 PRO – Designing and Developing Windows Applications using .NET Framework 3.5 I created it using several resources (various certification web sites, msdn, official ms 70-548 book). The reason that I created this review is because a) I am taking the exam. b) MS did not create a book for this exam. Use the(MS 70-548)book. c) To make sure I am familiar with each before the exam. I hope that it provides a good start for your own notes. I hope that someone finds this useful. At least, it will give you a starting point of what to expect to know on the PRO exam. Also, for those wondering, the PRO exam does contains very little code. It is basically all theory. 1. Validation Controls – How to prevent users from entering invalid data on forms. (MaskedTextBox control and RegEx) 2. ServiceController – used to start and control the behavior of existing services. 3. User Feedback (know winforms Status Bar, Tool Tips, Color, Error Provider, Context-Sensitive and Accessibility) 4. Specific (derived) exceptions must be handled before general (base class) exceptions. By moving the exception handling for the base type Exception to after exception handling of ArgumentNullException, all ArgumentNullException thrown by the Helper method will be caught and logged correctly. 5. A heartbeat method is a method exposed by a Web service that allows external applications to check on the status of the service. 6. New users must master key tasks quickly. Giving these tasks context and appropriate detail will help. However, advanced users will demand quicker paths. Shortcuts, accelerators, or toolbar buttons will speed things along for the advanced user. 7. MSBuild uses project files to instruct the build engine what to build and how to build it. MSBuild project files are XML files that adhere to the MSBuild XML schema. The MSBuild project files contain complete file, build action, and dependency information for each individual projects. 8. Evaluating whether or not to fix a bug involves a triage process. You must identify the bug's impact, set the priority, categorize it, and assign a developer. Many times the person doing the triage work will assign the bug to a developer for further investigation. In fact, the workflow for the bug work item inside of Team System supports this step. Developers are often asked to assess the impact of a given bug. This assessment helps the person doing the triage make a decision on how to proceed. When assessing the impact of a bug, you should consider time and resources to fix it, bug risk, and impacts of the bug. 9. In large projects it is generally impossible and unfeasible to fix all bugs because of the impact on schedule and budget. 10. Code reviews should be conducted by a technical lead or a technical peer. 11. Testing Applications 12. WCF Services – application state 13. SQL Server 2005 / 2008 Express Edition – reliable storage of data / Microsoft SQL Server 3.5 Compact Database– used for client computers to retrieve and save data from a shared location. 14. SQL Server 2008 Compact Edition – used for minimum possible memory and can synchronize data with a corporate SQL Server 2008 Database. Supports offline user and minimum dependency on external components. 15. MDI and SDI Forms (specifically IsMDIContainer) 16. GUID – in the case of data warehousing, it is important to define unique keys. 17. Encrypting / Security Data 18. Understanding of Isolated Storage/Proper location to store items 19. LINQ to SQL 20. Multithreaded access 21. ADO.NET Entity Framework model 22. Marshal.ReleaseComObject 23. Common User Interface Layout (ComboBox, ListBox, Listview, MaskedTextBox, TextBox, RichTextBox, SplitContainer, TableLayoutPanel, TabControl) 24. DataSets Class - http://msdn.microsoft.com/en-us/library/system.data.dataset%28VS.71%29.aspx 25. SQL Server 2008 Reporting Services (SSRS) 26. SystemIcons.Shield (Vista UAC) 27. Leverging stored procedures to perform data manipulation for a database schema that can change. 28. DataContext 29. Microsoft Windows Installer Packages, ClickOnce(bootstrapping features), XCopy. 30. Client Application Services – will authenticate users by using the same data source as a ASP.NET web application. 31. SQL Server 2008 Caching 32. StringBuilder 33. Accessibility Guidelines for Windows Applications http://msdn.microsoft.com/en-us/library/ms228004.aspx 34. Logging erros 35. Testing performance related issues. 36. Role Based Security, GenericIdentity and GenericPrincipal 37. System.Net.CookieContainer will store session data for webapps (see isolated storage for winforms) 38. .NET CLR Profiler tool will identify objects that cause performance issues. 39. ADO.NET Synchronization (SyncGroup) 40. Globalization - CultureInfo 41. IDisposable Interface- reports on several questions relating to this. 42. Adding timestamps to determine whether data has changed or not. 43. Converting applications to .NET Framework 3.5 44. MicrosoftReportViewer 45. Composite Controls 46. Windows Vista KNOWN folders. 47. Microsoft Sync Framework 48. TypeConverter -Provides a unified way of converting types of values to other types, as well as for accessing standard values and sub properties. http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.aspx 49. Concurrency control mechanisms The main categories of concurrency control mechanisms are: Optimistic - Delay the checking of whether a transaction meets the isolation rules (e.g., serializability and recoverability) until its end, without blocking any of its (read, write) operations, and then abort a transaction, if the desired rules are violated. Pessimistic - Block operations of a transaction, if they may cause violation of the rules. Semi-optimistic - Block operations in some situations, and do not block in other situations, while delaying rules checking to transaction's end, as done with optimistic. 50. AutoResetEvent 51. Microsoft Messaging Queue (MSMQ) 4.0 52. Bulk imports 53. KeyDown event of controls 54. WPF UI components 55. UI process layer 56. GAC (installing, removing and queuing) 57. Use a local database cache to reduce the network bandwidth used by applications. 58. Sound can easily be annoying and distracting to users, so use it judiciously. Always give users the option to turn sound off. Because a user might have sound off, never convey important information through sound alone.

    Read the article

  • How to Deploy a Directory or WAR in TOMCAT6 using ANT?

    - by Hitesh
    I want to deploy directory which is extraction of .war file using ANT in Tomcat6. I have build.xml like <property name="WAR_PATH" value="E:/18-06-2013/TEST"/> <property name="mgr.context.path" value="/FOUR"/> <property name="url" value="http://localhost:8080/manager"/> <property name="username" value="tomcat"/> <property name="password" value="password"/> <target name="deploy" description="Install web application" > <deploy url="${url}" username="${username}" password="${password}" path="${mgr.context.path}" war="file:${WAR_PATH}"/ But when i run the ANT(build.xml) script i get error something like java.io.IOException: too many bytes written at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2632) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65> Same script work properly when i try to deploy .war file But ANT(build.xml) script not work properly in case directory. I have also try to deploy directory using HTTP command it work properly.

    Read the article

  • Deploy a jar in Jetty

    - by Dimitri
    Hi guys, I was wondering if is it possible to deploy a jar file in Jetty? If not, are there applications servers who can do so? I am beginner. I am asking this question because all the docs that i have found, it seems that we can only deploy war archive in application servers. Is that true?

    Read the article

  • GF 3.0.1 + Virtual Server: www.myhost.com:8080/projectname-war => www.myhost.com. How?

    - by Harry Pham
    EDIT I need to change www.myhost.com:8080/myproject-war to www.myhost.com. Here is what I've been trying: I configurate the Virtual Server: server. I have still have default Network Listeners to be http-listener-1 and http-listner-2. I change the Default Web Module to ScholarActive#ScholarActive-war.war (The only option in the drop down list, since I only deploy 1 application). For the docroot, I try this ${com.sun.aas.instanceRoot}/applications/ScholarActive/ScholarActive-war_war or this ${com.sun.aas.instanceRoot}/applications/ScholarActive/ Both does not work. What does docroot need to point to, for this to work? what I try to do is: when I type localhost:8080/ScholarActive-war, then my application load, I want to make so that if I type locahost:8080, it will load the app as well, then what left is changed the port to 80. But no luck. Any Idea?

    Read the article

  • Problem While Deploying Application in GlassFish

    - by Sarang
    I have to deploy an application named "mrs-ws-server.war" in glassfish. I did it using both : 1) Package File to be uploaded to the server 2) Local package File or Directory at the address : http://localhost:42328/common/index.jsf It generates the following error : Exception while loading the app : java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection What should be the solution for the same ?

    Read the article

  • Override the methods of classes from a .war file.

    - by Sweety
    I have a base application war file say homeApp.war. This contains default operations which user can carry out on the web browser. Now I need to extend the operations available on the same application using that .war file. Like I need to add the extra menus, some shortcuts like icon for log out etc. Please let me know how can I use this .war file to extend the operations and also fix the already existing issues on the application. This web application uses java server faces.

    Read the article

  • Beginner servlet question: accessing files in a .war, which path?

    - by Navigateur
    When a third-party library I'm using tries to access a file, I'm getting "Error opening ... file ... (No such file or directory)" even though I KNOW the file is in the WAR. I've tried both packaged (.war) and "exploded" (directory) deployment, and the file is definitely there. I've tried setting full permissions on it too. It's on Unix (Ubuntu). File is war/dict/index.sense and the error is "dict/index.sense (No such file or directory)". It works fine on my Windows computer when running in hosted mode as a GWT app from Eclipse, just not when I transfer it to the Unix machine for deployment. My question is: has anybody experienced this before and/or are there differences in relative path that I should consider i.e. what's the root path for relative file access in a war?

    Read the article

  • debate: Is adding third party libraries to a war a good idea?

    - by Master Chief
    We have a debate going on . a. The "standard" way of assembling a web app. Create a WAR with all our app artifacts and all other components like hibernate and memcached etc are deployed in the tomcat/shared/lib area. b. Create a humongous war with everything included and nothing in tomcat/shared/lib. Pros for a - It keeps things modular and the war is small. Cons for a - dependency on shared/lib has to be managed especially by the deployment process. Pros for b - All dependencies are controlled by the build process removing any room for error. Cons for b - War is really, really big. If you are deploying over a network to a huge farm, then it might have an impact. want to see what thoughts others might have about this.

    Read the article

  • how to obtain the relative path of a resource in a j2ee project

    - by Neeraj
    I have a Dynamic Web Project having a flat file (or say text file). I have created a servlet in which I need to use this file. My code is as following: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // String resource = request.getParameter ("json") ; if ( resource != null && !resource.equals ( "" ) ) { //use getResourceAsStream ( ) to properly get the file. InputStream is = getServletContext ().getResourceAsStream ("rateJSON") ; if ( is != null ) { // the resource exists response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setDateHeader("Expires", 0); response.setHeader("Cache-Control", "no-cache"); StringWriter sw = new StringWriter ( ) ; for ( int c = is.read ( ) ; c != -1; c = is.read ( ) ) { sw.write ( c ) ; } PrintWriter out = response.getWriter(); out.print (sw.toString ()) ; out.flush(); } } } The problem is that the InputStream is has null value. I'm not sure how to get the correct relative path. I'm using JBOSS as the app server. I have added the resource file in the WebContent directory of a Dynamic Web Project. As a different approch, I tried this: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub ServletConfig config = getServletConfig(); String contextName = config.getInitParameter("ApplicationName"); System.out.println("context name"+ contextName); String contextPath = config.getServletContext().getRealPath(contextName); System.out.println("context Path"+contextPath); //contextPath = contextPath.substring(0, contextPath.indexOf(contextName)); contextPath += "\\rateJSON.txt"; System.out.println(contextPath); String resource = request.getParameter ("json") ; System.out.println("Hi there1"+resource); if ( resource != null && !resource.equals ( "" ) ) { System.out.println("Hi there"); //use getResourceAsStream ( ) to properly get the file. //InputStream is = getServletContext ().getResourceAsStream (resource) ; InputStream is = getServletConfig().getServletContext().getResourceAsStream(contextPath); if ( is != null ) { // the resource exists System.out.println("Hi there2"); response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setDateHeader("Expires", 0); response.setHeader("Cache-Control", "no-cache"); StringWriter sw = new StringWriter ( ); for ( int c = is.read ( ) ; c != -1; c = is.read ( ) ) { sw.write ( c ) ; System.out.println(c); } PrintWriter out = response.getWriter(); out.print (sw.toString ()) ; System.out.println(sw.toString()); out.flush(); } } } The value of contextPath is now: C:\JBOSS\jboss-5.0.1.GA\server\default\tmp\4p72206b-uo5r7k-g0vn9pof-1-g0vsh0o9-b7\Nationwide.war\WEB-INF\rateJSON But at this location the rateJSON file is not there? It seems JBOSS is not putting this file in the App.war or doesn't deploy it??? Could someone please help me?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >