We have a web application hosted on this webLogic server on a UNIX machine. Its primarily a JSP/Servlet based app. Whenever we do a modification/enhancemment to any one of those JSps or servlets, I precompile them on my local and deploy them on the UNIX system. For example, if there is a file called GetIdServlet.class, we usually rename the existing file to say GetIdServlet.class1 and then put in the new file as GetIdServlet.class. This is just to be able to revert back to the original file in case they are needed. However, I notice very strange behaviour. The application loses some functionality whenever we stop and start the server. The functionality may be back on the next or a few restarts after that. For example, a submit button that is supposed to direct it to the next page just stops working. It may start working after a few restart.
However on my local(Eclipse + webLogic) there is absolutely no issue. Everything works fine. Any ideas on what's going wrong?
You are using Unix Environment and i assume that the local desk setup used is windows OS or MAC. thus, when you copy the class files you are using some tool like WinSCP.
in case so, then please set the copy settings of such tool to use binary method of copying the files.
Example in WinSCP. go to Options->Preferences->Select Transfer in the Side Menu->under the Transfer Mode section, Select Binary option as the Transfer Mode. This will ensure that the binary replica is created on the Unix environment and that no data is lost in the transfer.
Related
How to update an MDB file from other machines remotely over the HTTP?
I have 2 machines that are connected by the internet, on the first, I have an MDB file and on the other, I have a java web application, I want to send an SQL query from the java web application to update the MDB file on the other machine over the HTTP.
I tried to use FTP, but it is transferring the whole file b
A file such as word, or power-point or Access?
Well, a horse is a horse is a horse.
A file is a file is a file.
You don't connect to a word file to update it. You don't connect to a Excel file, or a power-point file. And you don't connect to a Access file. You OPEN a file, and THEN modify it. You can't open nor modify files over FTP, nor can you modify them over HTTP either. And you can't even do that with a plane jane text file. These are files - you have to open them to modify them. Or pull a whole copy to one side. Update that file, and then send it back.
So, you don't want to confuse the concept of a simple file, or file based system like say a text file, excel file, or Access file. These are NOT servers or say a service that you connect to. You never open a MySQL file - you connect to a server + service via tc/ip (a socket conneciton) and then send commands back and forth. You NEVER open or touch that MySQL data file. The server updates that file - not you, and not your code.
So, Access is not a server based, or socket connection based service. It is a file based system - not un-like a text file. You don't connect to a text file, you HAVE to open that file - modify it and then save it. You can't do that over http. In fact you can't even do that with FTP either. You can pull the whole file, modify and then send it back to where you got that file from.
Now, you could however setup + create some web service calls or entry points on the one site. You could send that web site some commands, and then code behind on that web site can open up that text file, word file, or in this case the Access file and make changes . But once again, just like MYSQL or say the web server? You not opening the remote file direct - are you? You are (and can) thus setup some code or web methods (even REST ones) that accept commands, and those (even sql update commands) could then be run by that remote server/service and thus update the file on that target system. In the case of Access data files?
If you look VERY close, even a ODBC connection string ALWAYS ALWAYS resolves to a valid windows path name (and a full legal qualified windows path name at that).
so, while there is a ODBC driver, the software driver still in fact uses a standard windows OS file open command against that plane jane file sitting in the hard disk. So to update that Access file, you need the driver - since it knows how to open that file, and how to update the delicate data file structures inside. So, even via ODBC? Well, it not a socket connection and you not connecting to a server on the other end - but in fact opening a simple windows file. In fact this means that you not only require DIRECT file rights to that access data file - but you actually need the windows file system!
However, sqLite is the SAME thing. There are thus some jdbc drivers. This JDBC concept is VERY similar to ODBC, but is for web based systems. You install a library on one end (where sqlite resides), and then that web service can take your sql commands (updates or query pulls), and thus the web site code now opens that local file, executes sql against it, or does a query pull , and then returns the results of your query - and the web query calls are done via that web service (rest calls) on that server. So, you can in theory shuffle commands between two web servers - and there are some types of "drivers" such as jDBC standards that in theory do wind up giving you a similar experience to ODBC.
We develop an application which uploads some CSV file.
In order to be sure about our code, the upload has been tested with 2 differents framework : ZK (which manages upload itself) and with classic jsp/Spring REST.
On our local server (windows, tomcat 5.5) all is ok.
On client system (Unix Solaris 10, tomcat 5.5) we have a pb : the first time the file is correctly uploaded, the second time if we change something in data (even if we delete the file) we have the same file as first upload....
It seems a cache or something else disturb the upload.
Any idea ?
Thank you.
[Edit] Additional information
For information, we are on Citrix Metaframe Program Neighborhood (a old version -> v9.0).
For those present at the customer (with or without Citrix), CSV file are uploaded correctly each time.
For us, who are outside, that's not working.
File A is uploaded, then we modified it (A') then uploaded again...and the result is : file A is deleted (as expected, by programmation) then a new file appear which is the same as A (not A' as expected).
If we stop Tomcat or even make others http request, the upload works correctly.
We test upload with 2 differents framework : ZK (which manage the upload itself) and Spring MVC (REST). Both are working on our servers with same Tomcat (5.5).
Other thing strange, we have access to an another server (by VPN not Citrix) where we deployed the application on a Tomcat 7 (already installed by the client). All is OK.
Is it possible that is an hardware problem? with a router...
First of all, it is very difficult to understand your question. With what I understood, you are not able to load any file the second time as the details of the first file are still present in memory/variables. Post your code so that it will be easy.
Try these
Start the application, load a file, say A.csv, first time, then stop
the application
Start the application again, and load another file B.csv and see if it is loaded correctly.
If steps 1 and 2 work correctly, you can be sure that no one has hard-coded anything in the code.
Now, go through your code and see if you have any static variables, being set with the contents of the file.
If removing static variables doesn't work, try printing all the variables and narrow down the issue.
Good luck!
I've uploaded my Rails app from a svn repository to my server. In my localhost it works ok, but when I try to access by Chrome I get the following error:
There appears to be a database problem.
Your config/database.yml may not be written correctly. Please check it and fix any errors.
Your database schema may be out of date or nonexistant. Please run rake db:migrate to ensure that the database schema is up-to-date.
The database server may not be running. Please check whether it's running, and start it if it isn't.
I've no idea what to do, because it's the first time I try to upload a rails project and I'm doing the same things I do in localhost in remote server.
By the way, should I run rails s too throught the ssh connection?
Update: first thing to do is get educated on deploying: start here on the Rails site.
So the thing is, on your server you need to have a database set up, like you do on your local machine. Checking out the code from SVN only gets you the application, not the database.
You mention in the title that you have Passenger set up on the server. Passenger is a module of Apache (or Nginx) which replace the rails s command you are using in development. It is in this passenger configuration file that you'll need to set the RailsEnv <something> to determine what and how the app starts and runs.
If the database servers are the same (e.g. MySQL on both platforms) and the environments are the same (e.g. "development"), and if the app/db/database.yml file is checked into source control, then skip ahead.
If your database and environment is different (e.g. SQLLite in development and MySQL in production) then you'll need to add the necessary configuration -- database name, host, port, usename, password for the environment in the database.yml (and specify the proper database gem in your Gemfile, based on the environment). If you are storing passwords, I don't recommend checking in the database.yml file, but that's a separate topic. In the end, you need to have the right database config in database.yml on the server.
Then, you can run bundle exec rake db:setup on the server from your app's root directory. This will initialize the database with the current schema, and run any seeds.rb setup needed. Check with rake -T to see other options you might consider.
Once that's done, subsequent deployments require that you check out your latest code from SVN, and usually restart the app (with Passenger, this is done with the command touch tmp/restart.txt from the app's root directory. If you have made changes to the database structure, before restarting, run bundle exec rake db:migrate
Oh, yeah, in production, if you're using the default environment, you'll also need to run bundle exec rake assets:precompile the first time, and every time afterwards if you have added images, changed javascript/coffeescript or css/sass files.
Having said this, #rwilliams comment about Capistrano is definitely something you'll want to think about. Deploying is tricky as you can see, and as your app gets bigger you'll want it to be simple. Capistrano allows you to set up a script of things that make deployment a command like cap deploy or cap staging deploy:migrations. It's a lot to learn, but worth the effort.
I have never used JNLP, and I have no web/war server already running so I will install it from sratch:
Which to use?
GlassFish
Tomcat
Apache
Jetty
Another?
I wonder if someone already using JNLP could make any recomendation for the server.
I just want a blank page with a button in the middle for starting the application nothing more, nothing less.
If you use only JNLP you don't need Java server. JNLP is client side. Simple http server like Apache HTTP Server should be OK. HTTP server will be better solution than use of web container/Java EE server because JNLP (usually) is a static content. Even lighthttpd should be enough.
As already stated any server capable to serve HTTP will do. If your WebStart application is not signed by itself (i.e. you code-signed the corresponding Jar files) you could probably consider to publish the JNLP plus its resources via HTTPS. This way your clients will know that the software they are going to execute came from its rightful origin. Although unsigned WebStart applications are restricted in their privileges on the client's machine it still is a measure to elicit trust in your clients. On the other hand this requires more configuration effort with regard to the server you chose.
If your application will need some extended privileges on the client's machine such as access to the file system then I would recommend that you do sign your jar files to gain the necessary privileges automatically (don't forget to specify them in a element within your JNLP).
These are the default restrictions for unsigned WebStart apps:
No access to local disk.
All your jars must be downloaded from the same host. Note, however, that you can download extensions and JREs from any host as long as they are signed and trusted.
Network connections are allowed only to host from which your jars were downloaded. ("Phone home restriction.")
No security manager can be installed.
No native libraries (not even in extensions).
Limited access to system properties. (The application has read/write access to all system properties defined in the jnlp file, as well as read-only access to the same set of properties as applets
You dont need a server to run JNLP(Webstart).. This is how webstart works
it simply is an application that can be started over the web, this would be the procedure from the user perspective:
user goes to yourwebsite.com
user see's link: run my awesome app
user clicks link, which downloads .jnlp file
user runs the jnlp file through java web start (part of java SE, user requires java runtime environment JRE to run this)
java web start reads jnlp to get information about the server that holds the corresponding application
jar files get downloaded automatically (the first time) and then the application starts
user gets bored and closes application
the next day, user comes back and clicks your link again
application is already downloaded, so it starts right away
user gets bored again and closes your application
1 day later, you decide to update your application and you deploy the new jar file on your
server, replacing one of the old files
after 2 days user clicks your link again
java web start recognizes that the user has a different version, downloads update automatically and starts the application again
...
..
.
One of my requirements is, on load of page, a file is to be created dynamically and downloaded at a particular location on the client's machine.
In case the file is already present, it has to be over written.
is there any way where we can access the client's system and store the file at the required folder?
I feel one cannot access the client machine when the code is being executed on the server..
Senorio:
1-User click on generate document then it took template stream data ,req. data file and then save two file into client machine.
2-After that template open and it fetch the data file from same directory.
Please help me on this. This is an SOS!!
There are probably other solutions, I use a signed applet for this purpose.
As always, there are a few caveats though:
You can't "force" anything against the will of the user. Applets may be disabled in the client's browser, or they may not even have Java installed. Or the target directory might not be writeable by the user.Your server should handle cases where the client doesn't have the correct version of the file gracefully.
You can't do this from the server side obviously but you also really can't do this from a client script either. Browser security will prevent a page script from modifying contents of the file system.
Your only options will be to run a third-party browser plugin software that has elevated permissions.
Examples of such are
Java Applets
Java WebStart
Microsoft Silverlight
ActiveX
Each one is different and most require some level of user interaction to confirm that they allow plugins to run with elevated security.