[JBoss AS 7 Development] - com.ctc.wstx.exc.WstxParsingException: Received non-all-whitespace CHARACTERS or CDATA event in nextTag(). when JMS stuff added to standalone.xml
by freakyprogrammer
freakyprogrammer [https://community.jboss.org/people/freakyprogrammer] created the discussion
"com.ctc.wstx.exc.WstxParsingException: Received non-all-whitespace CHARACTERS or CDATA event in nextTag(). when JMS stuff added to standalone.xml"
To view the discussion, visit: https://community.jboss.org/message/827418#827418
--------------------------------------------------------------
Hi I am trying to configure horneq in my server to perform JMS in my standalone.xml as per this link. https://docs.jboss.org/author/display/AS71/Messaging+configuration https://docs.jboss.org/author/display/AS71/Messaging+configuration. But I am getting the exception while starting the server. I got the following exception.
17:06:11,609 ERROR [org.jboss.as.server] JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.ServerService.boot(ServerService.java:266) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at java.lang.Thread.run(Thread.java:780) [vm.jar:1.7.0]
Caused by: com.ctc.wstx.exc.WstxParsingException: Received non-all-whitespace CHARACTERS or CDATA event in nextTag().
at javax.xml.stream.SerializableLocation@368d5a7e
at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:606)
at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:479)
at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:464)
at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1137)
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.nextTag(XMLExtendedStreamReaderImpl.java:152) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.messaging.MessagingSubsystemParser.processHornetQServer(MessagingSubsystemParser.java:226)
at org.jboss.as.messaging.MessagingSubsystemParser.readElement(MessagingSubsystemParser.java:156)
at org.jboss.as.messaging.MessagingSubsystemParser.readElement(MessagingSubsystemParser.java:119)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:894) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_1(StandaloneXml.java:330) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:127) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:100) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
... 3 more
I have added everything like <extension moduel="org.jboss.as.messaging"> and ports too. I didn't find any exact reason or resolution for this online. Please help me.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/827418#827418]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[EJB3 Development] - Memory leak by closed connections
by Rene Schneider
Rene Schneider [https://community.jboss.org/people/rschneider] created the discussion
"Memory leak by closed connections"
To view the discussion, visit: https://community.jboss.org/message/827328#827328
--------------------------------------------------------------
I found this bug (pretty sure about it being a bug, would love to directly file an issue in the issue tracker, but that doesn't seem to be possible without having some SalesForce "support case reference") when porting a real application which explicitly supports offline scenarios from JBoss 6 to 7.1.3:
When an EJB client gets disconnected from its JBoss 7 server, for example because that server has been shut down, but keeps running and eventually reconnects to the restarted server, a new org.jboss.remoting3.ConnectionImpl instance is created for that new connection. The old connection can not be garbage collected, however, as there are still two strong references lingering around to that connection in the jboss-ejb-client module. I refer to version 1.0.22.Final, which seems to be the most current final version (big difference from 1.0.11.Final, which is by default packaged in JBoss 7.1.3 - one of the code parts in which the problematic references reside has been refactored somewhere in between!)
The first reference can be found in org.jboss.ejb.client.remoting.RemotingCleanupHandler in the collection named "connections", which obviously only gets connections added to it, and NEVER removed. The second reference is similar in nature and can be found in org.jboss.ejb.client.remoting.RemotingConnectionManager in the collection "managedConnections". It is also evident from the code that connections can never be removed from that collection, not even after they were closed due to whatever circumstance.
As both of these collections seem to be used only for closing a bunch of connections at once, I devised a small fix for the problem which replaces the strong-referenced collections with WeakHashMaps. Closed connections automatically fall out of those, and connections still in use are always referenced by at least one other, strong reference. After applying that fix (and fixing another reference-to-closed-connection-bug in JBoss Remoting 3, as I described in https://community.jboss.org/message/827298#827298 https://community.jboss.org/message/827298#827298) dead connections finally were garbage collected. I attached a patch file to this posting. I'm not at all sure whether this fix is the most elegant one (okay, probably not...) but it successfully solved the problem for my application.
Steps to reproduce the issue:
- Create an EJB client and service, deploy service in JBoss7
- Have the EJB client call the service on the server frequently
- Shut down the server. The client must be built to continue calling the server, even though exceptions are now thrown.
- Restart the server. The client will reconnect and continue without errors.
- Fetch a heap dump from the client. There are now two connection objects in the heap, a closed one and an open one. Rinse and repeat for having 3,4,5,...
It is reproducible with the modules delivered within JBoss 7.1.3 as well as the newer versions of ejb-client 1.0.22.Final and remoting3 3.2.16.GA.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/827328#827328]
Start a new discussion in EJB3 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[JMX Development] - Deploying a .ear in domain mode (vs standalone) using remoting-jmx
by Guillaume Archambault
Guillaume Archambault [https://community.jboss.org/people/guillo] created the discussion
"Deploying a .ear in domain mode (vs standalone) using remoting-jmx"
To view the discussion, visit: https://community.jboss.org/message/811456#811456
--------------------------------------------------------------
Hi,
In JBoss AS7,
>From a client java program,
i'm using this: service:jmx:remoting-jmx://my_host_name:port to connect to either a standalone mode server or a domain mode server.
In standalone mode:
I can retreive the MBean jboss.as:deployment=myEar.ear, and then able to deploy, redeploy, undeploy or remove myEar.ear
This works great !
However,
In domain mode:
I have 3-4 ears deployed on this server, belonging to different server groups.
There is only a few MBeans (not interesting for deploying) availables, and mainly, no jboss.as:deployment=myEar.ear available, or any MBeans related to server-groups or cluster etc...
I'm thinking that there must be a xml configuration file (domain.xml,host.xml,....) somewhere to offer the wanted MBeans ?
Why standalone mode has the jboss.as:deployment MBean and not the domain mode ?
JBoss AS7 is installed on Linux 2.6.32-279.5.2.el6.x86_64
Any idea ?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/811456#811456]
Start a new discussion in JMX Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[EJB3 Development] - EJB reference always null.Jboss 6
by Andrei Karzhou
Andrei Karzhou [https://community.jboss.org/people/rfe.cook] created the discussion
"EJB reference always null.Jboss 6"
To view the discussion, visit: https://community.jboss.org/message/826801#826801
--------------------------------------------------------------
I am deleveloping web project EJB,JPA - Hibernate as provider, JBoss 6,MySql.
I new in EJB, JPA.I have problems with load ejb bean in servlet.
**persistence.xml**
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="LibraryPersistenceUnit" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/MySqlDS</jta-data-source>
<class>library.entity.User</class>
<class>library.entity.Book</class>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
</properties>
</persistence-unit>
</persistence>
**UserFacade.java**
@Local
public interface UserFacade {
User findUserByLoginAndPassword(String login, String password);
/* List<User> getClients();
void returnBooks(long userId, long[] ids);
void takeBooks(long userId, long[] ids);*/
}
**UserFacadeImpl.java**
package library.facades.impl;
import library.dao.impl.UserDAO;
import library.entity.User;
import library.facades.interfaces.UserFacade;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@Stateless
public class UserFacadeImpl implements UserFacade {
@EJB
private UserDAO userDAO;
public UserFacadeImpl() {
}
public User findUserByLoginAndPassword(String login, String password) {
User user = userDAO.selectUserByLoginAndPassword(login, password);
return user;
}
/* public List<User> getListClients() {
List<User> userList = userDAO.getClients();
return userList;
}
public void returnBooks(long userId, long[] ids) {
userDAO.returnBooks(userId, ids);
}
public void takeBooks(long userId, long[] ids) {
userDAO.takeBooks(userId, ids);
}*/
}
**UserDAO.java**
package library.dao.impl;
import library.dao.interfaces.GenericDAO;
import library.entity.User;
import javax.ejb.Local;
import javax.ejb.Stateless;
import java.util.HashMap;
import java.util.Map;
@Stateless
public class UserDAO extends GenericDAO {
public UserDAO() {
super(User.class);
}
public User selectUserByLoginAndPassword(String login, String password) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("login", login);
parameters.put("password", password);
return (User) super.findOneResult(User.SELECT_USER_BY_LOGIN_AND_PASSWORD, parameters);
}
/*public List<User> getClients() {
Query namedQuery = entityManager.createNamedQuery(User.ALL_CLIENTS, User.class);
List<User> clientsList = namedQuery.getResultList();
return clientsList;
}
@Override
public void returnBooks(long userId, long[] ids) {
User user = entityManager.find(User.class, userId);
for (long id : ids) {
Book book = entityManager.find(Book.class, id);
user.getTakenBooks().remove(book);
}
entityManager.merge(user);
}
@Override
public void takeBooks(long userId, long[] ids) {
User user = entityManager.find(User.class, userId);
for (long id : ids) {
Book book = entityManager.find(Book.class, id);
user.getTakenBooks().add(book);
}
entityManager.merge(user);
}*/
}
**GenericDAO.java**
package library.dao.interfaces;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.util.List;
import java.util.Map;
public abstract class GenericDAO<T> {
private static final String LIBRARY_PERSISTENCE_UNIT = "LibraryPersistenceUnit";
@PersistenceContext(unitName = LIBRARY_PERSISTENCE_UNIT)
private EntityManager entityManager;
private Class<T> entityClass;
public GenericDAO() {
}
public GenericDAO(Class<T> entityClass) {
this.entityClass = entityClass;
}
public void save(T entity) {
entityManager.persist(entity);
}
protected void delete(Object id, Class<T> classe) {
T entityToBeRemoved = entityManager.getReference(classe, id);
entityManager.remove(entityToBeRemoved);
}
public T update(T entity) {
return entityManager.merge(entity);
}
public T find(int entityID) {
return entityManager.find(entityClass, entityID);
}
// Using the unchecked because JPA does not have a
// entityManager.getCriteriaBuilder().createQuery()<T> method
@SuppressWarnings({"unchecked", "rawtypes"})
public List<T> findAll() {
/* CriteriaQuery cq = entityManager.getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));*/
return null;//entityManager.createQuery(cq).getResultList();
}
// Using the unchecked because JPA does not have a
// ery.getSingleResult()<T> method
@SuppressWarnings("unchecked")
protected T findOneResult(String namedQuery, Map<String, Object> parameters) {
T result = null;
try {
Query query = entityManager.createNamedQuery(namedQuery);
// Method that will populate parameters if they are passed not null and empty
if (parameters != null && !parameters.isEmpty()) {
populateQueryParameters(query, parameters);
}
result = (T) query.getSingleResult();
} catch (Exception e) {
System.out.println("Error while running query: " + e.getMessage());
e.printStackTrace();
}
return result;
}
private void populateQueryParameters(Query query, Map<String, Object> parameters) {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
query.setParameter(entry.getKey(), entry.getValue());
}
}
public EntityManager getEntityManager() {
return entityManager;
}
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
}
**LibraryController**
package library.controller;
import library.entity.User;
import library.facades.interfaces.UserFacade;
import library.resourses.constants.Constants;
import library.resourses.enums.Role;
import javax.ejb.EJB;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class LibraryController extends HttpServlet {
@EJB
private UserFacade userFacade;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, IOException {
performAction(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, IOException {
performAction(request, response);
}
private void performAction(HttpServletRequest request, HttpServletResponse response) {
String pageType = request.getParameter(Constants.PAGE_TYPE);
if (pageType != null) {
try {
String page = null;
String login = request.getParameter(Constants.USER_LOGIN);
String password = request.getParameter(Constants.USER_PASSWORD);
User user = userFacade.findUserByLoginAndPassword(login, password);
if (user == null) {
request.getSession().setAttribute(Constants.ERROR,
Constants.ERROR_MESSAGE_7);
page = Constants.MAIN_PAGE;
} else {
String namePage = user.getRole().toString().toLowerCase();
if (isClient(user)) {
request.getSession().setAttribute(Constants.CLIENT,
user);
request.getSession().setAttribute(Constants.ERROR, null);
} else if (isAdministrator(user)) {
request.getSession().setAttribute(Constants.ADMINISTRATOR,
user);
request.getSession().setAttribute(Constants.ERROR, null);
}
page = Constants.START_PAGES + namePage + Constants.END_PAGES;
}
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(page);
requestDispatcher.forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private boolean isAdministrator(User user) {
return user.getRole().equals(Role.ADMINISTRATOR);
}
private boolean isClient(User user) {
return user.getRole().equals(Role.CLIENT);
}
}
I get null for userFacade.Can you explain me what I do wrong.
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/826801#826801]
Start a new discussion in EJB3 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[jBPM Development] - How to auto delegate using jbpm
by Krishna Ananthoj
Krishna Ananthoj [https://community.jboss.org/people/krishna.ananthoj] created the discussion
"How to auto delegate using jbpm"
To view the discussion, visit: https://community.jboss.org/message/818562#818562
--------------------------------------------------------------
I have a requirement where I need to auto delegate a task to a delegatee. The business requirement is to verify in the DB and find out who are the valid delegatees for the current delegator(actorId) for the current duration.
On node trigger event we need to check for the valid delegatee and auto assign/delegate this user to the task. We know that Jbpm allows us to do the delegation explicitly using delegate() method.
We have the valid delegatee information from DB at the time of node triggered but inorder to delegate the task we need to have the taskId information which is not available in this node trigger event. This is because, task object might not have been created yet.
public void delegate(*taskId*, userId, targetUserId)
We can't even use taskClaimed event method because it is not getting triggerd in case where there is single actorId specified for the node(in bpmn). It is because Jbpm directly moves the node from task 'Created' to 'Reserved' status in this case.
public void taskClaimed(TaskClaimedEvent event)
So, I dont have any idea, how to implement our requirement. Please help us.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/818562#818562]
Start a new discussion in jBPM Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months