users@glassfish.java.net

EJB/JAXB Exception

From: Daniel Cavalcanti <dhcavalcanti_at_gmail.com>
Date: Fri, 16 Feb 2007 14:48:45 -0500

Hi.
I'm trying to deploy an EJB that makes use of JAXB to instantiate a set of
Objects from an XML file in the method annotated @PostConstruct() and am
getting the following exception when I try to deploy the EJB.

com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment
Error -- Unable to create JAXBContext due to the security restriction
        at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(
AbstractSEIModelImpl.java:131)
        at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(
AbstractSEIModelImpl.java:63)
        at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(
RuntimeModeler.java:229)
        at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java
:185)
        at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:89)
        at com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(
WSToolsObjectFactoryImpl.java:47)
        at com.sun.tools.ws.spi.WSToolsObjectFactory.wsgen(
WSToolsObjectFactory.java:93)
        at com.sun.enterprise.webservice.WsUtil.runWsGen(WsUtil.java:1812)
        at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2110)
        at
com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(
ModuleDeployer.java:406)
        at com.sun.enterprise.deployment.backend.EjbModuleDeployer.deploy(
EjbModuleDeployer.java:127)
        at
com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(
ModuleDeployer.java:163)
        at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(
J2EECPhase.java:174)
        at
com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(
DeploymentPhase.java:95)
        at
com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(
PEDeploymentService.java:892)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(
PEDeploymentService.java:266)
        at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(
PEDeploymentService.java:761)
        at com.sun.enterprise.management.deploy.DeployThread.deploy(
DeployThread.java:174)
        at com.sun.enterprise.management.deploy.DeployThread.run(
DeployThread.java:210)

Here is the relevant code section:
    /**
     * Initializes the bean.
     */
    @PostConstruct()
    private void init() {

        try {

            synchronized (DestinationBean.class) {

                if (log.isInfoEnabled()) log.info("...");

                //
**********************************************************
                // Load destination-router configuration
                //
**********************************************************

                if (log.isTraceEnabled()) log.trace("Loading
destination-router config: " + configPath);

                JAXBContext context = JAXBContext.newInstance("
com.localmatters.flexiq.collector.destination.config");
                Unmarshaller unmarshaller = context.createUnmarshaller();
                config = (Destinations) unmarshaller.unmarshal(new
FileInputStream(configPath));

            }

        } catch (IOException ex) {
            log.error("Cannot find destination-router file: " + schemaPath,
ex);
            return;
        } catch (Throwable ex) {
            log.error("Unexpected error. Destination bean not properly
initialized", ex);
            return;
        }

    }

Does someone know what I have to do to be able to deploy this?

thanks,
Daniel.