I am getting this warning when I start my JBOSS server 7.0.0.. after deploying the my EAR file. I am using Spring 4.1, Hibernate 4
16:44:09,254 WARN [org.jboss.weld.deployer] (MSC service thread 1-1)
JBAS016012: Deployment deployment "ExampleService.ear" contains CDI
annotations but beans.xml was not found.
Kindly let me know how can i resolve this?
If you want Spring manage your beans, as opposed to the JBoss' support for Java EE 6 CDI, you can safely ignore this warning. Spring will happily scan the classpath for javax.inject.* annotations and configure your application accordingly.
The bean archive descriptor beans.xml should be located at META-INF/beans.xml or WEB-INF/beans.xml.more information about CDI
Related
I have a spring web-app which uses camel-servletlistener(2.25.4), camel-urlrewrite(2.25.4) and springframework.web(5.3.15) internally. these dependencies uses javax.servlet internally because of which my web-app is not running in tomcat-10. can i know what should be done so that my web-app supports tomcat-10 too. I have replaced all the javax dependencies to jakarta.
i getting following error.
06-Apr-2022 11:05:56.002 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class [org.springframework.web.context.ContextLoaderListener]
java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
Apache Camel doesn't support Jakarta EE yet thus it cannot work for now on Tomcat 10. There is an ongoing task about that https://issues.apache.org/jira/browse/CAMEL-17136, you can follow it to know when it will be supported.
Your second option is to use Tomcat 9 instead.
I am trying to deploy an ear in jboss EAP 6.3 but I am getting following error:
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jdbc.mn572phOraDataSource (missing) dependents: [service jboss.naming.context.java.module.pharma.pharma.env.jdbc.mn572phOraDataSource]
service jboss.naming.context.java.jdbc.mn572phaOraDataSource (missing) dependents: [service jboss.naming.context.java.module.pharma.pharma.env.jdbc.mn572phaOraDataSource]
15:01:38,171 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss EAP 6.3.0.GA (AS 7.4.0.Final-redhat-19) started (with errors) in 66301ms - Started 462 of 659 services (160 services failed or missing dependencies, 64 services are lazy, passive or on-demand)
My standlone.xml file has this entry:
<datasource jndi-name="java:/module/env/jdbc/mn572phOraDataSource" pool-name="mn572phOraDataSource" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:#test:1521:mndb11g</connection-url>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<security>
<user-name>test</user-name>
<password>test</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="oracle.jdbc.driver.OracleDriver" module="oracle.jdbc.driver.OracleDriver">
<datasource-class>oracle.jdbc.driver.OracleDriver</datasource-class>
</driver>
</drivers>
</datasources>
My jboss-web.xml inside .war file has following entry:
<resource-ref>
<res-ref-name>jdbc/mn572phaOraDataSource</res-ref-name>
<jndi-name>java:/jdbc/mn572phaOraDataSource</jndi-name>
</resource-ref>
Can anyone please explain what the error says and what the problem can be.
In general 'New missing/unsatisfied dependencies:' is about the contents of your ear file in relation to the resources within it and provided on the server. What it is telling you is that there are requests for injection of objects for which you have not supplied either:
the required classes; or
not configured resources in your server.
This could be caused by six things that I can think of.
You have missed a jar from the ear file.
You have classes in an enclosed jar file that do not have access to the jars that contain their dependencies.
You have beans.xml missing from one of the included jar files.
Your classes depend on a module that should be installed in the server but which has not been installed.
You have missed the declaration of the dependency in item 4 from your joss*.xml files
Your application requires a resource (such as a DataSource) and you have not defined one in your server.
The second point is quite complex and deals with the scope of class loaders In Java EE applications. Basically:
classes in war files can access normal jar files in lib.
EJB jars can access jar files in lib.
jar files in lib may have trouble accessing the other two.
Update:
Sorry for the delay in replying but I wanted to check this before I replied as this area is quite complex.
In this case the problem is a mismatch between the name you have provided in in the jboss-web.xml and the name you provided in standalone.xml.
JavaEE6 has several different namespaces for resources.
The default namespace for the jboss-web.xml is the module namespace which works as java:module///XXXXX. In your case your module is your war file (pharma) and unless you actually defined it in an ear file called pharma JBOSS automatically wraps it in an ear file called pharma. So you get java:module/pharma/pharma/XXXXXX.
The default namespace for standalone.xml is java:global so your actual DataSource is probably installed at java:global/module/env/jdbc/mn572phaOraDataSource
I have tried to run up a little webapp app with your provided configuration files in it and to provide a resource for the mapping I added a #Singleton #Startup bean that defined link to Datasource #Resource.
I managed to get something similar to your error messages although not completely
I think that there are 2 problems:
one is that some of your jndi names read mn572phOraDataSource and some read mn572phaOraDataSource your can see this in the error message because the 2 variants are include.
second is that the JNDI name java:/jdbc/mn572phaOraDataSource in jboss-web does not match java:/module/env/jdbc/mn572phOraDataSource in standalone.xml. I got it to work by changing the name in the standalone.xml to java:/jdbc/mn572phaOraDataSource.
I am trying to develop a web application with a java back end but I need to track if the tasks are complete and I am using the ManagedExecutorService for this.
I am trying to use the #Resource annotation to inject a ManagedExecutorService as follows.
#Resource(name = "myExecutionService")
private ManagedExecutorService mExecutionService;
web.xml:
<resource-env-ref>
<resource-env-ref-name>myExecutionService</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.concurrent.ManagedExecutorService</resource-env-ref-type>
</resource-env-ref>
but I keep getting an error saying that I am missing the "Services with missing/unavailable dependencies"
13:52:31,207 INFO [org.jboss.as.server] (management-handler-threads - 158) JBAS015870: Deploy of deployment "tbm-core-1.0.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"tbm-core-1.0.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"tbm-core-1.0.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [TestBedManager] with qualifiers [#Default] at injection point [[field] #Inject private com.shenick.teravm.core.ws.TestBedManagerWebService.testBedManager]"},"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"tbm-core-1.0\".\"tbm-core-1.0\".env.myExecutionServicejboss.naming.context.java.jboss.resources.myExecutionServiceMissing[jboss.naming.context.java.module.\"tbm-core-1.0\".\"tbm-core-1.0\".env.myExecutionServicejboss.naming.context.java.jboss.resources.myExecutionService]"]}
I have figured out the problem and it's because ManagedexecutorService is java 7 only apparently and jboss 7.1.1 will not deploy apps that use threads.
to solve this I will need to upgrade to EAP 6.1 (new name for jboss).
If you want just use the default implementation, use
#Resource(mappedName="java:comp/DefaultManagedExecutorService")
In this case, you don't need to specify it in web.xml.
If you want to use your own implementation, I think you should configure your application server resources first (set it with your implementation).
EDIT:
I found this by chance:
How to Configure Scheduled Tasks in Wildfly. It could help you, I think.
I'm trying to migrate my Java EE application from jboss 5.1 to jboss 7.1 and getting a deployment error.
My EAR has 2 EJB modules and 1 WAR module. both EJB modules gets deployed without any issue. but when i'm trying to deploy with the WAR module it says
Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name "className" Injection of resource fields failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'java:global/ear/ejb/FacadeBean!com.ejb.business.SearchFacade' is defined: not found in JNDI environment
because of copyright issues i'm unable to disclose the full class names. but "classname" is defined as a bean in my spring application context file and it has a dependency injection of SearchFacade which again has some dependencies.
whats confusing is that in the jboss log it shows that SearchFacade is deployed without any issues.
i'm finding so hard to find a solution for this issue. any help will be greatly appreciated.
thanks in advance.
Looks like spring is not able to determine that the EJB component is in that EJB Jar and you need to enforce that the components in that EJB jar are initialized and started before the components in you WAR.
Did you tried to set element into your application*xml and see if that helped?
Something like this in your application.xml
<application-name>EAR</application-name>
<initialize-in-order>true</initialize-in-order>
<module><ejb>EJB.jar</ejb></module>
<module><web><web-uri>WAR.war</web-uri><context-root>....
On JBoss 5.1.0, when I have an EJB3 stateless session bean exposed as a web service using the #WebService annotation in a jar it gets deployed successfully to the following url:
http://localhost:8080/SessionTest/MyBean
However, if I package the ejb jar in an EAR file it get's deployed to the following url:
http://localhost:8080/TestEAR-SessionTest/MyBean
i.e. Ear name - jar name as the context instead of just jar name.
Is there a way to specify the context that should be used (i.e. SessionTest) so that it is consistent regardless of whether it is deployed as a standalone ebj jar or in an EAR?
You can use #WebContext( contextRoot = "/webservices" ) to set the context root to a fixed location.
There are more options, that are described in the FAQ document.