Multiple library in tomcat both new and old version - java

A developer left from my company and the project he is working on, handover to me.
I download the file commons-fileupload-1.2.2.jar(59Kb) to upload the file. When I want to paste the copy of commons-fileupload-1.2.2.jar(59Kb) in WEB-INF\lib. I have seen that commons-fileupload.jar(21Kb) already exist.But this is old and not fulfill my requirement, because all the classes that have in commons-fileupload-1.2.2.jar(59Kb) not found in commons-fileupload.jar(21Kb).
So, I use commons-fileupload-1.2.2.jar(59Kb) library
50% classes in commons-fileuploadjar(21Kb) also have in commons-fileupload-1.2.2.jar(59Kb) but not all.
Will It create problem in future after deployment or not,because classes duplicate ?

Replace the old jar with new jar and test the file upload functionality before you promote to production. There wont be any problems. If at all there are any then you will catch them during testing anyway. In fact, you doesn't have any other option as old version is not meeting your requirement anyway.

Related

How can I remove old Files in .camel Subfolder?

I use a File-Endpoint to read files. After Camel reads the file it moves the file to the subfolder .camel. So thats OK, and thats what I want. But after some months there are thousends of files.
It is possible to remove automaticly files older than x weeks? Without external tools? Is there an option for the File-endpoint? I don't find anything.
Thanks a lot
No there is no such support or tool. Usually you move files to some backup folder, and then you have some other system that takes care of house keeping those files.
It's not suitable to let Camel monitor for files older than X and delete them, even though you can build a route doing that.
Often your sys admins have their own way of managing their infrastructure.

Need Jar Files for Appengine Samples

I need to run code samples that are on this page:
https://cloud.google.com/appengine/docs/java/datastore/queries
I've been able to locate jars for all but the following:
com.google.appengine.api.datastore.Query.Filter;
com.google.appengine.api.datastore.Query.CompositeFilter;
com.google.appengine.api.datastore.Query.CompositeFilterOperator;
Can anyone point me to where they are located?
I'm also a bit concerned that because I'm getting jar files individually
that I might run into some compatibility issues. Is there one
location that has jars for all the samples on the page I mentioned above?
Thx,
Steve
You need to download the GAE SDK and include it on you project. All those classes are included in there.
GAE is a pretty complex PAAS product. You'll need to setup the whole platform in order to use it, you cant just use some bits of it on its own.

Tomcat cache downloaded files

I use a library that downloads xml files from internet and use it. Sometimes these files are unavailable and to avoid it I would like to cache downloaded files. Is there a possibility to tell Tomcat to cache downloaded xml files and not download these again?
And how should Tomcat even know about the library you're using and this special behaviour you want? Tomcat does not 'download files'. Its your application that is doing it.
Shouldn't you do this yourself when using the library (unless the library already provides this)? I.e. when you get the xml files store them in a folder, and next time you need them you first check the local folder if they exist and if not (or if they're too old) try to get them online, and save them (or overwrite them) with the new files you get.
Your question doesn't make sense. Tomcat is the source. Caching there doesn't accomplish your objective in the slightest. Fortunately the Internet is already full of caches, as is your browser, so your question is already answered by the existing state of things.

How to copy java GAE local_db.bin from one computer to the other?

I am developing a web application with a friend. He started the project and he has the correct local datastore for testing. I need to copy this datastore to my local application, but don't know how. I already tried to copy his local_db.bin and datastore-indexes-auto.xml to my appengine-generated folder, but it didn't work.
Is there a way to accomplish that?
The problem you describe usually happens when the new version of the app is not compatible with the local_db.bin file, or when you upgrade to the new App Engine SDK.
The best solution is to use Mercurial or Git, and include local_db.bin file in the repository. Then you can check in all changes, and it will keep local_db.bin in sync with code changes. Also make sure that all members of the team use the same SDK.

How to avoid no main class and no class def found error using DropBox and Eclipse for Java

