1

I need to refactor an existing jar to work under weblogic 11c and 12c. The code requires full details of the java role to LDAP group mapping, as found in an ears META-INF/weblogic-application.xm. I seek a good mechanism to retrieve this information.

Some specifics:

  • The jar is not an EJB jar, and as the interface can't change, and I have no control over how it will be used in applications (it is a adrop-in replacement for an other library).
  • This means I can't inject the EJB context.
  • This also means I have no connection to the JMX mbean tree available (which would need configuration info)
  • I want something that works for multiple applications, all deployed as ears.
  • I want something that survives fastswap and exploded directory layout
  • I want something as future proof as possible
  • It needs to work both when called from WAR files as from EJB jar files
  • It needs to run under WebLogic 11c,12c, and be as future proof as reasonably possible

For now, i use this strategy:

  • Use getClass().getResource(myself) to retrieve an URL to my code
  • Drop the jar: prefix and associated ! markers
  • Scan upwards trough the directory tree, until we find a folder containing META-INF/weblogic-application.xml
  • If found -> read and parse./ Otherwise -> complain and crash

This seems to work, but I hope to discover a less hackish approach, either by accessing the xml file, or by querying the managed server which executes the jar (but without means to configure connection parameters)

hyperman
  • 1,324
  • 1
  • 11
  • 21
  • This question seams to be very similar: [How do I read the manifest file for a webapp running in apache tomcat?](http://stackoverflow.com/questions/615493/how-do-i-read-the-manifest-file-for-a-webapp-running-in-apache-tomcat). It has some interesting answers. – Robert Aug 24 '12 at 12:55
  • @Robert: Thanks. Basically they use getResourceAsStream directly, or ask the web layer to provide the path. Neither works in my situation, unfortunately – hyperman Aug 24 '12 at 13:06
  • What's about putting the functionality into an EJB jar and only delegate to a service aquired via JNDI lookup? – Bernd Ebertz Aug 24 '12 at 14:05
  • @SirRotN I can't change the interface, or declare my jar an EJB jar. – hyperman Aug 24 '12 at 14:17
  • @SirRotn: Sorry, misunderstood you. Interesting idea, but it would mean either deploying an extra local EJB or knowing what remote server contains the EJB. I don't really know what servers or what programs my code will be used in. EVen so, I'll think about this one. maybe it leads to a complete solution – hyperman Aug 24 '12 at 14:43

0 Answers0