-
1. Re: How to load different version of my jar in jboss as7
jaikiran Dec 13, 2011 4:51 AM (in response to abiya)abiya wrote:
Hi,
My struts version is 1.0 and I have problem with the XML parser which is bundled as part of jdk1.6
My config inputstream is not null but still I get the following exception while deployment,
What inputstream? How do you get it? What does the code look like?
abiya wrote:
I would want my war to refer the xerces.jar(2.2.0) and xalan.jar.
Place them in the .war/WEB-INF/lib folders of your deployed application and they will be picked up.
-
2. Re: How to load different version of my jar in jboss as7
sfcoy Dec 27, 2011 3:12 AM (in response to abiya)It's failing trying to read the /WEB-INF/web.xml file.
1432: input = 1433: getServletContext().getResourceAsStream("/WEB-INF/web.xml"); 1434: digester.parse(input);
After you have ensured that your WAR file is built correctly (/WEB-INF/web.xml in the correct location), you should try a deployment that completely removes those two jar files. In my experience deploying your own XML parser jars into application servers is a recipe for trouble. Historically application servers have always provided XML parsing services (as required by the J2EE/JEE specs). This responsibility was later promoted to the JRE. The original struts distributions were designed to work inside standalone servlet containers so it was necessary to add the XML parser jars. It probably worked in WLS 8 because it uses pretty much the same version of those jars itself.
Also make sure that you don't have a jar called xml-apis.jar in your deployment. That one is the biggest troublemaker of all.
-
3. Re: How to load different version of my jar in jboss as7
abiya Dec 28, 2011 7:58 AM (in response to sfcoy)Thanks Jaikiran and Stephen for helping out.
I removed the old version of xerces and xalan jar and made use of the ones bundled with jboss as7. and am currently stuck with the follwoing error. any input to resolve will be of great help.
18:13:36,299 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/metreoSSO]] (MSC service thread 1-2) StandardWrapper.Throwable: java.lang.IllegalAccessError: tried to access method org.apache.xerces.jaxp.SAXParserImpl.<init>(Lorg/apache/xerces/jaxp/SAXParserFactoryImpl;Ljava/util/Hashtable;Z)V from class org.apache.xerces.jaxp.SAXParserFactoryImpl
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:76) [xerces.jar:]
at __redirected.__SAXParserFactory.newSAXParser(__SAXParserFactory.java:122) [jboss-modules.jar:1.0.2.GA]
at org.apache.struts.digester.Digester.getParser(Digester.java:278) [struts.jar:]
at org.apache.struts.digester.Digester.parse(Digester.java:755) [struts.jar:]
at com.metreo.sso.web.action.MActionServlet.loadConfigs(MActionServlet.java:313) [metreo_sso_web.jar:]
at com.metreo.sso.web.action.MActionServlet.initMapping(MActionServlet.java:243) [metreo_sso_web.jar:]
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:466) [struts.jar:]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_24]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_24]
at java.lang.Thread.run(Unknown Source) [:1.6.0_24]Thanks,
Abiya
-
4. Re: How to load different version of my jar in jboss as7
sfcoy Dec 28, 2011 7:46 PM (in response to abiya)Is there an xml-apis.jar as well?
Have you removed it?
I know that JBoss 7 works with struts 1.2 because I've done it. The struts 1.0 code in this area is not that much different.
-
5. Re: How to load different version of my jar in jboss as7
abiya Dec 29, 2011 2:57 AM (in response to sfcoy)xml-apis.jar is not present.
Do we need to exclude any specific jar from jboss as7 modules?
Thanks,
Abiya
-
6. Re: How to load different version of my jar in jboss as7
sfcoy Dec 29, 2011 3:03 AM (in response to abiya)Are you deploying as a WAR or as an EAR?
If it's an EAR, please list the jars in the EAR file.
Also, please list the jars in your WAR file's WEB-INF/lib directory.
-
7. Re: How to load different version of my jar in jboss as7
abiya Dec 29, 2011 4:58 AM (in response to sfcoy)I am trying to deploy an ear. And my WAR's do not have any jars under lib directory. Below is the jar list from EAR/lib folder.
bsf.jar
bsh-2.0b1.jar
junit.jar
com.ibm.logging.jar
jai_core.jar
jai_codec.jar
re.jar
digester.jar
bsf.jar
wddx.jar
jdom.jar
log4j.jar
quartz.jar
jspsmart.jar
commons-net.jar
commons-logging.jar
castor.jar
commons-dbcp-1.1.jar
commons-pool-1.1.jar
commons-collections.jar
commons-beanutils.jar
commons-digester.jar
poi-2.5.1-final-20040804.jar
commons-cli.jar
commons-fileupload.jar
commons-httpclient-2.0.jar
commons-lang.jar
commons-services.jar
commons-validator.jar
dw.jar
dw_resources.jar
ezlicgen20.jar
ezlicrun20.jar
ftp.jar
jakarta-oro-2.0.6.jar
jcalendar.jar
jhall.jar
jhotdraw.jar
js.jar
jspsmart.jar
optional.jar
patch.jar
soap.jar
jep-2.3.0.jar
jaxme2.jar
jaxmeapi.jar
jaxmejs.jar
jaxmexs.jar
struts.jar
xalan-2.7.1.jbossorg-1.jar
serializer-2.7.1.jbossorg-1.jar
xercesImpl-2.9.1-jbossas-1.jar
weblogic.jar
wli_adk.jar
wli_logtoolkit.jarPlease let me know if I need to remove any of these.
Thanks,
Abiya
-
8. Re: How to load different version of my jar in jboss as7
sfcoy Dec 29, 2011 5:11 AM (in response to abiya)Well, you certainly have a lot of junk in there.
You can almost certainly get rid of:
soap.jar xalan-2.7.1.jbossorg-1.jar serializer-2.7.1.jbossorg-1.jar xercesImpl-2.9.1-jbossas-1.jar weblogic.jar
Also, I think optional.jar is a part of an old ant distribution which you probably don't need either.
-
9. Re: How to load different version of my jar in jboss as7
abiya Dec 29, 2011 5:34 AM (in response to sfcoy)Its a old product which currently runs in weblogic 8 and was trying to move it to jboss 7.
xalan-2.7.1.jbossorg-1.jar ,serializer-2.7.1.jbossorg-1.jar,xercesImpl-2.9.1-jbossas-1.jar are jars which I took from jboss as 7 module.
Removed all 5 jars.... and the issue still persists...
If I remove the xerces and xalan jar from ear/lib folder, then its back to the initial error,
15:58:09,779 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/metreoSSO]] (MSC service thread 1-1) ssoAction: null: java.lang.IllegalArgumentException: InputStream cannot be null
at javax.xml.parsers.SAXParser.parse(Unknown Source) [:1.6.0_24]
at org.apache.struts.digester.Digester.parse(Digester.java:755) [struts.jar:]
at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1434) [struts.jar:]
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:474) [struts.jar:]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_24]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_24]
at java.lang.Thread.run(Unknown Source) [:1.6.0_24]My jboss-deployment-structure.xml has the follwoing,
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclusions>
</exclusions>
<dependencies>
<module name="com.oracle.ojdbc" />
<module name="org.apache.xerces" />
<module name="org.apache.xalan" />
</dependencies>
</deployment>
<sub-deployment name="metreo_sso.war"/>
<sub-deployment name="metreo_ps.war"/>
</jboss-deployment-structure>
-
10. Re: How to load different version of my jar in jboss as7
sfcoy Dec 29, 2011 8:55 AM (in response to abiya)I know exactly what is causing that.
Move the struts.jar out of the EAR into each WAR.
It will then be able to "see" the WEB-INF/web.xml file in it's WAR file and be able to parse it. Classes from jars residing in the EAR cannot see classes (and other resources) that are inside encompassing WAR files.
I would also be tempted to remove the jboss-deployment-structure.xml file as well. You don't normally need that.
-
11. Re: How to load different version of my jar in jboss as7
abiya Dec 29, 2011 12:08 PM (in response to sfcoy)Tried moving struts jar to WAR and this issue doesnt seem to go off...:(
In fact it seems to read the web.xml and loads the actionmappings in my struts-config also and then later throws this java.lang.IllegalArgumentException: InputStream cannot be null
I have no clue of what to try with...
-
12. Re: How to load different version of my jar in jboss as7
sfcoy Dec 29, 2011 6:13 PM (in response to abiya)One step at a time.
What's the stack trace?
Seems like it will be a similar type of problem. digester.jar and commons-digester.jar look like they would be used for reading more xml files in your app. They probably need to be in one or both WAR files as well. What other config files do you have? You also need to be careful that digester.jar and commons-digester.jar don't have the same classes in them. That could cause all sorts of mysterious problems as well.
In addition, if any of those jar files contain JSP taglibs, then they should also be in the WAR files.
-
13. Re: How to load different version of my jar in jboss as7
abiya Dec 30, 2011 3:17 AM (in response to sfcoy)I have got csutomActionServlet to load multiple struts-config files.And, there I had an issue,
InputStream input = getServletContext().getResourceAsStream("/WEB-INF/struts-config.xml");
Stream was null.
Later when I modified to
Thread.currentThread().getContextClassLoader().getResourceAsStream(struts-config.xml); by adding my struts-config.xml under WEB-INF/classes it got loaded.
The way you pointed out,
1432: input =
1433: getServletContext().getResourceAsStream("/WEB-INF/web.xml");
1434: digester.parse(input);Its failing in the getResourceAsStream again.
May be something very basic is wrong in my packaging?
My ear is packaged as follows,
Ear
- lib
- jars
- META-INF
- jboss-deploymentt-structure.xml
- application.xml
- WAR1
- WEB-INF
- web.xml
-classes
-lib1
- WAR2
- WEB-INF
- web.xml
-classes
-lib1
- EJB jars
Any clue on what am missing?
Thanks,
Abiya
-
14. Re: How to load different version of my jar in jboss as7
sfcoy Dec 30, 2011 6:39 AM (in response to abiya)The code that calls
getServletContext().getResourceAsStream(...)
needs to be deployed in the WEB-INF/lib directory in order to be in the right class loader. If the jar containing that code is in the EAR instead then it won't work.