[Beginners Corner] - Jboss unmarshalling
by vitor_b
Hello
I created a class which uses jboss Unmarshaller. It works just fine, but i cannot unmarshall xml file which does not contain the main element from schema. That means when file i want to unmarshall contains some element from schema, but this is not a global element i receive exception:
Exception in thread "main" org.jboss.xb.binding.JBossXBException: Failed to parse source: Element account is not bound as a global element.
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse (SaxJBossXBParser.java:156)
...
This the class i created:
import java.io.File;
| import java.io.FileInputStream;
| import java.io.FileNotFoundException;
| import java.io.InputStream;
| import org.jboss.xb.binding.JBossXBException;
| import org.jboss.xb.binding.Unmarshaller;
| import org.jboss.xb.binding.UnmarshallerFactory;
| import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
| import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
|
|
| public class XBUnmarshaller {
|
| SchemaBinding schema;
| Unmarshaller unmarshaller;
|
| private void setUp(){
| unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
| }
|
| public XBUnmarshaller(String schemaFile) throws FileNotFoundException {
| this(new FileInputStream(new File(schemaFile)));
| }
|
| public XBUnmarshaller(InputStream stream){
| setUp();
| schema = XsdBinder.bind(stream, "UTF-8");
| }
|
| public Object unmarshallXml(String fileName) throws FileNotFoundException, JBossXBException{
| return unmarshallXml(new FileInputStream(new File(fileName)));
| }
|
| public Object unmarshallXml(InputStream inputXml) throws JBossXBException{
| return unmarshaller.unmarshal(inputXml, schema);
| }
Could you tell me if it is possible to unmarshall such xml file? If the answer is yes, then please tell me how to do it.
vitor_b
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081755#4081755
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081755
18 years, 7 months
[JBoss Seam] - problem using entityqueries
by jamesjmp
hello,
This issue is somehow strange, so I provide you with the related code to make my explanation clear.
I´ve defined this entity-query in my components.xml file.
<framework:entity-query name="RstReportTemplate2"
| ejbql="select rstReport from RstReport rstReport"
| order="code">
| </framework:entity-query>
If I use it directly from a view xhtml file it works ok. For example
| </rich:dataTable>
| <rich:dataTable id="RstReportTemplate2"
| var="rstReport"
| value="#{RstReportTemplate2.resultList}"
| rendered="#{not empty RstReportTemplate2.resultList}">
| <h:column>
| #{rstReport.code}
| </h:column>
| </rich:dataTable>
I want to use it from a POJO. I´ve a POJO that uses this query this way:
@Name("RstReportTemp")
| public class RstReportTemplate {
|
| @In("#{RstReportTemplate2.resultList}") List<RstReport> rstRepTemplates;
|
| public RstReportTemplate() {
| }
|
| public void processTemplate() {
| Iterator<RstReport> rstReportTemp = rstRepTemplates.iterator();
| if (rstRepTemplates != null) {
| while (rstReportTemp.hasNext()) {
| // business logic code
| }
|
| }else {
| System.out.println("THERE ARE --NO-- RECORDS MATCHING RstReportTemplate2");
| }
| }
|
| }
|
When invoking to this POJO from a pojoview.page.xml with an action it works fine
<action execute="#{RstReportTemp.processTemplate}"/>
Now, here is my problem. I want to invoke that method, RstReportTemp.processTemplate, from the wire method of a POJOHome.
I´m doing it this way:
@Name("rstReportHome")
| public class RstReportHome extends EntityHome<RstReport> {
|
| public void wire() {
| ...
| RstReportTemplate repTemp = new RstReportTemplate();
| repTemp.processTemplate(rep);
| ..
| }
| ...}
This time the query doesn´t return any value, in fact the resulting List rstRepTemplates is null.
I don´t understand why the same query (with no restrictions) works fine when used directly from a view or from a POJO which is invoked by an execute of a .page.xml, but doesn´t behave the same way when it is used from a POJO which has been invoked from a different POJO.
I don´t want to have my business logic code in the POJOHome java class, that´s why I´m using another one and invoking from the wire method.
thanks in advance,
Jaime
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081749#4081749
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081749
18 years, 7 months
[Clustering/JBoss] - Cluster members don't see each other
by nitesh
Hello,
I'm using JBoss AS 4.0.3 SP1 with JDK 1.5.10.
I've setup a cluster of two JBoss instances with the partition name "DefaultPartition" and I pass the same IP Multicast address using the '-u' switch. However, the two JBoss instances don't see each other. I've not made any changes to the cluster-services.xml.
When I start JBoss, I see the following log on each instance (I've blanked out the IP address):
2007-09-06 15:54:34,370 INFO [org.jgroups.JChannel] JGroups version: 2.4.1
2007-09-06 15:54:34,634 WARN [org.jgroups.JChannel] option GET_STATE_EVENTS has been deprecated (it is always true now); this option is ignored
2007-09-06 15:54:37,006 DEBUG [org.jgroups.JChannel] cannot get state from myself (xx.xxx.xx.xxx:32900): probably the first member
Also, when I look at the DefaultPartition MBean from the jmx console, I see that CurrentView contains IP address of only one node.
Could anyone point me to what could be going on?
Thanks,
Nitesh
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081744#4081744
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081744
18 years, 7 months