Error Deploying War File on jboss 7.1 - jboss

I am trying to deploy a war file on RHEL5 server using jboss 7.1 and it is failing once I put it in the deployment folder, I checked the server.log and found that it is getting this error when trying to deploy:
[org.jboss.modules] (MSC service thread 1-8) Failed to define class
tag.TagBean in Module "deployment.AppWeb.war:main" from Service Module
Loader: java.lang.UnsupportedClassVersionError: tag/TagBean :
Unsupported major.minor version 51.0
Where tag is a namespace in the Web project AppWeb and TagBean is the class name.
One more thing, in the struts file it is added like this:
<package name="tag" namespace="/tag" extends="struts-default">
<action name="default" class="tag.TagBean">
<result>myForm.submitpage.jsp</result>
</action>
</package>

It seems you are trying to run application (at least class tag.TagBean) compiled with Java 7 on older JVM.
Either switch JVM to Java 7 or recompile with Java 6.

Related

War deployment failing on Jboss 7.4

I am migrating from Jboss 6.4 to Jboss 7.4, First I have not made any changes in war file and tried to deploy it on Jboss 7.4, but I was getting below error. This error is coming for all filter and servlet classes which are configured in web.xml file.
Caused by: java.lang.IllegalArgumentException: UT010011: Filter log4jServletFilter of type class org.apache.logging.log4j.web.Log4jServletFilter does not implement javax.servlet.Filter
at io.undertow.servlet.api.FilterInfo.<init>(FilterInfo.java:74)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:801)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:276)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
... 6 more
Then I tried with excluding undertow subsystem in jboss-deployment-structure.xml file as below. This time I was able to deploy war file without error, but application is not accessible with root context or any different way. On jboss admin console War is showing in active state but still accessible.
<exclude-subsystems>
<subsystem name="undertow" />
</exclude-subsystems>
Could anyone advise me to resolve filter or servlet class error?

icefaces project deployment error : org.apache.catalina.LifecycleException: java.lang.NoSuchFieldError: SKIP_ITERATION

I'm trying to make new icefaces project which generated using: ICEfaces 3.3.0 project integration for Eclipse.
I didn't modify anything on the project. but when i try to run on the server, i got an error:
cannot Deploy MyProject
Deployment Error for module: MyProject:
Exception while loading the app : java.lang.Exception:
java.lang.IllegalStateException: ContainerBase.addChild:
start: org.apache.catalina.LifecycleException:
java.lang.NoSuchFieldError: SKIP_ITERATION
before that, I'm using ICEfaces 3.2.0 project integration for Eclipse and no problem.
I'm using Eclipse Indigo, GlassFish server 3, Mojarra 2.1.6
Thanks before
java.lang.NoSuchFieldError: SKIP_ITERATION
As per the javadoc, that field was added in JSF 2.1.
So, this error suggests that your webapp's runtime classpath is polluted with a JSF 2.0 API JAR file. Perhaps in the /WEB-INF/lib? Get rid of it. Glassfish already ships with JSF bundled, you don't necessarily need to supply your own. Or, from the other side on, this can also happen if you deploy to an ancient Glassfish instance which bundles JSF 2.0 and JSF 2.1 was actually bundled in your webapp in an attempt to upgrade it. If so, then you should edited the Glassfish config file sun-web.xml or glassfish-web.xml, depending on GF version. See for detail the answer to this related question: How to update Mojarra version in GlassFish

Unable to call JAX-WS client deployed on JBoss 7.1.1

I have a generated jax-ws web service client that runs fine when I run it as a java standalone project. However if I add it to a web application (war) deployed on JBoss 7.1.1 and call the web service it throws the following exception:
Caused by: java.lang.NoClassDefFoundError: com/ctc/wstx/io/DefaultInputResolver
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:628)
at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:324)
at __redirected.__XMLInputFactory.createXMLStreamReader(__XMLInputFactory.java:139) [jboss-modules.jar:1.1.1.GA]
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1176)
at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:104)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:795)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1493)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1401)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:648)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:461)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:364)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
at $Proxy189.getcodelists(Unknown Source)
Idea what I may be missing?
As the error says, the App server is unable to find the said class file. Is it possible in your standalone app your classpath has the library but JBoss AS 7 is unable to find it.
If you can isolate where this library is, you can either bundle it with your WAR file or create a jboss_module to satisfy the dependency.
Good luck!

How to deploy a library with Java EE 6 / Glassfish 3.x

