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

Read and Write AFP (Not sure if is an issue) #44

Closed
gio05 opened this issue Apr 2, 2020 · 2 comments
Closed

Read and Write AFP (Not sure if is an issue) #44

gio05 opened this issue Apr 2, 2020 · 2 comments

Comments

@gio05
Copy link

gio05 commented Apr 2, 2020

I am trying to separate a AFP into separately files. I read line per line the AFP and directly write this line into a new file but always I am having this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/xmi/impl/EcoreResourceFactoryImpl at org.afplib.afplib.impl.AfplibPackageImpl.loadPackage(AfplibPackageImpl.java:18300) at org.afplib.base.impl.BasePackageImpl.init(BasePackageImpl.java:155) at org.afplib.base.BasePackage.<clinit>(BasePackage.java:57) at org.afplib.afplib.impl.AfplibPackageImpl.init(AfplibPackageImpl.java:3822) at org.afplib.afplib.AfplibPackage.<clinit>(AfplibPackage.java:59) at org.afplib.afplib.impl.BDTImpl.eStaticClass(BDTImpl.java:109) at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:263) at org.afplib.io.StructuredFieldFactory.binary(StructuredFieldFactory.java:22401) at org.afplib.io.AfpOutputStream.writeStructuredField(AfpOutputStream.java:22) at com.organization.test.afpReader.ReadTest.main(ReadTest.java:39) Caused by: java.lang.ClassNotFoundException: org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 10 more
This is my current code:

`AfpInputStream ain = new AfpInputStream(new FileInputStream( fileIn ));
AfpOutputStream aon = new AfpOutputStream( new FileOutputStream( fileOut ) );

		SF sf;
		int i = 0;
		while( (sf = ain.readStructuredField()) != null ){

			System.out.println( sf );

			if( sf instanceof EDTImpl )
			{
				aon.writeStructuredField( sf );
				fileOut = new File("prueba" + ++i + ".out" );
				aon = new AfpOutputStream( new FileOutputStream( fileOut ) );
			}
			else
			{
				aon.writeStructuredField( sf );
			}`
@gio05 gio05 changed the title Read and Write AFP Read and Write AFP (Not sure if is an issue) Apr 2, 2020
@yan74
Copy link
Owner

yan74 commented Apr 3, 2020

Hi @gio05,
the exception means that EMF is missing. The easiest way for you to start is build the HelloWorld project using maven. This makes sure all the dependencies are present. Could you try this?

@gio05
Copy link
Author

gio05 commented Apr 3, 2020

Hi, @yan74. Thanks for your fast answer, you are right I realized I've forgotten the dependency. It is working now. Thanks.

@gio05 gio05 closed this as completed Apr 3, 2020
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

2 participants