0

I am getting errors deploying a .war that works on jboss 4.2.3 on jboss 7.1, it looks like this :

TServerXmlRpc-4.1.0rc2.war

cal.gif
MFDJAds.jsp
MFDJAdsUpload.jsp
MFDJAdsUploaded.jsp
next.gif
prev.gif
ts_picker.js
\META-INF
    jboss-deployment-structure.xml <<<--- I added this for jboss 7.1
    MANIFEST.MF
\WEB-INF
    \classes  <<<--- this contains a hierarchy org/company/class1 etc. of compiled java .class
    web.xml
    jboss-deployment-structure.xml <<<--- I added this for jboss 7.1
    jboss-web.xml
    \lib
        commons-codec-1.3.jar
        commons-fileupload-1.2.2.jar
        commons-httpclient-2.0.2.jar
        commons-io-1.4.jar
        gson-2.2.4.jar
        TServer-4.1.0rc2.jar  <<<---------- this jar contains some "ejb3" that are not found by jboss 7.1

17:54:55,898 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "TServerXmlRpc-4.1.0rc2.war"
17:54:56,152 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for oracledb
17:54:56,176 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.module.service."deployment.TServerXmlRpc-4.1.0rc2.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.TServerXmlRpc-4.1.0rc2.war".main: Failed to load module: deployment.TServerXmlRpc-4.1.0rc2.war:main
    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) [rt.jar:1.7.0_261]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622) [rt.jar:1.7.0_261]
    at java.lang.Thread.run(Thread.java:748) [rt.jar:1.7.0_261]
Caused by: org.jboss.modules.ModuleNotFoundException: Module TServer-4.1.0rc2.jar:main is not found in local module loader @766c3bde (roots: /opt/wildfly/modules)
    at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)
    at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:271)
    at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:218)
    at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)
    at org.jboss.modules.ModuleLoader.preloadExportedModule(ModuleLoader.java:229)
    at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:242)
    at org.jboss.as.server.moduleservice.ServiceModuleLoader.preloadModule(ServiceModuleLoader.java:160) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.modules.Module.addPaths(Module.java:851)
    at org.jboss.modules.Module.link(Module.java:1208)
    at org.jboss.modules.Module.relinkIfNecessary(Module.java:1237)
    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:204)
    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 5 more

17:54:56,384 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "TServerXmlRpc-4.1.0rc2.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.module.service.\"deployment.TServerXmlRpc-4.1.0rc2.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.TServerXmlRpc-4.1.0rc2.war\".main: Failed to load module: deployment.TServerXmlRpc-4.1.0rc2.war:main"}}

I need to somehow specify the class path to include the jar in here ? /WEB-INF/lib/TServer-4.1.0rc2.jar

I also put the jar here as a "module" : /opt/jboss6/modules/it/company/tserver/main

<?xml version='1.0' encoding='US-ASCII'?>

<module xmlns="urn:jboss:module:1.1" name="it.onetech.tserver">

    <resources>
        <resource-root path="TServer-4.1.0rc2.jar"/>
    </resources>

    <dependencies>
    </dependencies>

</module>

and it deploys successfully as a .jar unto itself by putting it in /opt/jboss6/standalone/deployments

that TServer-4.1.0rc2.jar contains some "remote" "ejb" \org\company\tserver\local\xyz.class (which are needed by java code in the .war) like this :

import javax.naming.InitialContext;
import javax.naming.NamingException;

public class PolicyManagerFactory {
    
    private static TLogger logger = LogManager.getLogger(PolicyManagerFactory.class);
    
    public static PolicyManager getPolicyManager() {
        String policyManagerBeanName = Directory.getPolicyManager();        
        try {
            javax.naming.Context ctx = InitialContextFactory.create();          
            return (PolicyManager) ctx.lookup(policyManagerBeanName + "/remote");
        } catch (NamingException ne) {
            logger.error("Can't lookup " + policyManagerBeanName, ne);
        }
        return null; 
    }

}

update : after more experimentation it seems to me you can put a jar, with all dependent jars in /WEB-INF/lib/ of the war (simply) without "modules" needed, in case useful for beginners

user3181125
  • 77
  • 1
  • 8
  • Hard to know, but perhaps: https://stackoverflow.com/questions/39688092/unable-to-access-an-ejb-deployed-in-jboss-as-7 – K.Nicholas Mar 30 '21 at 16:49
  • hm, ok, I am aware you'd need to use the new jboss 7.1 /opt/jboss6/bin/client/jboss-client.jar that they changed something in remote jndi (is that correct ?), however I am not at that runtime stage yet that it's not deploying hmm – user3181125 Mar 30 '21 at 16:54
  • Just quick off the hand search on your behalf. I've gotten to local EJBs from a jar that's part of a war with no trouble and don't remember doing anything fancy. – K.Nicholas Mar 30 '21 at 17:26
  • hmm you need not put the jar as dependency in the meta-inf\manifest.mf file, or add it as dependency in jboss-deployment-structure.xml, it searches all jars in \web-inf\lib I'd think ? where do you have the .jar in the .war kindly ? – user3181125 Mar 30 '21 at 18:15
  • I found these examples on the red hat website : jboss-eap-7.1.0-quickstarts.zip so I try to find a known-good working .war example hopefully – user3181125 Mar 30 '21 at 19:07
  • Shouldn't be a problem. Modules for shared stuff so it's really a design choice more than a requirement. Like a database driver is a shared resource because multiple applications use it and it comes from a 3rd party. EJBs could be a shared resource but if you're just trying to upgrade an app I don't see the need. I'd leave that alone for now until you get something working and then see what makes sense to put into modules later. – K.Nicholas Mar 30 '21 at 20:36
  • jboss-eap-7.1.0-quickstarts.zip seems enforced to compile for java 1.8, but my jboss runs only with java 1.7 (there's a bug I had to replace a file), is there any way to make maven ignore the java version enforced in the (downloaded I'm not sure from which jboss repo) poms ? – user3181125 Mar 30 '21 at 23:26
  • I managed to compile for java 1.7 (why does the community AS jboss 7.1 not the red hat "EAP" but the free one not work with java >= 1.8 ?) by doing this : https://stackoverflow.com/questions/28509928/java-version-automatically-change-to-java-1-5-after-maven-update/28510029 modify for example the "greet" war example and add this to the pom.xml : 1.7 ${java.version} ${java.version} – user3181125 Apr 01 '21 at 04:24

0 Answers0