beans.xml

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

beans.xml

Zahid Rahman
Hi,

https://www.youtube.com/watch?v=Lr8pxEACVRI

I was able to run the instructions in the youtube
up to versions
apache-tomee-webprofile-7.1.3 &
apache-tomee-webprofile-7.0.8
*but for both of these I had to add  this line beans.xml*

<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>


*for version apache-tomee-webprofile-7.0.8 it was causing an error *
javax.enterprise.inject.UnsatisfiedResolutionException: Api type


Although I did not come across http://localhost:8080/tomee
Admin console shown in the video.


Zahid

https://www.backbutton.co.uk/ <http://Backbutton.co.uk>
¯\_(ツ)_/¯
♡۶Java♡۶RMI ♡۶
<http://www.backbutton.co.uk>
Reply | Threaded
Open this post in threaded view
|

Re: beans.xml

Zahid Rahman
I have caught up with the confusion of change of packages names from javax
to jakarta and the jakarta.
milestone.


*The only anomaly is the bean tag in beans.xml. *
*I have pasted the not so intuitive  error message.*

<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>

import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.ejb.EJB;
import jakarta.inject.Inject;

@jakarta.servlet.annotation.WebServlet("/HelloServlet")
public class HelloServlet extends jakarta.servlet.http.HttpServlet {
private static final long serialVersionUID = 1L;

@EJB
private HelloBean bean;

@Inject
private HelloPojo pojo;

protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {

  final java.io.Writer writer = response.getWriter();

  writer.append("<html>");
  writer.append("<body>");
  writer.append("<h1>Hello Servlet!!!</h1>");
  writer.append("<h1>Hello "+ bean.from()+"!!!</h1>");
  writer.append("<h1>Hello "+ pojo.from()+"!!!</h1>");
  writer.append("</body>");
  writer.append("</html>");
}
}


WARNING: The XML schema [javaee_8.xsd] could not be found. This is very
likely to break XML validation if XML validation is enabled.
jakarta.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39; Premature
end of file.]
at
jakarta.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:310)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:548)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:234)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:206)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:258)
at org.apache.openejb.jee.JaxbJavaee.unmarshalJavaee(JaxbJavaee.java:127)
at org.apache.openejb.jee.JaxbJavaee.unmarshalJavaee(JaxbJavaee.java:162)
at
org.apache.openejb.config.ReadDescriptors.readBeans(ReadDescriptors.java:689)
at
org.apache.openejb.config.DeploymentLoader.mergeBeansXml(DeploymentLoader.java:1190)
at
org.apache.openejb.config.DeploymentLoader.addBeansXmls(DeploymentLoader.java:1178)
at
org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:1094)
at
org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:818)
at
org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:230)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5044)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at
java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at
java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:738)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39;
Premature end of file.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1473)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:228)
... 44 more
Aug 23, 2020 6:59:25 PM org.apache.openejb.config.DeploymentLoader
mergeBeansXml
SEVERE: Unable to read beans.xml from:
file:/home/zahid/openejb/tomee-webprofile9/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/superbiz/WEB-INF/beans.xml
org.apache.openejb.OpenEJBException: Cannot unmarshall the beans.xml: null
at
org.apache.openejb.config.ReadDescriptors.readBeans(ReadDescriptors.java:694)
at
org.apache.openejb.config.DeploymentLoader.mergeBeansXml(DeploymentLoader.java:1190)
at
org.apache.openejb.config.DeploymentLoader.addBeansXmls(DeploymentLoader.java:1178)
at
org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:1094)
at
org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:818)
at
org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:230)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2361)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1198)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1131)
at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:134)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5044)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at
java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at
java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:738)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
Caused by: jakarta.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39; Premature
end of file.]
at
jakarta.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:310)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:548)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:234)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:206)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:258)
at org.apache.openejb.jee.JaxbJavaee.unmarshalJavaee(JaxbJavaee.java:127)
at org.apache.openejb.jee.JaxbJavaee.unmarshalJavaee(JaxbJavaee.java:162)
at
org.apache.openejb.config.ReadDescriptors.readBeans(ReadDescriptors.java:689)
... 39 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39;
Premature end of file.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1473)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:228)
... 44 more

Aug 23, 2020 6:59:25 PM org.apache.openejb.config.ReportValidationResults
logResults
WARNING: WARN ... HelloBean: @Local on a bean which doesnt implement an
interface. Use @LocalBean instead.
Aug 23, 2020 6:59:25 PM org.apache.openejb.config.ReportValidationResults
logResults
WARNING: 1 warning for EjbModule(path=superbiz)

https://www.backbutton.co.uk/ <http://Backbutton.co.uk>
¯\_(ツ)_/¯
♡۶Java♡۶RMI ♡۶
<http://www.backbutton.co.uk>


On Sun, 23 Aug 2020 at 10:46, Zahid Rahman <[hidden email]> wrote:

> Hi,
>
> https://www.youtube.com/watch?v=Lr8pxEACVRI
>
> I was able to run the instructions in the youtube
> up to versions
> apache-tomee-webprofile-7.1.3 &
> apache-tomee-webprofile-7.0.8
> *but for both of these I had to add  this line beans.xml*
>
> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
> </beans>
>
>
> *for version apache-tomee-webprofile-7.0.8 it was causing an error *
> javax.enterprise.inject.UnsatisfiedResolutionException: Api type
>
>
> Although I did not come across http://localhost:8080/tomee
> Admin console shown in the video.
>
>
> Zahid
>
> https://www.backbutton.co.uk/ <http://Backbutton.co.uk>
> ¯\_(ツ)_/¯
> ♡۶Java♡۶RMI ♡۶
> <http://www.backbutton.co.uk>
>