Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bryancjacobs opened this issue Nov 6, 2018 · 11 comments

Comments

@bryancjacobs
Copy link

bryancjacobs commented Nov 6, 2018

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
Copy link

yaronzo commented Feb 11, 2019

Did you download the lib files from the release page?

@mlimardo
Copy link

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

@isapir
Copy link
Owner

isapir commented Feb 20, 2019

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
Copy link

mlimardo commented Feb 22, 2019 via email

@isapir
Copy link
Owner

isapir commented Feb 22, 2019

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
Copy link

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
Copy link

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

@saulba
Copy link

saulba commented Aug 30, 2020

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
Copy link

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
Copy link

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
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants