Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf.xml - jboss

Hi I am getting error when try to run camel project in fuse container
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem:
Failed to import bean definitions from URL location [classpath:quote-endpoints.xml] Offending resource: URL [bundle://251.0:0/META-INF/spring/applicationContext.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem:
Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf.xml]
Offending resource: OSGi resource[classpath:quote-endpoints.xml|bnd.id=251|bnd.sym=null]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from OSGi resource[classpath:META-INF/cxf/cxf.xml|bnd.id=251|bnd.sym=null]; nested exception is java.io.FileNotFoundException: OSGi resource[classpath:META-INF/cxf/cxf.xml|bnd.id=251|bnd.sym=null] cannot be resolved to URL because it does not exist
Any help appreciated
Thanks

Check your xml files and remove those CXF imports. They are no longer required for many years. eg look for anything with META-INF/cxf/cxf.xm and similar and remove those.

Yes - there are two xml files -
applicationContext.xml which imports quote-endpoints.xml
<import resource="classpath:quote-endpoints.xml" />
AND
quote-endpoints.xml impor resource="classpath:META-INF/cxf/cxf.xml" /> please see below
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />

Check the version of cxf in the POM.xml file. Most probably, you may be having unsupported cxf version for the project.

Related

EAR application works on Websphere8.5 but refuses to work on Websphere liberty 16.0.0.4

