cancel
Showing results for 
Search instead for 
Did you mean: 

EAR External Jars are not getting added

apu_das2
Active Contributor
0 Kudos

Hi Experts,

Facing a ridiculous issue at the time of Custom Module development and just because of that whole development is getting delayed.

The issue is when I am deploying my EAR file its getting deployed into the server without any issue and without any warning. But I am facing problem at the run time when I am trying to use the module in my CC. This is not able to find external jars. The problem seems to be my ear is not able to take the external jars at the time of deployment.

I cant see any issue in my development. Please help with your inputs.

Thanks,

Apu

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Create a library project using all the JARs and during deployment add that library project as a dependent project to the EAR.

former_member190293
Active Contributor
0 Kudos

Just to be sure: did you add that jars in your project through Build path - Add external jars?

apu_das2
Active Contributor
0 Kudos

Hi Evgeniy,

I am adding sap libraries an User library and external jars like poi, dom4j etc as variable in the EJB Build path which seems to be the right procedure.

Thanks,

Ryan-Crosby
Active Contributor
0 Kudos

Hi Apu,

Here is how I have ensured that an external .jar is deployed as part of the EAR.  I place it in the /lib directory for the EAR project and it gets deployed as expected.

Regards,

Ryan Crosby

apu_das2
Active Contributor
0 Kudos

Hi Ryan,

Can you please tell me how do you manually put the external jars into the /lib directory.

Thanks,

Ryan-Crosby
Active Contributor
0 Kudos

Hi Apu,

You can either navigate to the Java EE Module Dependencies in the project properties or you can right-click the Bundled Libraries folder and click Add/Remove.  Then you simply have to input the information for the .jar file(s) you wish to include and they should be included when you generate your EAR.

Regards,

Ryan Crosby

apu_das2
Active Contributor
0 Kudos

Hi Ryan,

Just one more question after that I will try this.

Should I Add the jars in the lib folder then build project and then export

or

Build project then add jars and then export.

Thanks,

Ryan-Crosby
Active Contributor
0 Kudos

Hi Apu,

You'll want to add the jars to the lib folder and then do the build and export.  Then the .jars you need will be included in the .ear file and you can verify that with some .zip program like WinRAR or any other.

Regards,

Ryan Crosby

apu_das2
Active Contributor
0 Kudos

Hi Ryan,

Dunno whats the issue . I have added as u said . tried only adding extrnal jars and external + user libraries as well .

Build is done but getting error at the time of export.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Apu,

The only libraries you have to put in the /lib folder are the ones that do not exist in your SAP system.  Not sure if that is why you are seeing an export failure but that is some kind of exception directly within the Eclipse framework.  If you cannot get the export to work properly you could take the approach mentioned by Eng Swee to add the .jar files manually into the .ear file using a zip utility.

Regards,

Ryan Crosby

apu_das2
Active Contributor
0 Kudos

So for the approach Eng suggested I need to build , export and manually add the jars in the same level of META-INF of ear and then I need to go to NWDS and simply run or server.

Am I right?

Thanks,

Apu

Ryan-Crosby
Active Contributor
0 Kudos

Correct, after the build and export you have to manually insert the .jar files and then you deploy it to the server so it can be tested.  If everything is setup correctly then the deploy should execute without any issues.

Regards,

Ryan Crosby

engswee
Active Contributor
0 Kudos

If you use the manual approach of adding the JARs into the EAR, you cannot use the Run On Server command. You will need to use the Deployment view/perspective to select and deploy the manually constructed EAR file.

I have provided a screenshot above of how the content of the EAR should look like. Make sure you follow that EXACTLY, otherwise you might still hit issues.

apu_das2
Active Contributor
0 Kudos

Hi Eng,

I was recreating the EJB 3.o project and found below. After deployment its giving me below warning and that seems to be reason its not adding at the time of deployment.

I have maintained below steps-

1. In Window -> Preference

2. Adding in EJB 3.0 session bean under Build path

After build the project (only ejb one) getting below warnings -

Any suggestion.

engswee
Active Contributor
0 Kudos

Hi Apu

Those warning are not an issue as it relates to the EJB project only. It is the EAR project that will bundle everything together. My workspace also have those warnings which causes no issue when I create the EAR file.

Please make sure you are exporting using the SAP EAR File option. If you use just the EAR file, the POI JARs won't be bundled in.

As I mentioned, if it still does not work, do try the approach to manually add the files using 7-Zip or a similar utility. Can you confirm if you tried this manual approach or not?

Regards

Eng Swee

apu_das2
Active Contributor
0 Kudos

Wohhhhhhh. At last this is resolved with the manual approach.

I sincerely want to give a big thanks to Eng to give continuous and prompt reply.

But this should not be the behavior of the system normal approach should include the ext jars in the ear automatically. Is not it Eng?

Thanks,
Apu

engswee
Active Contributor
0 Kudos

Hi Apu

I really don't know why it doesn't work for you and without access to your setup, it is quite difficult to figure out further since we have already tried nearly everything.

I even tried it again with a sample EAR/EJB project and it works perfectly fine when I use the Export SAP EAR File - see below (I just include a few JARs in the EJB project using Classpath variables)

Anyway, glad to know that it works for you at least the manual way, so that you can proceed with the development.

Do take some time to close this thread and also your other open thread below that is related to this.

Closing the thread properly will also benefit others in the future who come across similar issues - read following blog:-

Regards

engswee
Active Contributor
0 Kudos

Can you confirm how you are generating your EAR file? Is it via the Export command? Which option did you choose, EAR file or SAP EAR file?

Or are you generating it directly via the Run As > Server command?

apu_das2
Active Contributor
0 Kudos

Hi Eng,

I am exporting this in my local disk as SAP EAR file and then deploying in PI Java Stack.

Thanks,

Apu

engswee
Active Contributor
0 Kudos

Hi Apu

Since everything else is not working for you for whatever reasons, the simplest workaround is to manually add the JAR files into the SAP EAR file that you have exported out.

Just make sure in your EAR file, all the JAR files as shown below are added into it.

Once the EAR file is complete, then you can deploy it into the server.

Regards

Eng Swee

former_member182412
Active Contributor
0 Kudos

Hi Apu,

Can you delete the EAR project and recreate the EAR project again and see it solve the problem.

Regards,

Praveen.

apu_das2
Active Contributor
0 Kudos

Hi Praveen,

I have recreated numerous time but no luck.

Thanks,

Apu