cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connecting to Mega from Java Application Segmentation Error

alaaeid
Super Contributor

Hello, 

 

currently attempting to schedule a job via the windows scheduler. This job will be responsible for fetching objects on an excel sheet and mapping their attributes to the instance in the repository and vice verca.

This is my first attempt at connecting an external application to the system so bear with me.

the implementation is in Java, so far i've done the following:

  • moved the mg_jnib.dll to one of the specified folders, although the paths specified from the docs don't seem to align well with V5CP3. For Example java.ext.dirs does not exist whereas  java.jre.lib.ext does ( i've copied the dll into that path )
  • running the mgwmapp.exe /regserver does not seem to do anything, while true that sometimes the windows front end some times attempts to instantiate.
  • created a java project that is currently running the JRE packaged within the installation path.
  • I've written a simple script (shown below) to test

Running the script almost always results in a segmentation error, whenever the administration.exe is open the execution just hangs until a nullpointerexception is received.

 

I can attach the error logs if they can be of use.

 

public static void main(String [] args) {

		System.out.println("Starting");
	    FileWriter writer = null;
		 try {
			writer = new FileWriter("test.txt");
			 writer.write("test");
			MegaApplication app = new MegaApplication();
			MegaEnvironment env = app.getEnvironments().get("EnvironmentNAme");
			
			env.setCurrentAdministrator("System");
			env.setCurrentPassword("");
			
			MegaTransaction trs = env.transactions().create("Production", env.getCurrentAdministrator());
			MegaRoot root = trs.getOwnedDatabase().open();
			MegaCollection col = root.getSelection("Select [Application]", new Object[0]);
			writer.write(col.size());

			 //Close the file
			 if(writer!=null)
			 {
			 writer.close();
			 }
			 
		} catch (IOException e) {
			e.printStackTrace();
		}
		  
	}

 

6 Replies

The error says the users does not have the right to write in the windows registry.

 

Thus not sure HOPEX is properly defined.

alaaeid
Super Contributor

Apologies, I had thought that i was on CP3. having upgraded the environment from CP2 to CP3 now the segmentation error is no longer occurring.

That being said, i've attempted to run the powershell script found under the environment path, if i were to run it by right-clicking and selecting "run with powershell" the attached error log is generated. Running the Script with powershell as administrator nothing is logged and the "mgwmapp" service is not found on task manager.

I'm surprise because you said you are in V5 CP3 (15.3.0+xxxx) and

 

the screenshot show an error on V5 CP2 HF4 (15.2.4+6158)    C:\ProgramData\MEGA\Hopex Application Server\5050\.shadowFiles\hopex.core\15.2.4+6158\

 

If you really are in V5 CP3 (15.3.0+xxxx) this means the regserver did not work.

 

 

 

alaaeid
Super Contributor

Hello,

 

for both of your questions, I had read through the javadocs related to the MegaApplication class (find attached a screenshot titled "MegaApplicationdocs.png")

Following the execution of the powershell script, the same segmentation error attached persists ( attached as "Java Unhandled Exception Error.png")

I've also attached the dump file if it can provide any insight.

 

 

 

alaaeid
Super Contributor

Hello,

 

for both of your questions, I had read through the javadocs related to the MegaApplication class (find attached a screenshot titled "MegaApplicationdocs.png")

Following the execution of the powershell script, the same segmentation error attached persists ( attached as "Java Unhandled Exception Error.png")

I've also attached the dump file if it can provide any insight.

 

 

 

oguimard
Retired

Hello,

 

>>> moved the mg_jnib.dll to one of the specified folders, although the paths specified from the docs don't seem to align well with V5CP3. For Example java.ext.dirs does not exist whereas  java.jre.lib.ext does ( i've copied the dll into that path )

 

Why do you do that ?

 

>>> running the mgwmapp.exe /regserver does not seem to do anything, while true that sometimes the windows front end some times attempts to instantiate.

 

Where do you do it from ?

 

In V5 there is a powershell to do it 

oguimard_0-1658412892851.png

 

Can you share logs and screenshot of the error ?