isapir / Migrate2Postgres

Easily migrate from other DBMSs to PostgreSQL
GNU General Public License v3.0
52 stars 24 forks source link

Error: Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator #7

Open bryancjacobs opened 5 years ago

bryancjacobs commented 5 years ago

This project doesn't appear to work with postgres 10.

After rewriting the bash script to work on my mac, the generated DDL will not execute.

yaronzo commented 5 years ago

Did you download the lib files from the release page?

mlimardo commented 5 years ago

I am having the same error. and I'm using Postgres 10.6, what release version shound install in order to work?

isapir commented 5 years ago

The project is not dependent on the Postgres version.

The error "Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator" means that the classpath (or -cp) argument is not set properly.

Please post the java command that you are using, and where you execute it (working directory) with respect to the lib directory that ships with the project.

mlimardo commented 5 years ago

Hey there:

Thanks for your response, I was able to bypass that. the error. Now the error i'm receiving is the following: Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:sqlserver:172.16.4.17

My database in on a server.

Thanks for any help on this matter.

On Wed, Feb 20, 2019 at 2:56 PM Igal Sapir notifications@github.com wrote:

The project is not dependent on the Postgres version.

The error "Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator" means that the classpath (or -cp) argument is not set properly.

Please post the java command that you are using, and where you execute it (working directory) with respect to the lib directory that ships with the project.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/isapir/Migrate2Postgres/issues/7#issuecomment-465730604, or mute the thread https://github.com/notifications/unsubscribe-auth/AtnB04ThYhhUrcI1f8LYesqrdLmVQVKpks5vPah2gaJpZM4YRhSv .

-- Merylois Limardo, A.S IT IT Specialist

isapir commented 5 years ago

Now the error i'm receiving is the following: Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:sqlserver:172.16.4.17

That's because it can not find the JAR file with the driver for MSSQL. It should also be on the classpath, and the file that ships with the distribution is mssql-jdbc-6.2.2.jre8.jar so you can use that.

yasinyazici34 commented 5 years ago

The project is not dependent on the Postgres version.

The error "Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator" means that the classpath (or -cp) argument is not set properly.

Please post the java command that you are using, and where you execute it (working directory) with respect to the lib directory that ships with the project.

Hi Isapir

I got same error and my java command is like following. I can not see lib directory that you mentioned. java -Dconnections.mssql.user=readonly -Dconnections.mssql.password=secret -cp "lib/*" net.twentyonesolutions.m2pg.PgMigrator ddl MsSqlAWT2Postgres.conf Error: Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator

sagarkolli commented 4 years ago

Hi isapir, lib directory is missing in the repository. Can you provide the compiled classes

saulba commented 4 years ago

The project is not dependent on the Postgres version.

The error "Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator" means that the classpath (or -cp) argument is not set properly.

Please post the java command that you are using, and where you execute it (working directory) with respect to the lib directory that ships with the project.

How -cp should be setup right? I see in from the root path where migrate.bat is executed there are two folders - 'examples' and 'src' (not lib). So I changed lib to src inside bat. Path to all java files are same, i.e. (from root) src/main/java/net/twentyonesolutions/m2pg yet on executing migrate.bat ddl I am getting Error: Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator Just to simplify things I tryed inside dir with java files simply execute java PgMigrator.java. Yet same error came up. All commands executed are with admin rights and variable path are set to java's lib and bin directories. I quess there is something simple I am missing. Any ideas?

Skandh15 commented 3 years ago

Hey there: Thanks for your response, I was able to bypass that. the error. Now the error i'm receiving is the following: Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:sqlserver:172.16.4.17 My database in on a server. Thanks for any help on this matter. On Wed, Feb 20, 2019 at 2:56 PM Igal Sapir @.***> wrote: The project is not dependent on the Postgres version. The error "Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator" means that the classpath (or -cp) argument is not set properly. Please post the java command that you are using, and where you execute it (working directory) with respect to the lib directory that ships with the project. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#7 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AtnB04ThYhhUrcI1f8LYesqrdLmVQVKpks5vPah2gaJpZM4YRhSv . -- Merylois Limardo, A.S IT IT Specialist

Hi i am facing the same error how to solve this error.

Thanks in advance.

Regards, Skandh

Skandh15 commented 3 years ago

The project is not dependent on the Postgres version.

The error "Could not find or load main class net.twentyonesolutions.m2pg.PgMigrator" means that the classpath (or -cp) argument is not set properly.

Please post the java command that you are using, and where you execute it (working directory) with respect to the lib directory that ships with the project.

Hi,

I am experiencing this issue and i am using the same command as mentioned in batch file

Marius92 commented 1 year ago

I ran the application but apparently when it creates the tables it does not know how to add a foreign key. it's that correct? or the app should know how to handle the foreign keys? Thnak you!