I have got an EAR with two plain libraries. One of them being scala-library. If I deploy the EAR with Netbeans it works as expected. While this is OK for development the final product should be deployable via the command line. For this I use:
asadmin --user … deploy --upload ./target/…-ear.ear
which fails with:
org.glassfish.api.admin.CommandException: remote failure: Error occurred during deployment: Exception while deploying the app […-ear] : C:\Work\Workspa
ces\…\Glassfish\…\applications\scala-library-2.8.0.jar. Please see server.log for more details.
Befehl deploy fehlgeschlagen.
Searching the net I found out that handling libraries have become more strict with Java EE 6 / Glassfish 3.x and that it is not enough to add them to the lib folder inside the ear any more. Only the author neglected to mention what is needed now.
I found new <module><java> entries for the META-INF\application.xml — but that did not help either:
<module>
<java>scala-library-2.8.0.jar</java>
</module>
So the question: Does anybody know what you have to do to add libraries to an EAR file for Java EE 6 / Glassfish 3.x?
PS: I use Maven to build - if that makes any difference.
Well it seems I found the solution myself (again). After adding a library-directory entry to the end of the META-INF\application.xml the deployment runs thou:
<library-directory>lib</library-directory>
</application>
The strange thing is that lib the default for library-directory. So I guess it must be a bug in Glassfish itself not handling the default correctly. If you use Maven make sure to use bundleDir in your pom.xml so that the libs are place in the right place:
<jarModule>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<bundleDir>lib</bundleDir>
</jarModule>

Can I make a WAR depend on a JNDI entry in JBoss 5.1?

As part of an upgrade from JBoss 4.0.4 to 5.1, I am trying to get a WAR to deploy after an EAR is successfully deployed. JBoss 5.x does not support PrefixDeploymentSorter like 4.x did, which means that I have to use <depends> in the WAR's jboss-web.xml.
It seems I cannot depend on the EAR itself, so I pick the last deployed EJB instead. This EJB provides a JNDI entry that the WAR needs.
Here's the EJB as it deploys when the WAR is absent from the deploy directory:
2010-03-25 10:47:30,348 INFO [org.jboss.ejb3.session.SessionSpecContainer] (main) Starting jboss.j2ee:ear=my-ear.ear,jar=mypackage-ejb.jar,name=MyFacadeBean,service=EJB3
2010-03-25 10:47:30,350 INFO [org.jboss.ejb3.EJBContainer] (main) STARTED EJB: my.package.MyFacadeBean ejbName: MyFacadeBean
2010-03-25 10:47:30,371 INFO [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] (main) Binding the following Entries in Global JNDI:
my/MyFacade/local - EJB3.x Default Local Business Interface
my-ear/MyFacadeBean/local-my.package.MyFacade - EJB3.x Local Business Interface
And here's the depends snippet from jboss-web.xml:
<depends>jboss.j2ee:ear=my-ear.ear,jar=mypackage-ejb.jar,name=MyFacadeBean,service=EJB3</depends>
My problem is: The WAR starts to deploy immediately after "STARTED EJB:", i.e. before MyFacadeBean is bound to JNDI, which causes bean deployments to fail:
2010-03-25 10:47:39,068 ERROR [my.facade.FacadeFactory] (main) MyFacade not bound
2010-03-25 10:47:39,069 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[my.host.no].[/]] (main) StandardWrapper.Throwable
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at my.freemarker.servlet.FreemarkerController.setupPojoServiceFactory(FreemarkerController.java:621)
[...]
Caused by: java.lang.RuntimeException: javax.naming.NameNotFoundException: MyFacade not bound
at my.facade.FacadeFactory.getFacade(FacadeFactory.java:61)
After the WAR has finished its deployment, MyFacade happily (mockingly?) continues its deployment and binds the JNDI entries.
If I hot-deploy the WAR after the EAR has deployed, everything works as intended.
I even thought of depending on a dummy EJB in the EAR, and using <module-order>strict</module-order> in jboss-app.xml to force it to load as the last module. But alas, JBoss 5.x does not support that either. Doh!
Is there a way to depend on the JNDI entry itself? Are there other ways of solving this?
Here's how you can achieve this on JBoss 5.1.x.
First, add a file called aliases.txt into the META-INF directory of your EAR. This file should just contain a single line with an arbitrary name / identifier for your EAR. For example, if you have my-ear.ear, your META-INF/aliases.txt file could contain 'my-ear'. It just needs to be something that won't clash with any other aliases declared by other apps deployed on the same server.
Next, add a jboss-dependency.xml file to the META-INF directory of your WAR, containing the following (subsituting 'my-ear' for the alias you created above):
<dependency xmlns="urn:jboss:dependency:1.0">
<item whenRequired="Real" dependentState="Create">my-ear</item>
</dependency>
This will ensure the EAR is deployed before the WAR.
Also, if you try to deploy the WAR without the EAR being present, JBoss will log a clear deployment error message telling you about the missing dependency.