I use Eclipse to write Java code and use DropBox to sync my code with others' across our multiple computers. Most of the time, everything works as expected: if anyone makes a change on either end, the change is saved and when the other person refreshes the Eclipse workspace, the changes come through and can be viewed and run successfully.
Sometimes, one of several errors arises. Sometimes Eclipse says it cannot find a main class and sometimes it says it could not find the class itself. Sometimes it will not report an error but for some reason will not actually update the .class file and therefore run an old version even though the compiler displays the new source code and that saves. I've then noticed that if I manually copy the code into a new .java file elsewhere in the file system and then compile it, it works fine, but for some reason it refuses to regenerate the .class file and I have to delete it manually and replace it with the one generated in the other project--then it works. But for solving the other problems everything needs to be manually copied, deleted, and re-pasted....
[The actual errors include NoClassDefFoundError, UnsupportedClassVersionError, and some other error related to not having a main class.]
I realize that the description here is somewhat vague, but unfortunately I'm not entirely sure what's going on. I hope I'm just missing some basic fact that would help solve all these problems.
Thanks!
I'm sure you will see issues using Dropbox for sharing your source.
Eclipse does not know what Dropbox is doing whilst it's uploading and downloading updates and their activities will certainly not be synchronised. At arbitrary points in time when Eclipse tries to do builds etc. it will find unexpected activity going on, maybe even partially downloaded source files which might explain the specific errors you are seeing.
You're trying to do something more complex than sharing photos or documents. The advice I would give is to use a source control system like git or subversion for source code sharing and control. You can then make use of plugins for Eclipse that are designed to integrate these systems in an easy to use way. There's a learning curve there, but the skills will serve you well.
You can use online versions of these solutions like github and unfuddle if you want to consume sharing, backup and version control of source as a service like you do with Dropbox. They're free, too.
Subversion, Git and all version control software solve all of these problems for you.
Dropbox is not really an adapted system for sharing code. What you should do is set up a SVN, and commit only the source files. This way, you won't have these kind of errors.
Dropbox does have versioning (you can restore old versions of a file), and doesn't seem to be a horrible solution for the problem. I keep my Eclipse repository on Dropbox so it is available on any computer; but since I only use it myself, I haven't encountered your problems.
There is one case I can absolutely see you running into problems--it's if your class files are stored in the dropbox as well. This would just screw everything up. Make sure you specify a location on your local hard-drive for all build artifacts (classes, jars, ...) and that the only thing on your dropbox is the .java sources.
In fact, I suggest you don't keep your eclipse project in your dropbox, just create your eclipse project and point it to the java files in your dropbox.
If this doesn't work for you, go with what other people here said and set up a SVN repository somewhere, it's easier than you would think.
Oh, another possible problem--dates! You may want to make sure the date on your java files isn't jumping forwards and backwards (as might happen if one of your developers were in another time zone). In this case, Eclipse may prefer not to re-compile your file.
Also, instead of the copy/etc procedure you are currently going through, try forcing a project clean.
Response to request for more info:
When you start Eclipse, select/create a workspace that is NOT on your dropbox. The best place is probably off your home directory. If you have already specified a default workspace, there should be a switch workspace item in the file menu.
Create your project. select "Create project from existing source" and specify the source files in your dropbox. I think you want "create separate folders for source and class files" to keep your class files out of your dropbox. If you see anything saying "Copy files into your workspace, say "no".
This should give you a valid, working project. I hope you don't see those problems any more.
One more thing may help--and this may work on your existing project--without the above procedure...
Whenever you refresh your files (f5) to load in changes from the dropbox, select the Project/clean menu and select the project. This should delete all the class files and rebuild them.
If your classfiles are shared on the dropbox, this could still have strange consequences on other people with eclipse open, so I really do suggest rebuilding your workspace as I said above.
How to avoid no main class
Provide one. That issue has nothing to do with DropBox

Categories

Resources