I am changing my OSB 11g project build process to use configjar tools instead of ANT argument lines. This I am doing to make the build at individual resource level instead of project level.
I have created settings file and build.xml for the same and trying to build the project. Also, I have set the environment variables using osb_env.sh file in the server classpath.
Still I am getting error with some logger class for which I have done no changes in the files.
Please see error below:
clean:
copylibs:
createSbConfigJar:
[echo] OSB project config creation started
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] de:osb-services ......................... SUCCESS [1.000s]
[INFO] de.osb-services:base64 .................. SUCCESS [3.459s]
[INFO] de.osb-services:logging-common .......... SUCCESS [0.699s]
[INFO] de.osb-services:logging ................. SUCCESS [2.884s]
[INFO] de.osb-services:loggingOutbound ......... SUCCESS [1.396s]
[INFO] de.osb-services:monitoring .............. SUCCESS [1.038s]
[INFO] de.osb-services:build ................... FAILURE [0.572s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.546s
[INFO] Finished at: Wed Jun 12 12:42:49 CEST 2019
[INFO] Final Memory: 16M/249M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (deploy) on project build: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /pkg/vddi9/home/oradi9/jenkins/jenkins-data/workspace/OSB-R19.9_dev_test_7/build/build.xml:38: java.lang.NoClassDefFoundError: weblogic/i18n/logging/NonCatalogLogger: weblogic.i18n.logging.NonCatalogLogger
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (deploy) on project build: An Ant BuildException has occured: The following error occurred while executing this line:
/pkg/vddi9/home/oradi9/jenkins/jenkins-data/workspace/OSB-R19.9_dev_test_7/build/build.xml:38: java.lang.NoClassDefFoundError: weblogic/i18n/logging/NonCatalogLogger
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: The following error occurred while executing this line:
/pkg/vddi9/home/oradi9/jenkins/jenkins-data/workspace/OSB-R19.9_dev_test_7/build/build.xml:38: java.lang.NoClassDefFoundError: weblogic/i18n/logging/NonCatalogLogger
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:131)
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
Can you please tell what can be the issue here?
Please see below the existing (working) build.xml and changed(non-working) build.xml code.
(Old) build.xml:
<target name="buildOsbProject">
<java dir="${osb.home}/lib" jar="${eclipse.home}/plugins/${equinox.launcher.jar}" fork="true" failonerror="true" maxmemory="768m" >
<jvmarg line="-XX:MaxPermSize=256m" />
<arg line="-data ${workspace.dir}" />
<arg line="-application com.bea.alsb.core.ConfigExport" />
<arg line="-configProject OSBInboundServicesConfig" />
<arg line="-configJar ${osbProject.configJar}" />
<arg line="-configSubProjects OSBInboundServices" />
<arg line="-includeDependencies true" />
<arg line="--launcher.library plugins/${equinox.launcher.lib}" />
<sysproperty key="weblogic.home" value="${weblogic.home}" />
<sysproperty key="osb.home" value="${osb.home}" />
<sysproperty key="osgi.bundlefile.limit" value="750" />
<sysproperty key="harvester.home" value="${osb.home}/harvester" />
<sysproperty key="osgi.nl" value="en_US" />
<sysproperty key="sun.lang.ClassLoader.allowArraySyntax" value="true" />
<sysproperty key="middleware.home" value="${middleware.home}" />
<sysproperty key="com.bea.plateng.common.util.logging.useJDKlogger" value="true"/>
<sysproperty key="java.io.tmpdir" value="/tmp/salosb_tmp"/>
</java>
</target>
(New) build.xml
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${workspace.dir}/build/lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<!-- Task Definition -->
<taskdef name="configjar" classname="com.bea.alsb.tools.configjar.ant.ConfigJarTask">
<classpath>
<pathelement location="${osb.home}/tools/configjar/configjar.jar"/>
</classpath>
</taskdef>
<!-- This is the classpath for java runtime-->
<path id="classpath.java">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="createSbConfigJar">
<echo>OSB project config creation started</echo>
<property name="settingsFileFull" value="${workspace.dir}/build/settings-file.xml"/>
<property name="targetDirectory" value="${workspace.dir}/build"/>
<configjar debug="false" failonerror="true" errorProperty="" settingsFile="${settingsFileFull}"/>
</target>
<target name="buildDeployExportDelete" depends="clean,copylibs,createSbConfigJar,deleteFromOSB, prepareCustomization, importToOSB, setAuthorizationInformation,exportFromOSB">
<antcall target="deleteFromOSB">
</antcall>
</target>
settings-file.xml
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config">
<source>
<project dir="${workspace.dir}/OSBInboundServices"/>
<system dir="${workspace.dir}/OSBInboundServicesConfig"/>
</source>
<configjar jar="${workspace.dir}/sbconfig.jar" overwrite="true">
<projectLevel includeSystem="true"/>
</configjar>
</configjarSettings>
OSB_Env.sh
#!/bin/sh
export MW_HOME=/pkg/home/nonarch/Oracle/Middleware
export OSB_HOME=/pkg/home/nonarch/Oracle/Middleware/Oracle_OSB1
export JAVA_HOME=/opt/java6
export BEA_HOME=$MW_HOME
export WL_HOME=$MW_HOME/wlserver_10.3
export WLS_VER=10.3
export COMMON_COMPONENTS_HOME=$MW_HOME/oracle_common
export MODULES_DIR=$MW_HOME/modules
export PATH=$WL_HOME/server/bin:$JAVA_HOME/jre/bin:$JAVA_HOME/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
export MEM_ARGS="-Xms32m -Xmx200m -XX:MaxPermSize=128m"
export CONFIGJAR_HOME="$OSB_HOME/tools/configjar"
export JAVA_OPTS="-Dosb.home=$OSB_HOME -Dweblogic.home=$WL_HOME"
export JAVA_OPTIONS=" -Xverify:none"
CLASSPATH=$MW_HOME/modules/features/weblogic.server.modules_10.3.6.0.jar
CLASSPATH=$CLASSPATH:$WL_HOME/server/lib/weblogic.jar
CLASSPATH=$CLASSPATH:$MW_HOME/oracle_common/modules/oracle.http_client_11.1.1.jar:$MW_HOME/oracle_common/modules/oracle.xdk_11.1.0/xmlparserv2.jar:$MW_HOME/oracle_common/modules/oracle.webservices_11.1.1/orawsdl.jar:$MW_HOME/oracle_common/modules/oracle.wsm.common_11.1.1/wsm-dependencies.jar
CLASSPATH=$CLASSPATH:$OSB_HOME/modules/features/osb.server.modules_11.1.1.7.jar:$OSB_HOME/soa/modules/oracle.soa.common.adapters_11.1.1/oracle.soa.common.adapters.jar:$OSB_HOME/lib/external/log4j_1.2.8.jar:$OSB_HOME/lib/alsb.jar
CLASSPATH=$CLASSPATH:$CONFIGJAR_HOME/configjar.jar:$CONFIGJAR_HOME/L10N
export CLASSPATH
Related
I'm new to Open Liberty. I need to call an EJB 3.1 deployed on WAS 8.5 but I can't find any documentation or tutorial on how to do it.
Is this feature present in OpenLiberty? Which features should i enable on my server.xml? And what is the code to call the server?
UPDATE
After reading some documentation, I've tried to make the call with the following server.xml
<server description="Sample Liberty server">
<featureManager>
<feature>webProfile-7.0</feature>
</featureManager>
<variable name="default.http.port" defaultValue="9080" />
<variable name="default.https.port" defaultValue="9443" />
<variable name="app.context.root" defaultValue="ServletSample" />
<webApplication location="open-liberty-template.war"
contextRoot="/test" />
<keyStore id="defaultKeyStore" password="keypassword"/>
<!-- EXAMPLE TRACE: when you visit the /health endpoint, additional traces
are logged in the trace.log file. -->
<!-- <logging traceSpecification="com.ibm.ws.microprofile.health.*=all"></logging> -->
<httpEndpoint host="*" httpPort="${default.http.port}"
httpsPort="${default.https.port}" id="defaultHttpEndpoint" />
<httpDispatcher enableWelcomePage="false" />
</server>
and Servlet
#WebServlet("/RemoteTxAttrServlet")
public class TestServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Properties p = new Properties();
// p.put(Context.PROVIDER_URL, "iiop://10.64.2.93:2821");
Object found = null;
try {
Context c = new InitialContext();
found = c.lookup(
"corbaname::ip:port#ejb/global/ear-module/ejb-module/BeanName!package.Interface");
} catch (NamingException e) {
e.printStackTrace();
}
System.out.println(found);
}
}
but I obtain the following Exception:
[INFO] [err] javax.naming.NameNotFoundException: Intermediate context does not exist: corbaname::10.64.2.93:2821#ejb/global
[INFO] [err] at com.ibm.ws.jndi.internal.ContextNode.getTargetNode(ContextNode.java:125)
[INFO] [err] at [internal classes]
[INFO] [err] at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409)
[INFO] [err] at it.aci.grpc.services.TestServlet.doGet(TestServlet.java:27)
[INFO] [err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
[INFO] [err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
[INFO] [err] at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1258)
[INFO] [err] at [internal classes]
[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[INFO] [err] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[INFO] [err] at java.base/java.lang.Thread.run(Thread.java:834)
furthermore i cannot find the javax.rmi.PortableRemoteObject on the classpath to norrow the Object reference to my target remote interface.
How can i fix it?
When I start my Tomcat server 7, I am given a warning by mentioning following messages:
WARNING: Failed to register in JMX: [javax.naming.NamingException:
Could not load resource factory class [Root exception is
java.lang.ClassNotFoundException:
org.objectweb.jndi.DataSourceFactory]]
Since this is a warning, I am skipping this and continue the process. Once I create DataBase connection I am given following exception.
javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.objectweb.jndi.DataSourceFactory]
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:82)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at org.apache.naming.NamingContext.lookup(NamingContext.java:848)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.NamingContext.lookup(NamingContext.java:836)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.NamingContext.lookup(NamingContext.java:836)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.NamingContext.lookup(NamingContext.java:836)
at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at se.cambiosys.spider.FHIRServermodule.connection.DBConnectionToolkit.getConnection(DBConnectionToolkit.java:38)
at se.cambiosys.spider.FHIRServermodule.internalToolkit.WSUserInternalToolkit.isValidUser(WSUserInternalToolkit.java:187)
at se.cambiosys.spider.FHIRServermodule.toolkit.WSUserToolkit.isValidUser(WSUserToolkit.java:23)
at se.cambiosys.spider.FHIRServermodule.servlets.AccessTokenServlet.validateCredentials(AccessTokenServlet.java:315)
at se.cambiosys.spider.FHIRServermodule.servlets.AccessTokenServlet.handlePasswordGrant(AccessTokenServlet.java:139)
at se.cambiosys.spider.FHIRServermodule.servlets.AccessTokenServlet.handleGrants(AccessTokenServlet.java:86)
at se.cambiosys.spider.FHIRServermodule.servlets.AccessTokenServlet.doPost(AccessTokenServlet.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
**Caused by: java.lang.ClassNotFoundException: org.objectweb.jndi.DataSourceFactory
at** org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1928)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1771)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:80)
whether I am using wrong jar file in Tomcat server or any other problem?
InitialContext ic = new InitialContext();
DataSource da = (DataSource)
ic.lookup("java:comp/env/jdbc/fhirDB");//error... code snippet.
return da.getConnection();
where my ConText file.
<?xml version="1.0" encoding="UTF-8"?>
<Context reloadable="true">
<!-- path="/CosmicFHIRService" docBase="CosmicFHIRService.war" reloadable="true" crossContext="true" -->
<Resource name="jdbc/fhirDB" auth="Container"
type="javax.sql.DataSource" username="spider3" password="spider3"
factory="org.objectweb.jndi.DataSourceFactory"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://CSLK-DKDB-81-1:1433;DatabaseName=FAROE_SPIDERIII;SelectMethod=cursor;"
maxActive="8" />
<Transaction factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60" />
</Context>
The class org.objectweb.jndi.DataSourceFactory is not on your Tomcats' classpath. You'll have to place the .jar-File containing it into Apache Tomcat lib folder: $CATALINA_HOME/lib/
Edit:
As per your comment it was not your intention to actually use this class at all. It is your context.xml file that refers to the class which does not exist:
factory="org.objectweb.jndi.DataSourceFactory"
and next reference likely to fail:
<Transaction factory="org.objectweb.jotm.UserTransactionFactory".../>.
You can simply change that to alternative implementations and update further attributes if necessary as descripted in Apache Tomcat documentation.
On placing a bundle (using camel) on Karaf I am seeing the below exception. The below exception comes only when the bundle is started. After that everything works fine. The exeception does not seem to effect our functionality. The issue is coming on both camel 2.16.1 (deployed on servicemix 6.1.0) and camel 2.16.3 (deployed on servicemix 7.0.0M2).
My blueprint is split into three files. A simplified version of them are shown below:-
blueprint.xml placed here.
productBeans.xml placed here.
camelContext.xml placed here.
Can some please let me know why is this exception coming during bundle start? It appears from the below stack-trace that it is because of some circular dependency. How can I get around this?
2016-07-04 11:29:37,497 | ERROR | mix-6.1.0/deploy | BlueprintCamelContext | 143 - org.apache.camel.camel-blueprint - 2.16.1 | {{bundle.id,143}{bundle.name,org.apache.camel.camel-blueprint}{bundle.version,2.16.1}} | Error occurred during starting Camel: CamelContext(camel-1) due Failed to create route orchestrator-service-route at: >>> process[ref:jsonRPCProcessor] <<< in route: Route(orchestrator-service-route)[[From[jetty:http://0.0.0.0... because of Cannot lookup: jsonRPCProcessor from registry: org.apache.camel.blueprint.BlueprintContainerRegistry#7b081b97 with expected type: interface org.apache.camel.Processor due: [BeanRecipe[name='myTemplate'], BeanRecipe[name='.camelBlueprint.bean.factory.myTemplate'], BeanRecipe[name='camel-1'], BeanRecipe[name='myTemplate']]
org.apache.camel.FailedToCreateRouteException: Failed to create route orchestrator-service-route at: >>> process[ref:jsonRPCProcessor] <<< in route: Route(orchestrator-service-route)[[From[jetty:http://0.0.0.0... because of Cannot lookup: jsonRPCProcessor from registry: org.apache.camel.blueprint.BlueprintContainerRegistry#7b081b97 with expected type: interface org.apache.camel.Processor due: [BeanRecipe[name='myTemplate'], BeanRecipe[name='.camelBlueprint.bean.factory.myTemplate'], BeanRecipe[name='camel-1'], BeanRecipe[name='myTemplate']]
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:947)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3258)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2981)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2812)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2808)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2831)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2808)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2777)
at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:180)[143:org.apache.camel.camel-blueprint:2.16.1]
at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:212)[143:org.apache.camel.camel-blueprint:2.16.1]
at org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:150)[143:org.apache.camel.camel-blueprint:2.16.1]
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4419)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.Felix.registerService(Felix.java:3423)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:352)
at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:100)[143:org.apache.camel.camel-blueprint:2.16.1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_77]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_77]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:956)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.4]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_77]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:754)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.camel.blueprint.CamelProducerTemplateFactoryBean.getCamelContextWithId(CamelProducerTemplateFactoryBean.java:49)
at org.apache.camel.core.xml.AbstractCamelFactoryBean.afterPropertiesSet(AbstractCamelFactoryBean.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_77]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_77]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:956)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.4]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_77]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:280)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.4]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_77]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:931)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:905)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:886)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.4]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_77]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:682)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:377)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[9:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[9:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[9:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[9:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[9:org.apache.aries.util:1.1.1]
at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2092)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)[org.apache.felix.framework-4.2.1.jar:]
at org.apache.karaf.features.internal.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:518)[20:org.apache.karaf.features.core:3.0.5]
at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:476)[20:org.apache.karaf.features.core:3.0.5]
at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:417)[20:org.apache.karaf.features.core:3.0.5]
at Proxy1be55f4b_f63a_43b3_883f_77a48747d768.installFeature(Unknown Source)[:]
at Proxy1fa9f34f_3928_4828_8542_9d785df163bd.installFeature(Unknown Source)[:]
at org.apache.karaf.kar.internal.KarServiceImpl.installFeatures(KarServiceImpl.java:215)[160:org.apache.karaf.kar.core:3.0.5]
at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:96)[160:org.apache.karaf.kar.core:3.0.5]
at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:84)[160:org.apache.karaf.kar.core:3.0.5]
at Proxya6f8b1d5_e9a2_4e1b_a105_1552c365b9de.install(Unknown Source)[:]
at Proxye3575645_14c4_4cf9_8d71_16cd6e82b1a0.install(Unknown Source)[:]
at org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)[162:org.apache.karaf.deployer.kar:3.0.5]
at Proxy6b7a1495_9239_4ff3_b9ed_1fd58a17750b.install(Unknown Source)[:]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:931)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:865)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:482)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358)[7:org.apache.felix.fileinstall:3.5.0]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310)[7:org.apache.felix.fileinstall:3.5.0]
Caused by: org.apache.camel.NoSuchBeanException: Cannot lookup: jsonRPCProcessor from registry: org.apache.camel.blueprint.BlueprintContainerRegistry#7b081b97 with expected type: interface org.apache.camel.Processor due: [BeanRecipe[name='myTemplate'], BeanRecipe[name='.camelBlueprint.bean.factory.myTemplate'], BeanRecipe[name='camel-1'], BeanRecipe[name='myTemplate']]
at org.apache.camel.impl.CompositeRegistry.lookupByNameAndType(CompositeRegistry.java:62)
at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByNameAndType(PropertyPlaceholderDelegateRegistry.java:63)
at org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:137)
at org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:157)
at org.apache.camel.impl.DefaultRouteContext.mandatoryLookup(DefaultRouteContext.java:151)
at org.apache.camel.model.ProcessDefinition.createProcessor(ProcessDefinition.java:95)
at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534)
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495)
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069)
... 105 more
Caused by: org.apache.aries.blueprint.di.CircularDependencyException: [BeanRecipe[name='myTemplate'], BeanRecipe[name='.camelBlueprint.bean.factory.myTemplate'], BeanRecipe[name='camel-1'], BeanRecipe[name='myTemplate']]
at org.apache.aries.blueprint.container.BlueprintRepository.push(BlueprintRepository.java:343)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:71)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:754)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.camel.blueprint.BlueprintContainerRegistry.lookupByNameAndType(BlueprintContainerRegistry.java:54)
at org.apache.camel.impl.CompositeRegistry.lookupByNameAndType(CompositeRegistry.java:56)
... 114 more
EDIT - It seems the error is because the jsonRPCProcessor is using myTemplate as shown below:-
<bean id="jsonRPCProcessor" class="com.j1.orchestratorservice.basecomponent.processor.JSONRPCProcessor">
<argument ref="myTemplate" />
<argument>
<map>
<!-- Product End Points -->
<entry key="Product.createProducts" value-ref="createProductsWFInfo" />
</map>
</argument>
<argument ref="exceptionHandler" />
</bean>
whereas myTemplate is defined in camelContext which in turn is using jsonRPCProcessor as shown below:-
<camelContext xmlns="http://camel.apache.org/schema/blueprint"
useMDCLogging="true">
<template id="myTemplate" />
<route id="orchestrator-service-route">
<from uri="jetty:http://0.0.0.0:8888/orchestratorservice" />
<process ref="jsonRPCProcessor" />
</route>
<route id="file-upload-service-route">
<from
uri="jetty:http://0.0.0.0:8889/fileuploadservice?enableMultipartFilter=true" />
<process ref="fileUploadProcessor" />
</route>
...
</camelContext>
I have tried to set the producer in my custom Processor as mentioned in this link. Can someone suggest me some other way of setting the producer in my custom jsonRPCProcessor so that it does not lead to any circular dependency?
I am able to get around this by removing myTemplate from jsonRPCProcesor and fileUploadProcessor. Now my jsonRPCProcessor look something like below:-
<bean id="jsonRPCProcessor" class="com.j1.orchestratorservice.basecomponent.processor.JSONRPCProcessor">
<argument>
<map>
<entry key="Product.createProducts" value-ref="createProductsWFInfo" />
</map>
</argument>
<argument ref="exceptionHandler" />
</bean>
Annotated the ProducerTemplate(in the base class) in my code with #EndPointInject. Something like below:-
#EndpointInject
protected ProducerTemplate myTemplate;
javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.DataSourceConnectionFactory]
i am using apache-tomcat-6.0.16,Operating system : Ubuntu, database Posrgresql9.1
my code for context.xml
<Resource name="jdbc/GisProject" scope="Shareable" type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.DataSourceConnectionFactory"
url="jdbc:postgresql://localhost:5432/postgres?zeroDateTimeBehavior=convertToNull"
driverClassName="org.postgresql.Driver"
username="khushi"
password="ispl12345"
maxIdle="5"
maxActive="50"
/>
I am trying to learn CXF. I have just downloaded the latest and am running samples. I was able to successfully run the "basic" jax-rs demo. I am now trying the "spring_security" demo. I see the following exception when running the server application:
Mar 22, 2013 8:51:39 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/beans.xml]
Mar 22, 2013 8:52:00 AM org.springframework.util.xml.SimpleSaxErrorHandler warning
WARNING: Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema
/security/spring-security-2.0.4.xsd', because 1) could not find the document; 2) the document could not be read; 3) the
root element of the document is not <xsd:schema>.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:
195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:96)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:380)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2541)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:2532)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:1836)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:531)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:556)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2443)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1788
)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:711)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.ja
va:400)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocument
FragmentScannerImpl.java:2756)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScanne
rImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j
ava:388)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.jav
a:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.jav
a:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:149)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext
.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext
.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefresha
bleApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationCont
ext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:771)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:411)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:763)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:247)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1238)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:480)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:277)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at demo.jaxrs.servlet.Server.<init>(Server.java:55)
at demo.jaxrs.servlet.Server.main(Server.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:291)
at java.lang.Thread.run(Thread.java:662)
Mar 22, 2013 8:52:00 AM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 53 in XML document from ServletContext resou
rce [/WEB-INF/beans.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matc
hing wildcard is strict, but no declaration can be found for element 'security:global-method-security'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j
ava:396)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.jav
a:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.jav
a:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:149)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext
.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext
.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefresha
bleApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationCont
ext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:771)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:411)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:763)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:247)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1238)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:480)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:277)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at demo.jaxrs.servlet.Server.<init>(Server.java:55)
at demo.jaxrs.servlet.Server.main(Server.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:291)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration ca
n be found for element 'security:global-method-security'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:
195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator
.java:423)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3188)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1933
)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:711)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.ja
va:400)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocument
FragmentScannerImpl.java:2756)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScanne
rImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j
ava:388)
... 34 more
Mar 22, 2013 8:52:00 AM org.eclipse.jetty.webapp.WebAppContext doStart
WARNING: Failed startup of context o.e.j.w.WebAppContext{/,file:/C:/cxf/apache-cxf-2.7.3-src/distribution/src/main/relea
se/samples/jax_rs/spring_security/target/JAXRSSpringSecurity/},target/JAXRSSpringSecurity.war
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 53 in XML document from ServletContext resou
rce [/WEB-INF/beans.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matc
hing wildcard is strict, but no declaration can be found for element 'security:global-method-security'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j
ava:396)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.jav
a:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.jav
a:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefini
tionReader.java:149)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext
.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext
.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefresha
bleApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationCont
ext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:771)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:411)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:763)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:247)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1238)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:480)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:277)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at demo.jaxrs.servlet.Server.<init>(Server.java:55)
at demo.jaxrs.servlet.Server.main(Server.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:291)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration ca
n be found for element 'security:global-method-security'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:
195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator
.java:423)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3188)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1933
)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:711)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.ja
va:400)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocument
FragmentScannerImpl.java:2756)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScanne
rImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j
ava:388)
... 34 more
Mar 22, 2013 8:52:00 AM org.eclipse.jetty.server.AbstractConnector doStart
INFO: Started SelectChannelConnector#0.0.0.0:9002
Server ready...
beans.xml follows:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.4.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="bookservice" address="/">
<jaxrs:serviceBeans>
<ref bean="customerservice"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="demo.jaxrs.service.SecurityExceptionMapper"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="customerservice" class="demo.jaxrs.service.CustomerServiceImpl"/>
<!--
<bean id="customerservice" class="demo.jaxrs.service.CustomerServiceSecuredImpl"/>
-->
<security:global-method-security secured-annotations="enabled">
<security:protect-pointcut
expression="execution(* demo.jaxrs.service.CustomerService.getCustomer(*))"
access="ROLE_CUSTOMER, ROLE_ADMIN"/>
<security:protect-pointcut
expression="execution(* demo.jaxrs.service.CustomerService.addCustomer(*))"
access="ROLE_ADMIN"/>
<security:protect-pointcut
expression="execution(* demo.jaxrs.service.CustomerService.updateCustomer(Long,demo.jaxrs.service.Customer))"
access="ROLE_ADMIN"/>
<security:protect-pointcut
expression="execution(* demo.jaxrs.service.CustomerService.deleteCustomer(*))"
access="ROLE_ADMIN"/>
<security:protect-pointcut
expression="execution(* demo.jaxrs.service.CustomerService.getOrder(*))"
access="ROLE_CUSTOMER, ROLE_ADMIN"/>
</security:global-method-security>
<security:http auto-config='true'>
<security:http-basic />
</security:http>
<security:authentication-provider>
<security:user-service>
<security:user name="bob" password="bobspassword" authorities="ROLE_CUSTOMER" />
<security:user name="fred" password="fredspassword" authorities="ROLE_CUSTOMER, ROLE_ADMIN" />
</security:user-service>
</security:authentication-provider>
</beans>
It seems a error on the security:global-method-security element. Are you using this element in the beans configuration file? Verify if you are using the correct xsd definition on the header of the xml file. The xsd version must be compatible with the spring-security version.
If you are using latest CXF make sure you have the correct namespace and schema location define in your spring configuration file. For e.g.:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
</beans>
And make sure you have the dependency of spring-security-config. If you are using Maven here it is:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>