My project is a Web project built using three technologies :
Icefaces for presentation layer.
Spring for business layer.
Hibernate for data access layer.
My Project deployed on WebSphere 6.1 and the user can upload files, I use ice:inputFile component to handle the upload process...
The first issue is:
When the upload process finished i expect to find the uploaded file under the following path : myWebProjectRoot/upload/"sessionId"/fileName.ext
where the "sessionId" is a folder named with the current session id and the fileName.ex is the file uploaded by the user...
But what i found is : the folder "sessionId" did not created and the file is stored directly on the upload folder..
My Configuration is like the configuration of the component-showcase of icefaces library which i deployed it on my server and it create the sessionId directory successfully....
i don't know what to do.. please help me...
The second Issue is :
When the session expired I expect the sessionId folder will be deleted, i modified the code of component-showcase in the class InputFileSessionCleaner and make it delete the folder and it's children recursevly form bottm to up, but some time i face the current problem :
Some files can not be deleted using my code -may be they are used by another process-, thus the folder will not be deleted because one of its children didn't deleted. so what to do in this case ... ?
There is an idea in my mind, which is:
Is there any way to create a process running at the background in the server-side: this process check the upload directory and if it founds any file created from at least 60 minutes -which is my session time out period specified in web.xml- this process will delete this file....
any one can help me.. every help will be appriciated .....
In answer to your second question:
WebSphere has a facility for creating worker threads and arranging for them to be initiated according to a schedule. This approach is fully supported in WebSphere - you don't violate any Java EE restrictions on thread creation by using it.
Search for Aysynchronous Beans in your WebSphere documentation.
There are a couple of flavours of this capability in WebSphere one of which is a generally standardised form that you may also find in other vendors App Servers. Some description is given here: http://www.ibm.com/developerworks/library/specification/j-commonj-sdowmt/index.html
Related
I've already spent more than 2 days trying to make this work without any result. The server is WebLogic 12c with embedded Coherence server. It is important to mention that I do not run Coherence in standalone mode, instead it starts automatically alongside the application server that has access to Coherence via JNDI context. I am trying to implement POF serialization approach using PortableObject interface to serialize certain objects I save in Coherence. I've also created the corresponding pof-config.xml registering the objects I'm planning to serialize. The only problem is: How do I add the override to the coherence class path?
According to http://docs.oracle.com/cd/E24290_01/coh.371/e22837/gs_config.htm#COHDG5014 I can use the following system property:
java -Dtangosol.pof.config=MyPOF.xml -cp COHERENCE_HOME;COHERENCE_HOME\lib\coherence.jar com.tangosol.net.DefaultCacheServer
The only problem here is that I have no idea which sh/cmd file to edit, since all edits I made to the files in Oracle_Home\coherence\bin\ had no effect.
Also the same article says that there is a way to confirm the pof-config override:
The output for a Coherence node indicates the location and name of the POF configuration deployment descriptors that are loaded at startup. The configuration messages are among the messages that display after the Coherence copyright text is emitted and are associated with the cache service that is configured to use POF. The output is especially helpful when developing and testing Coherence applications and solutions.
Loading POF configuration from resource "file:/D:/coherence/my-pof-config.xml"
But I couldn't find any of the mentioned lines in the logs produced by the server instance.
Any ideas?
Instead of editing files inside of your Oracle_Home, try the following inside of the weblogic admin console:
Login to admin console
Servers link -> Server Name
Click the Server Start tab
Edit the Arguments: text box and add in -Dtangosol.pof.config=MyPOF.xml
You can also change the classpath, Class Path: box, here if you need to
Every time your server starts it should have that property. If you are not using the nodemanager to start your server, you should do the following instead. Keep in mind this will change the properties for every server in your weblogic domain:
Navigate to your <domain home>/bin directory
Edit startWebLogic.sh/cmd
Edit the JAVA_OPTIONS= line and add in -Dtangosol.pof.config=MyPOF.xml
You can also change the classpath CLASSPATH= here if you need to
I am following the http://docs.broadleafcommerce.org/current/Getting-Started.html and all the steps were successfully completed, and i also migrated to MySQL database as well, and configured mysite with jrebel successfully.
Now after i start my site & admin projects, i start playing with the framework by adding few more product under demo site only, and the newly created product is added successfully to my site, but every time i re-start my demo site, the products goes back to the default in the original state, i mean the product which i have added to this table "broadleaf.blc_product" is gone after restart, so how do I keep the changes in database?
I did these changes in my development.properties
blPU.hibernate.hbm2ddl.auto=create-update
blPU.hibernate.hbm2ddl.import_files=/sql/load_admin_security.sql,\
/sql/load_admin_users.sql,\
/sql/load_code_tables.sql,\
/sql/load_table_sequences.sql,\
/sql/load_catalog_data.sql,\
/sql/load_content_structure.sql,\
/sql/load_content_data.sql
blCMSStorage.hibernate.hbm2ddl.auto=create-update
blCMSStorage.hibernate.hbm2ddl.import_files=/sql/import_storage.sql
after this changes my demo site page has stop working.
it is giving me an error when I trying to open my site on web browser:-
HTTP ERROR 404
Problem accessing /. Reason:
Not Found
Can you please let me know where did I had made a mistake.
Thanks in advance
Regards,
Ankit Patni
Take your project environment to tomcat server .. by deploying the .war file of ur demosite in tomcat webapp folder.
once you have delpoyed the full demosite in your tomcat server after starting the tomcat services
make one change in development.properties in below
blPU.hibernate.hbm2ddl.auto=create-drop
to
blPU.hibernate.hbm2ddl.auto=update.
This will work for you..
Go to development-shared properties of demo site
blPU.hibernate.hbm2ddl.auto=update
blCMSStorage.hibernate.hbm2ddl.auto=update
blSecurePU.hibernate.hbm2ddl.auto=update
make the changes as given above and Run As--> Maven install and start the jetty server
hope this works
I am posting my findings and a method to achieve this,
First of all we need to keep in mind three files for this.
a. common-shared.properties
b. development-shared.properties
c. development.properties
Step1: start the app, let the app create the database and load all the data.
Step2: Stop the database server.
Step3: Stop the application server.
Step4: Changes in the properties file mentioned above.
a. set following values.
blPU.hibernate.hbm2ddl.auto=none
blCMSStorage.hibernate.hbm2ddl.auto=none
blSecurePU.hibernate.hbm2ddl.auto=none
and comment out the following line :
blPU.hibernate.hbm2ddl.import_files=/config/bc/sql/load_admin_permissions.sql,\
/config/bc/sql/load_admin_roles.sql,\
/config/bc/sql/load_admin_menu.sql,\
/config/bc/sql/load_menu_admin_security.sql,\
/sql/load_admin_users.sql,\
/sql/load_code_tables.sql,\
/sql/load_i18n_countries.sql,\
/sql/load_table_sequences.sql,\
/sql/load_content_structure.sql,\
/sql/load_catalog_data.sql,\
/sql/load_content_data.sql,\
/sql/load_content_structure_i18n.sql,\
/sql/load_content_data_i18n.sql,\
/sql/load_catalog_i18n_data_FR.sql,\
/sql/load_catalog_i18n_data_ES.sql,\
/sql/load_sitemap_data.sql,\
/sql/load_menu_data.sql
b. Set the following properties to "none"
blPU.hibernate.hbm2ddl.auto=none
blCMSStorage.hibernate.hbm2ddl.auto=none
blSecurePU.hibernate.hbm2ddl.auto=none
c. Set the only property in development.properties to "none"
blPU.hibernate.hbm2ddl.auto=none
Step 5: Restart the DB server.
Step 6: Redeploy the application.
and Boom .... you have done it.. :) :) :) :)
I'm trying to deploy my first servlet to my server. There are, of course, many tutorials online. But most of them are very detailed and complicated, and I only need to deploy a few simply servlets to this server.
I found what I think to be the shortest method of deployment: Deployment on Tomcat Startup. I moved my .WAR file (FirstProject.war) into $CATALINA_BASE/webapps folder, but when trying to access it (ServerIP/FirstProject) I get the "The requested resource is not available." error.
Is there anything I forgot in the process of deployment?
I know that deployOnStartup has to be set to true, but I didn't change anything with the server's hosts, so the current host is localhost. I didn't change its settings, so deployOnStartup should be true (It's said that true is the default).
What am I missing?
You are using easiest way but I don't know what you are missing. Here what I would suggest is run your server and access through localhost:8080 then click manage app then enter username and password then you can deploy your war.
If you have any query post command.
Even i used to face this problem while deploying my first web application on Jboss and Apache ..
Even though your code is working properly with all your servlet mappings and paths using in your content files ...some times they kick back in real time environment ..So we have to know the proper deployment folder structure and accordingly we have to change our paths in the code
what i am concluding is check the below lines of code
Examples, assuming root is http://foo.com/site/
Absolute path, no matter where we are on the site
/foo.html
will refer to http://foo.com/site/foo.html
Relative path, assuming the containing link is located in http://foo.com/site/part1/bar.html
../part2/quux.html
will refer to http://foo.com/site/part2/quux.html
or
part2/blue.html
will refer to http://foo.com/site/part1/part2/blue.html
I am developing a web app using Spring MVC and Hibernate that I hope to package up as a WAR file and distribute for users to deploy where needed.
The application will require the database connection details before deploying, can anyone advise on the best practice of how to do this? currently my database.properties file is packaged as part of the WAR file, is there an easier way than asking the user to manually edit this file inside the WAR file or in the source and then expect them to build the war file themselves?
I would also like an easy way for users to create a single admin user on first deploy easily - is it best to just provide a sql script to create that or is there a way to include the functionality in the web app so on first deploy it creates the user?
Thanks
Since web applications are not focused to "mass production", I can't tell if something like that is possible.
You can make an SQL script containing all your CREATE statements limited by "IF NOT EXISTS" to avoid deleting existing data. Hibernate can execute a sql script at the moment of creating the SessionFactory, if Hibernate finds a file named "import.sql" located in the classpath root, Hibernate will execute it. Also you can always edit the database.properties of an application already deployed without re-packaging the WAR.
Try Liquibase, http://www.liquibase.org/ . It does not allow your users to setup database connection details but it allows you to manage the database schema (create and update the schema) and default data.
I have installed Tomcat 5.0 in order to execute a web application. How can I show my files which are present in Tomcat to the web browser? I tried http://hostname:8080/myfolder/login.html, but I can't see the files.
One more thing I know about JDBC and other database connectivity and I have developed a HTML page. How can I let a button in the page execute the code written in a Servlet and perform validations?
The simplest thing is to add to the root webapp. That is webapps/ROOT. Any file you put in there will be served unless you change the default configuration.
You should read about the details, of course.
I have installed Tomcat 5.0 in order to execute a web application.
First of all, why are you using the ancient (8 year old) Tomcat 5.0? If you can, rather grab the latest one, Tomcat 6.0.
How can I show my files which are present in Tomcat to the web browser? I tried http://hostname:8080/myfolder/login.html, but I can't see the files.
Is myfolder the context name or just a folder in your webcontent? If it's a context name, then you need to ensure that it's properly deployed. You can find details in the server logs in the /logs folder. If it is a folder in your webcontent and the webapplication is thus supposedly to be the "root" application, then you need to ensure that it's deployed as ROOT.
To learn more about using Tomcat, go through the documentation.
One more thing I know about JDBC and other database connectivity and I have developed a HTML page. How can I let a button in the page execute the code written in a Servlet and perform validations?
To the point, just create a class which extends HttpServlet, implement the doPost() method, define the servlet in web.xml and let the action attribute of the HTML <form> element point to an URL which is covered by the url-pattern of the servlet mapping in the web.xml.
As the question is pretty broad, I have the impression that you haven't learned in any way how to work with Tomcat and JSP/Servlets. I would strongly recommend to go through those tutorials to familarize yourself with JSP/Servlet on Tomcat and Eclipse (an IDE) first: Beginning and Intermediate-Level Servlet, JSP, and JDBC Tutorials
Tomcat is not a web server like, say, Apache. It's a servlet container. You can not just move file in a subfolder which seem to be what you did. You need to pack your web application in a .war and deploy it.
The URL should rather be http://host:8080/webapp/subfolder/login.jsp
Without much information it's hard to help. Please edit your question and describe what you've done so far.