I get in inheritance EAR application which I need to continue to develop. The problem that I can't cause it work on Websphere Liberty 16.0.0.4 while on Websphere Application Server Full Profile 8.5 it works fine. Unfortunately or (fortunately :) ) my working station is Macbook Pro, and WAS Full Profile can't be installed on OSX (can't find links right now, but have done some search and find enough evidences for it) so I need to use VirtualBox with Linux or try to run this app on Liberty.
The latest solution doesn't work so well for me, I get the following error:
[ERROR ] CWWJP0012E: The persistence unit name is not specified and
a unique persistence unit is not found in the BigEnterpriseAppEAR
application and BigEnterpriseAppEJB.jar module. [ERROR ] CWWJP0029E:
The server cannot find the persistence unit in the
BigEnterpriseAppEJB.jar module and the BigEnterpriseAppEAR
application. [ERROR ] CWNEN0035E: The java:comp/env/BigEnterpriseApp
reference of type javax.persistence.EntityManager for the DataProvider
component in the BigEnterpriseAppEJB.jar module of the
BigEnterpriseAppEAR application cannot be resolved. [ERROR ]
CNTR0020E: EJB threw an unexpected (non-declared) exception during
invocation of method "getDataByOwner" on bean
"BeanId(BigEnterpriseAppEAR#BigEnterpriseAppWEB.war#DataAPI, null)".
Exception data: javax.ejb.EJBTransactionRolledbackException: nested
exception is: javax.ejb.EJBException: The
java:comp/env/BigEnterpriseApp reference of type
javax.persistence.EntityManager for the DataProvider component in the
BigEnterpriseAppEJB.jar module of the BigEnterpriseAppEAR application
cannot be resolved.
The app is pretty simple EAR = JPA + EJB + WAR
I don't know which configuration files would be helpful, so just write in a comments what to post and I will do it.
Thank you in advance.
UPDATE 1:
server.xml file:
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>localConnector-1.0</feature>
<feature>servlet-3.1</feature>
<feature>ejbLite-3.1</feature>
<feature>jndi-1.0</feature>
<feature>jaxrs-1.1</feature>
<feature>ssl-1.0</feature>
<feature>jpa-2.0</feature>
<feature>cdi-1.0</feature>
</featureManager>
<basicRegistry id="basic" realm="BasicRealm">
<!-- <user name="yourUserName" password="" /> -->
</basicRegistry>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<applicationMonitor updateTrigger="mbean"/>
<library id="DB2JCC4Lib">
<fileset dir="/Users/anatoly/developer/sql_drivers" includes="*.jar"/>
</library>
<dataSource id="db2_slc" jndiName="jdbc/BEADB" type="javax.sql.DataSource">
<jdbcDriver libraryRef="DB2JCC4Lib"/>
<properties.db2.jcc databaseName="beadb" password="********" portNumber="50000" serverName="db2server" user="db2username"/>
</dataSource>
<keyStore id="defaultKeyStore" password="******"/>
<enterpriseApplication id="BigEnterpriseAppEAR" location="BigEnterpriseAppEAR.ear" name="BigEnterpriseAppEAR"/>
</server>
persistence.xml file, located in BigEnterpriseAppJPA > src > META-INF > persistence.xml
in packaged EAR persistence.xml located in BigEnterpriseAppEAR -> BigEnterpriseAppJPA.jar -> META-INF -> persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="BigEnterpriseApp">
<jta-data-source>jdbc/BEADB</jta-data-source>
<class>com.bea.entities.System</class>
<class>com.bea.entities.Data</class>
<class>com.bea.entities.User</class>
<class>com.bea.entities.Group</class>
<properties>
<property name="openjpa.jdbc.Schema" value="BEADB" />
<property name="openjpa.ConnectionRetainMode" value="transaction" />
</properties>
</persistence-unit>
</persistence>
[ERROR ] CWWJP0012E: The persistence unit name is not specified and a unique persistence unit is not found in the BigEnterpriseAppEAR application and BigEnterpriseAppEJB.jar module.
This would imply your persistence.xml roots are not at the legal locations defined by the JPA spec, section 8.2:
In Java EE environments, the root of a persistence unit must be one of the following:
an EJB-JAR file
the WEB-INF/classes directory of a WAR file[87]
a jar file in the WEB-INF/lib directory of a WAR file
a jar file in the EAR library directory
an application client jar file
NOTE: Java Persistence 1.0 supported use of a jar file in the root of the EAR as the root of a
persistence unit. This use is no longer supported. Portable applications should use the EAR
library directory for this case instead
Your setup seems to be trying to use #4?
BigEnterpriseAppEAR -> BigEnterpriseAppJPA.jar -> META-INF -> persistence.xml
BigEnterpriseAppJPA.jar should be placed inside your EAR library directory. I believe this will be BigEnterpriseAppEAR/lib by default, but you can configure this with your /META-INF/application.xml in the EAR
Also note, that the persistence-unit name must be unique. Make sure that all persistence-unit names are not using the same name.

Importing External JAR to Websphere Liberty? [NoClassDefFoundError]

I want to use this JSON parser in my JAX-RS application that runs on Websphere Liberty.
I have done the following:
1) Right-click on Project -> Properties -> Java Build Path -> Add External Jar -> C:\javalib\quick-json.jar
2) Added C:\javalib to enviroment variable CLASSPATH
3) Added fileset xml to serverl.xml
<library id="ExternalLibs">
<fileset dir="C:\javalib" includes="*.jar"/>
</library>
4) Unchecked 'Enable project specific settings' in 'Java Compiler'
5) Cleaned the Project
[EDIT]
I was initially creating a new instance and then I turned it into an #ApplicationScoped bean and injected it. Now I get this error:
The JNDI lookup failed for JNDI name java:module/ConsoleREST with the following Exception CNTR4007E: An error occurred creating the websphere.jaxrs.service.ConsoleREST interface for the ConsoleREST enterprise bean in the WebApiConsole.war module in the WebApiConsole application. The enterprise bean look up failed using the java:module/ConsoleREST JNDI name. Exception: com/json/parsers/JsonParserFactory.
CNTR4007E: An error occurred creating the websphere.jaxrs.service.ConsoleREST interface for the ConsoleREST enterprise bean in the WebApiConsole.war module in the WebApiConsole application. The enterprise bean look up failed using the java:module/ConsoleREST JNDI name. Exception: com/json/parsers/JsonParserFactory
The first step was enough to get it to compile. Now I'm getting what I learned to be a runtime error. I would appreciate help!
You also need a <classloader> element in your application definition in the server.xml, which references the shared library. For example,
<application id="myapp" name="My App" type="war" location="somewhere.war">
<classloader commonLibraryRef="ExternalLibs" />
</application>
Alternatively, if your application is the only user of the library, you could package it in the WEB-INF/lib folder of your war. (Putting it in WebContent/lib in Eclipse should accomplish this.)

Lookup failed for 'java:comp/BeanManager' when deploying to Glassfish 4

