2

I am making java web apps with JSP's and Servlets. I am deploying them on Tomcat7 and using MySql server 5.6. I have made a functioning web app and want to deploy it on a Linux server(a raspberry pi) running tomcat 7. Here is my problem:

I'm developing on windows. Using mysql 5.6 server database, mysql-connector-java-5.1.35 database driver and specific databases on the server. How can I deploy all this on my Linux server server? How do I successfully port a database on my server without any problems?

Thank you for your help!

2
  • Are the Java, MySQL, Tomcat versions same in both Linux and Windows? Commented May 26, 2015 at 13:29
  • Have you looked at the hardware resources available? The Pi is a great little computer but does it have enough CPU and RAM to support this project? Use a Pi-2 for sure. Commented May 26, 2015 at 14:03

4 Answers 4

1

This is not a problem, install Tomcat7 and MySQL on the Linux server, create a dump from the Windows MySQL server and import it in the Linux MySQL server. The war file with you application can be deployed on the Linux Tomcat7.

Sign up to request clarification or add additional context in comments.

Comments

1

What is the requirement to load the DB along with the application ? Ideally your DB should be installed/placed/kept isolated from the application.

Still if you still wanna do this thing then you need a build tool to first zip the database along with the my sql connector. Then when you application gets uploaded onto the server you have to unzip the DB files at some location. You have to hardcode the IP/Hostname (connection related parameters) in you EntityManager(DatabaseConnector file).etc.. etc....

Comments

1

First, make sure you have the same java versions and mysql version installed on your raspberry pi. I use oraclejdk instead of openjdk on my pi as I use the same on my windows. Now create a mysql dump on windows and import it on pi. Now just copy the war to the tomcat and you'll be good to go

Comments

0

Java compiled application code and mysql-connector-java are cross platform, so there shouldn't be any difference in the code or distribution of your Java application.

There are Linux distributions for JDK, Tomcat and MySQL 5.6, but the installation process may vary depending on what Linux distribution you are using. So you should refer to installation instructions:

When you have installed JDK, Tomcat and MySQL 5.6, you will want to transfer the database structure and data from your Windows machine to Linux. You can do this using the mysqldump command which is described here: https://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

This command is also available for Windows and Linux distribution of MySQL 5.6. So on Windows, to create the dump, you do:

mysqldump -u USERNAME -pPASSWORD DATABASE_NAME > dump.sql

And then on Linux, to import the dump, you do:

mysql -u USERNAME -pPASSWORD DATABASE_NAME < dump.sql

8 Comments

Thanks! These links will really help out.
The JDBC connector I am using is in the projects build path. Does this mean when exported to .war it is packaged into it? Do I have to worry about putting it on the Linux server?
@nicocannon it depends on the build settings, but typically yes, the .jar libraries are packed into .war file. You can verify this by extracting the .war file (it is a simple .zip archive) and checking the WEB-INF\lib directory for the JDBC connector library. If it is there, you shouldn't worry about Linux deployment.
Thanks so much you have made this much more simpler.
I have ran into a problem whilst trying to install the same version of java on my raspberry pi. My pi is running an Arm version of java 8 update 33. My windows machine(what I am developing on) is running windows java 8 update 40. There is no update 33 for windows and no update 40 for the Arm version. What should I do? Deploying the web apps aren't working! I have a reddit post here: reddit.com/r/javahelp/comments/37fzdr/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.