I have been struggling with this error for an entire day and I just couldn't find any posts out there. This is the error I am getting:
org.netbeans.InvalidException: Netigso: my-module-path: Cannot start com.my-bundle state remains INSTALLED after start()
This is my scenario:
-I have a NetBeans Platform v7.4 app, that uses an OSGi Module.
-Inside of the OSGi module I have a simple POJO API
-I need to add JAXB annotations "import javax.xml.bind.annotation" to the POJOs because in another non-OSGi module I am saving/reading the model from an XML file
-The OSGi module import works, as long as I do not add the #XML annotations. The moment I add the annotations, I get the error above.
Can somebody help me figure out how do I need to handle the "javax.xml.bind.annotation" import inside of the OSGi bundle? What is causing this error?
Related
I am using Apache Felix to create an embedded OSGi host application. I am using the following code to expose the packages I want to expose:
List<String> extra = new ArrayList<>();
extra.add("some.example.packag.to.expose.1");
extra.add("some.example.packag.to.expose.2");
extra.add("some.example.packag.to.expose.3");
config.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, extra.toString().replace("[","").replace("]", ""));
Everything works great and these packages are exposed. However, I need the bundles to have access to ALL the host project declared dependencies. So for example the parent application has Jackson, Apache (various), etc. declared and I need the bundles to have access to these.
I tried adding the packages explicitly but that does not seem to do the trick when they are dependencies. So for example in the bundle I want to use Jacksons com.fasterxml.jackson.core.type.TypeReference; so I added com.fasterxml.jackson.core.type to the above EXTRA list but it does not appear to solve the problem, the package still doesn't get exposed.
In a perfect work I just want to make ALL the host dependencies available without having to explicitly state each one.
You will have to configure each package. In OSGi you would normally install the dependencies as bundles. So the settings do not suppot to mass export system packages.
I'm having hibernate3.jar and hibernate-core-4.2.0.CR1.jar in my classpath and I'm using Spring 3.1.3 version. Code got compiles sucessfully but while runtime I'm getting following error
2014-10-28 10:51:25,174 DEBUG [RMI TCP Connection(2)-10.126.30.203] -
Target method failed for RemoteInvocation: method name
'getPriceByKeys'; parameter types [java.util.List, java.util.Date]
java.lang.NoSuchMethodError:
org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session;
I google it but not find any solution. Please note : My project needs hibernate3.jar but at the same time my project dependent on some other 3rd party jar which inturn using hibernet4.2.0 jar.
Any help Pls ??
You need to remove multiple hibernate JAR files from your classpath. Without doing this, your application may not work as you expect; which means you need to migrate the hibernate version of your application from 3 to 4.1.
Although Spring 3.1 uses Hibernate 3 JAR files, you can still migrate to Hibernate 4. Check out Spring blog gives a small tutorial to do so.
Migrating to Spring 3.1 and Hibernate 4.1
As part of the Core-Spring course, we have a lab application that we
use to show how to integrate Spring and JPA/Hibernate together. We
have just upgraded it to Spring 3.1 / Hibernate 4.1, and thought we
should share a few tips.
Just an update. The cause of problem is , I'm having two spring-context xml files in project (one of my project and one related to another module that I'm integrating). I'm loading context xmls from two different classes. So one of the DAO class loaded by one of spring-context xml not getting the hibernate Session.
Later on using import tag, I included 2nd spring application context file in 1st application context file and then loaded a Single application context file from the class. It solved the error.
Thanks,
This should be easy, but it's been costing me tons of time. I basically can't get a RESTful web service running under eclipse. I'm sure I'm missing something stupid, but resources seem to be a bit scattered and nothing covers the recent 4.0/EE 7 release.
I have a clean install of Eclipse Kepler (4.3). I try and set up a basic RESTful app using the following steps.
I have Java EE 7 installed
I open eclipse, point it to a fresh workspace and create a new 'Dynamic Web Application'.
Project name doesn't particularly matter, a new Target Runtime is created by downloading the Glassfish extension (New Runtime->Download additional server adapters->Glassfish). This requires restarting eclipse - so just repeat the previous, but select a Glassfish 4.0 runtime after clicking 'New Runtime'. Web Module is 3.1, everything else is default. I click 'Finish' to create my new project.
I then right click and open project properties, then 'Project Facets'. I check of JAX-RS (REST Web Services). Then click 'Further Configuration required...". I then select 'Disable Library Configuration' from the drop down. The fields receive the following values:
JAX-RS servlet name: JAX-RS Servlet
JAX-RS servlet class name: org.glassfish.jersey.servlet.ServletContainer
URL mapping patterns: /jaxrs/*
I then click OK to close all the windows.
Now adding a New->'RESTful Web Service from Pattern' creates a new class, that doesn't seem to ever get picked up by glassfish on deployment. My understanding is that it should auto scan and pick up things with an #path. It doesn't seem to. If I finagle things enough I can seem to access the application.wadl - but doesn't show my resource.
If I go back into properties and take a look at my JAX-RS project facet, I'm presented with an error box saying some of my values are invalid.
In the workspace log I'm greeted with the following exception:
!ENTRY org.eclipse.jst.jee 4 0 2013-07-02 21:54:27.780
!MESSAGE org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp
!STACK 0
java.lang.ClassCastException: org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp
at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.UpdateWebXMLForJ2EE.run(UpdateWebXMLForJ2EE.java:32)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.modify(JEE5ModelProvider.java:255)
at org.eclipse.jst.jee.model.internal.Web25MergedModelProvider.modify(Web25MergedModelProvider.java:92)
at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetInstallDelegate.createServletAndModifyWebXML(JAXRSFacetInstallDelegate.java:275)
at org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSFacetInstallDelegate.execute(JAXRSFacetInstallDelegate.java:156)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$5.run(FacetedProject.java:1099)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChanges(FacetedProject.java:1109)
at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectWorkingCopy.commitChanges(FacetedProjectWorkingCopy.java:2020)
at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$4.run(FacetsPropertyPage.java:232)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage$5.run(FacetsPropertyPage.java:246)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Any insight would be so greatly appreciated.
Try running Eclipse with Java SE. The parts of Java EE that your project needs to compile against can come from Glassfish itself. You might also need to use #Path rather than #path since it matches to a type name and is case sensitive.
I am getting the following JAXBException of the form
class SomeClass nor any of its super class is known to this context.
The full stack trace looks like this:
javax.xml.ws.WebServiceException: javax.xml.bind.JAXBException: class com.myCompany.generatedCode.WebServiceOperationName nor any of its super class is known to this context.
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:586)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:130)
at org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:93)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:364)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:185)
at $Proxy41.deleteAccount(Unknown Source)
at com.myCompany.myPackage.MyWebServiceClient.callSomeWebService(MyWebServiceClient.java:100)
(other classes specific to my application and framework)
...
Caused by:
javax.xml.bind.JAXBException: class com.myCompany.generatedCode.WebServiceOperationName nor any of its super class is known to this context.
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:556)
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:452)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:314)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:243)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
at com.ibm.xml.xlxp2.jaxb.marshal.MarshallerProxy.marshal(MarshallerProxy.java:100)
at org.apache.axis2.datasource.jaxb.JAXBDSContext$1.run(JAXBDSContext.java:470)
at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:76)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshalByElement(JAXBDSContext.java:455)
at org.apache.axis2.datasource.jaxb.JAXBDSContext.marshal(JAXBDSContext.java:414)
at org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl._outputFromBO(JAXBBlockImpl.java:189)
at org.apache.axis2.jaxws.message.impl.BlockImpl.outputTo(BlockImpl.java:372)
at org.apache.axis2.jaxws.message.impl.BlockImpl.serialize(BlockImpl.java:296)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:808)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:975)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:1016)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:271)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:233)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:1016)
at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:488)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:88)
at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.writeMessage(SOAPOverHTTPSender.java:3271)
at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.sendChunkedRequest(SOAPOverHTTPSender.java:888)
at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.sendSOAPRequest(SOAPOverHTTPSender.java:807)
at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:611)
at com.ibm.ws.websvcs.transport.http.HTTPTransportSender.invoke(HTTPTransportSender.java:364)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:581)
... 52 more
What triggers this is attempting to make a call to a web service operation named WebServiceOperationName. I've seen other tips for dealing with this error which usually involve adding a #XmlSeeAlso annotation or making adjustments to how marshalling and unmarshalling are done.
In this case, I am calling a webservice whose code is generated by Maven based on a WSDL (and supporting schemas). I don't have direct control over the code produced by Maven, and I don't have control over the marshall/unmarshall calls. Other webservice calls in the application don't seem to be having any problem.
Even stranger, I can't reproduce this on my local server, though it happens on the development server. The generated JAR for the webservice is the same, as it the rest of the application's code.
This exception has appeared suddenly this week (and consistently), and I suspect that something has changed, environmentally, but I'm not sure what. Any ideas?
A new observation:
The first time I attempt to run this code on the server after it's been started/restarted, it takes a while (About a minute) before it fails and throws an exception. Every time after that, the exception is almost instantaneous...
Further information:
This problem is present in WebSphere 7.0.0.23 (which is on the server), but not in WebSphere 7.0.0.7 (on the workstation).
The issue's been resolved. I was inspecting the jar that contained the class WAS was complaining about and noticed that some of the classes were duplicated at different levels of package hierarchy. It's worth pointing out that the class that was reported in the original error was not actually one of these duplicated classes. Also, the application did not reference different variants of the same class - the classes referenced were in the expected package. The extra duplicates one level up were not referenced anywhere (as far as I can tell).
It looked like a bad Maven configuration, but when I inspected the xjb binding files, I couldn't figure out how the types in that schema namespace got bound to two different packages. Either way, I cleanded up some of the binding files used by Maven, refactored common bindings into one file, had Maven rebuild the jar, and then tested, and suddenly the issue was gone!
Clearly there was a problem in WAS 7.0.0.23 since the original jar worked fine on WAS 7.0.0.7. It may have been caused by a problem with the Maven bindings which resulted in a strange-looking but technically valid jar.
Also interesting: one of our developers upgraded WAS to 7.0.0.25 and used the original "bad" jar and got a "no such operation" error instead of the JAXBException.
I have the same problem in Guidewire ClaimCenter, which is an insurance application that can be configured but the core can't be modified at all, It's Java based it has component included like axis2 but I created a seperate java project that wraps a webservice call, I created all the stub code with wsimport. It works well under my deve enviroment which is windows and jetty because is the Guidewire platform to configure it (no other option). we use WAS 7 as production server.
Caused by: javax.xml.ws.WebServiceException: javax.xml.bind.JAXBException: au.com.mycompany.policyinquiry.retrieveinsurancepolicydetails.v1.RetrieveInsurancePolicyDetailsResp is not known to this context
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMinimalMethodMarshaller.demarshalResponse(DocLitBareMinimalMethodMarshaller.java:158)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.createResponse(JAXWSProxyHandler.java:499)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:377)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:185)
at $Proxy80.retrieveInsurancePolicyDetails(Unknown Source)
I tried to generate and compile the client in the server side just in case it was something related with different JDK platform, but that didn't solve the problem.
I found the next article was 6!
but for WAS 6 , I haven't tried though.
When the JAX-WS web service engine receives a message, it uses
the JAXB engine to convert the message into java beans.
The message indicates a failure occurred while converting xml
into an object of type
com.somecom.lib.business.xml.ComIdentifierXml. The failure
indicates that the JAXB engine was not initialized with
information about this user class.
.
In this use case, the class
com.somecom.lib.business.xml.ComIdentifierXml is packaged in a
JAR at the EAR level. The exception does not happen if the
class is packaged in a JAR located in the WAR module's
WEB-INF/lib directory.
SOLUTION:
Target Environment:
IBM server
IBM JDK 1.6
IBM Webpshere 7.0.0.25
The client to call the webservice is using pure JAVA no dependency on external library JAX-WS RI 2.1.6
In webspehre
1- Set for the application the class loading to parent last
2- Turn off webservice annotations with this: Set the com.ibm.websphere.webservices.DisableIBMJAXWSEngine property to true. this will disabled Websphere own implementation based on a modified Axis2
3- Deploy your application with third-party JAX-WS runtime
in my case i used Glassfish Metro 1.5 which includes JAX-WS RI 2.1.7 and is the same as my local environment with JDK 1.6.0_37
That's it
Cheers
Alex :)
I have been attempting to create a super simple web-service (non-SOAP wsdl Server) within Eclipse Java EE (Juno) using Java 1.6. I want the web-service war to be as simple as possible, as in this simple (first reply in the thread).
IOW, I want the war file to just have the class I have defined (which includes the #WebService and #WebMethod annotations) and possibly a web.xml file which can then be deployed in Eclipse Java EE to the JBoss 6.0 server I have set up.
I must be missing some simple step somewhere. Each time I have tried, I either cannot get the web-service to deploy, or Eclipse wants to auto-generate and add a huge number of useless classes to the deployment.
I have Eclipse Java EE set up and I created a File -> New-> Dynamic Web Project and call it ProjectHelloService. I then create a single class in the project under Java Resources/src in its own package, ws.simple. The class looks like this:
package ws.simple;
import javax.jws.WebMethod;
import javax.jws.WebService;
#WebService
public class HelloService
{
#WebMethod
public String sayHello(String name)
{
return "Hello, " + name;
}
}
I then start up the JBoss server and "Add" the project to JBoss. I see the "...deploy, ctxPath=/ProjectHelloService" message indicating that my project has deployed. However, when I go to the default JBoss page -> JBoss Web Services Console -> View a list of deployed services, I see "There are currently no endpoints deployed ". When I dig around and try to see what was deployed in JBoss's server/default folder, I cannot find anything in the deploy folder.
Again, I must be missing some step somewhere. For example, I don't see a .war (or even .jar) file being generated, in Eclipse nor in the JBoss deploy folder. However, I am not deeply versed in the nuances of how Eclipse works with JBoss 6.0, so I might be missing some configuration subtlety here.
Is there something simple I can do to get a super stupid simple .war file to deploy to the Eclipse contained JBoss 6.0 so that I can see my web-service? And since JBoss is able to do all the auto-file generation automatically from the annotations in the .war file, I don't want Eclipse to do all the extra file stub generation crap. That's CORBA old school style, and makes for a much less manageable project (at least for the area I am working in right now).
And I don't suppose there is some way that I can have the above in Eclipse while having the convenience of the Netbeans approach to creating and managing Java web-services. If there is, I sure would like to know what it is.
Thank you for any guidance and/or assistance you can over here.