I already made some research on Google and SO but could not find a solution.
I am writing a java ee 7 Web application including Omnifaces and Primefaces using Eclipse. When deploying the application to Glassfish 4, I get the following error:
javax.naming.NamingException: Lookup failed for 'java:comp/BeanManager'
The longer part of the stacktrace is
java.lang.IllegalStateException: javax.naming.NamingException: Lookup failed for 'java:comp/BeanManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Error retrieving java:comp/BeanManager [Root exception is java.lang.IllegalStateException: Cannot resolve bean manager]]
at org.omnifaces.util.JNDI.lookup(JNDI.java:87)
at org.omnifaces.config.BeanManager.init(BeanManager.java:76)
at org.omnifaces.config.BeanManager.getReference(BeanManager.java:115)
at org.omnifaces.application.OmniApplication.createConverter(OmniApplication.java:86)
at javax.faces.application.ApplicationWrapper.createConverter(ApplicationWrapper.java:403)
at org.primefaces.config.ConfigContainer.initConfig(ConfigContainer.java:69)
But I highly doubt that the problem is related to Omnifaces, it's more to state that I didn't do any messy call to cause this.
There is a beans.xml in WEB-INF, it's not completely empty.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
<interceptors>
<class>x.y.z.security.SecurityInterceptor</class>
</interceptors>
</beans>
For the discovery-mode=all, I know it is not recommended, but this is due to an issue I found here: https://java.net/jira/browse/GLASSFISH-20667
If you need more information, facets config or the like, I am happy to post it - but as I've run out of ideas where to locate the problem I don't want to post the everything like complete POM, Glassfish, Eclipse, Maven config or all the code.
edit 2014-01-27:
Ok, after I had written my below comment (the one in comments), I got an idea. Can someone maybe check it out/confirm easily? I was able to load the application to GF after recreating a new database. Can eclipselink cause the above? I am using MS SQL Server 2012, and of course I get SQLExceptions and warnings that tables+fks already exist when redploying, but warnings should not fail my application deployment, should they?
<persistence-unit name="xyzPersistenceUnit" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/xyzDS</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>

Jboss 6.1.0 application is already installed

I am trying to migrate an application from JBoss 4.0.5 to JBoss 6.1.0. I use ant for deployment. This is my application.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<application 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/application_6.xsd"
version="6">
<application-name>Fantana</application-name>
<module>
<ejb>fantana.jar</ejb>
</module>
<module>
<web>
<web-uri>fantantaWeb.war</web-uri>
<context-root>/</context-root>
</web>
</module>
<module>
<web>
<web-uri>fantanaTerm.war</web-uri>
<context-root>/</context-root>
</web>
</module>
</application>
When I deploy I have the following files generated in the "deploy" folder of the server.
fantana.jar
fantana.war
fantanaWeb.war
fantanaTerm.war
When runnning the server I get the following issue:
15:34:29,296 WARN [Digester] Empty stack (returning null)
15:34:29,319 INFO [TomcatDeployment] deploy, ctxPath=/crud
15:34:29,364 ERROR [AbstractKernelController] Error installing to Real: name=vfs:///D:/abujdei/develop/jboss-6.1.0.Final/server/brendolan/deploy/fantana.war state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error deploying: jboss.naming:application=fantana
Caused by: java.lang.IllegalStateException: jboss.naming:application=fantana is already installed.
I know this issue has been adressed before but I am unable to understand why this happends.
If necessary I can provide more information. Thank you.
#ionutab
So ok. I have renamed the file
fantana.war
into
fantanaCore.war
I have read in several posts over the internet that somehow necause fantana.jar and fantana.war have the same name it is not ok.
I have renamed it in the ant task, not in the filesystem. (VERY IMPORTANT)
If you come upon something like this write me here. Maybe I can help.
I found the link here very useful. Thanks.

Namespace error with spring data neo4j

i´m currently trying to set up a test project with GWT, Maven, Neo4j and Spring Data.
I ran into a problem when I try to start the project in development mode in eclipse
I alway get the error
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/neo4j]
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/data/neo4j
http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd">
This is the part of the application-context.xml which gives the error.
In pom.xml I use
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
</dependency>
But I also had the problem with the 2.0.0.Release version.
I found the same error here http://neo4j.org/nabble/#nabble-td3428668
but no answer is provided or if there is a fix.
Does someone have an idea where the problem is?
What is your setup? I guess there is a classloader problem in that the neo4j namespace XML is sitting in another bundle and not accessible to the requesting bundles classloader. Could you put all the SDN jars into one big superbundle to get around this_