java - How to load dynamically a class with class.forName in JBOSS 7 -


i'm migrating web application jboss 7 , have problems class.forname method.

i have 2 jars, each 1 in 1 different module:

  • campuscomponentsjava-1.4.4.jar
  • campusgateway-2.5.3-snapshot.jar

the code campuscomponentsjava loads dynamically class campusgateway-2.5.3-snapshot.jar in following way:

class.forname("edu.uoc.campusgateway.osid.authentication.authenticationmanager") 

i have created 2 modules in modules folder:

 <?xml version="1.0" encoding="utf-8"?>  <module xmlns="urn:jboss:module:1.1" name="edu.uoc.oki2">       <resources>      <resource-root path="campusgateway-2.5.3-snapshot.jar" />     <resource-root path="campuslauncherjava-1.1.3-snapshot-filter.jar"/>     <resource-root path="okibusjava-1.2.2-config-uoc.jar"/>     <resource-root path="okibusxmlschemas-1.1.1-snapshot.jar"/>     <resource-root path="okiosid-2.0.jar"/>     <resource-root path="javautils-1.1.2-snapshot.jar"/>     <resource-root path="libtecsidel.jar"/>      </resources>      <dependencies>      </dependencies>    </module> 

and

 <?xml version="1.0" encoding="utf-8"?>   <module xmlns="urn:jboss:module:1.1" name="edu.uoc.okicomps">     <resources>      <resource-root path="campuscomponentsjava-1.4.4.jar"/>     <resource-root path="campuscomponentsjava-1.4.4-config-uoc.jar"/>      </resources>      <dependencies>        <module name="edu.uoc.oki2" export="true"/>     </dependencies>  </module> 

i later 1 tag express idea module edu.uoc.okicomps depends on module edu.uoc.oki2 since 1 jar of edu.uoc.okicomps module wants load dynamically class 1 jar of module edu.uoc.oki2:

finally, since webapp needs jars have declared explicitally access both modules of webapp in meta-inf/manifest.xml

 manifest-version: 1.0  class-path:   dependencies: edu.uoc.okicomps,edu.uoc.oki2 

however not working failing exception:

java.lang.noclassdeffounderror: not initialize class edu.uoc.campusgateway.osid.authentication.authenticationmanager 

any apreciated!

thank in advance.

i found problem. problem class.forname, due own nature, executes static code , constructor.

in case, static code tries load through classloader property file included in jar forgot add. fix problem is:

1) add following line module.xml

2) add physically file campuscomponentsjava-1.4.4-config-uoc.jar modules\edu\uoc\oki2\main folder


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -