rollback activemq and openjpa updates
This commit is contained in:
parent
471e666215
commit
83b7eba59e
@ -70,13 +70,13 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.3</version>
|
||||
<artifactId>velocity</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<version>2.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@ -93,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-all</artifactId>
|
||||
<version>5.18.1</version>
|
||||
<version>5.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -16,8 +16,6 @@ import javax.jms.QueueSession;
|
||||
import javax.jms.Session;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NameClassPair;
|
||||
import javax.naming.NamingEnumeration;
|
||||
import javax.naming.NamingException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.servlet.ServletConfig;
|
||||
@ -26,12 +24,9 @@ import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
|
||||
import de.hsadmin.core.model.TechnicalException;
|
||||
import de.hsadmin.core.model.TicketValidator;
|
||||
import de.hsadmin.core.model.Transaction;
|
||||
import de.hsadmin.core.qserv.NullProcessor;
|
||||
import de.hsadmin.core.qserv.Processor;
|
||||
import de.hsadmin.core.qserv.QueueTask;
|
||||
import de.hsadmin.core.util.Config;
|
||||
@ -41,8 +36,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
|
||||
|
||||
private static final long serialVersionUID = -5701350884034782083L;
|
||||
|
||||
private static boolean initQueuesDone = false;
|
||||
|
||||
private String jmsUser;
|
||||
private String jmsPass;
|
||||
private QueueConnectionFactory queueConnectionFactory;
|
||||
@ -61,14 +54,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
|
||||
isConnected = false;
|
||||
messageCount = 0;
|
||||
errorCount = 0;
|
||||
try {
|
||||
if (!initQueuesDone) {
|
||||
initQueues();
|
||||
}
|
||||
initQueuesDone = true;
|
||||
} catch (NamingException e) {
|
||||
throw new ServletException(e);
|
||||
}
|
||||
try {
|
||||
connect();
|
||||
} catch (NamingException e) {
|
||||
@ -83,10 +68,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
|
||||
InitialContext ctx = new InitialContext();
|
||||
Context env = (Context) ctx.lookup("java:comp/env");
|
||||
queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF");
|
||||
if (queueConnectionFactory instanceof ActiveMQConnectionFactory) {
|
||||
ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) queueConnectionFactory;
|
||||
activeMQConnectionFactory.setTrustAllPackages(true);
|
||||
}
|
||||
int timeoutCounter = 10;
|
||||
while (!isConnected && (timeoutCounter > 0)) {
|
||||
try {
|
||||
@ -108,29 +89,6 @@ public class QueueStatusReceiverServlet extends HttpServlet
|
||||
}
|
||||
}
|
||||
|
||||
private void initQueues() throws NamingException {
|
||||
InitialContext ctx = new InitialContext();
|
||||
NamingEnumeration<NameClassPair> list = ctx.list("java:comp/env/jms");
|
||||
Transaction transaction = new Transaction("anonymous");
|
||||
transaction.beginTransaction();
|
||||
EntityManager entityManager = transaction.getEntityManager();
|
||||
while (list.hasMore()) {
|
||||
NameClassPair pair = list.next();
|
||||
String jndiName = pair.getName();
|
||||
if (jndiName != null && jndiName.startsWith("hsadminSystem-")) {
|
||||
QueueTask task = new QueueTask();
|
||||
task.setProcessor(new NullProcessor());
|
||||
entityManager.persist(task);
|
||||
entityManager.flush();
|
||||
String hive = jndiName.substring(14);
|
||||
transaction.enqueue(hive, task);
|
||||
}
|
||||
}
|
||||
transaction.commitTransaction();
|
||||
transaction.close();
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
|
14
qserv/hsadmin.properties
Normal file
14
qserv/hsadmin.properties
Normal file
@ -0,0 +1,14 @@
|
||||
hsadmin.jms.url=ssl://hsh02.hostsharing.net:61617
|
||||
hsadmin.jms.username=user-h98
|
||||
hsadmin.jms.password=kein-echtes-ppasswort
|
||||
hsadmin.jms.system-queue=queue.hsadminSystem-h98
|
||||
hsadmin.jms.status-queue=queue.hsadminStatus
|
||||
accountprefix.customer=hsh00
|
||||
accountprefix.hostmaster=hsh01
|
||||
queues.dns=testdns
|
||||
queues.mail=testmail
|
||||
hsadmin.smtp.from=nobody@hostsharing.net
|
||||
hsadmin.smtp.cc=hostmaster@hostsharing.net
|
||||
loginURL=TestUmgebung
|
||||
backendURL=https://config.hostsharing.net:443/hsar/backend
|
||||
xmlrpcURL=http://localhost:8080/hsar/xmlrpc/hsadmin
|
@ -27,13 +27,13 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.3</version>
|
||||
<artifactId>velocity</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<version>2.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@ -44,7 +44,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-all</artifactId>
|
||||
<version>5.18.1</version>
|
||||
<version>5.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -68,7 +68,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa-maven-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
**/QueueTask.class,**/Domain.class,**/DomainOption.class,**/EMailAddress.class,**/EMailAlias.class,**/Customer.class,**/Contact.class,**/UnixUser.class,**/Pac.class,**/BasePac.class,**/BaseComponent.class,**/PacComponent.class,**/Component.class,**/Hive.class,**/INetAddress.class,**/Database.class,**/DatabaseUser.class,**/PgSqlDatabase.class,**/MySqlDatabase.class,**/PgSqlUser.class,**/MySqlUser.class
|
||||
@ -89,5 +89,40 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>
|
||||
org.apache.openjpa
|
||||
</groupId>
|
||||
<artifactId>
|
||||
openjpa-maven-plugin
|
||||
</artifactId>
|
||||
<versionRange>
|
||||
[2.4.3,)
|
||||
</versionRange>
|
||||
<goals>
|
||||
<goal>enhance</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -15,7 +15,7 @@ import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityTransaction;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
//import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.openjpa.persistence.OpenJPAEntityManager;
|
||||
|
||||
import de.hsadmin.core.qserv.QueueClient;
|
||||
@ -43,10 +43,10 @@ public class Transaction {
|
||||
ctx = new InitialContext();
|
||||
Context env = (Context) ctx.lookup("java:comp/env");
|
||||
queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF");
|
||||
if (queueConnectionFactory instanceof ActiveMQConnectionFactory) {
|
||||
ActiveMQConnectionFactory activeMQconnectionFatory = (ActiveMQConnectionFactory) queueConnectionFactory;
|
||||
activeMQconnectionFatory.setTrustAllPackages(true);
|
||||
}
|
||||
// if (queueConnectionFactory instanceof ActiveMQConnectionFactory) {
|
||||
// ActiveMQConnectionFactory activeMQconnectionFatory = (ActiveMQConnectionFactory) queueConnectionFactory;
|
||||
// activeMQconnectionFatory.setTrustAllPackages(true);
|
||||
// }
|
||||
} catch (NamingException e) {
|
||||
throw new TechnicalException("no jms queue: jms/QueueCF", e);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.ExceptionListener;
|
||||
import javax.jms.JMSException;
|
||||
@ -23,8 +24,6 @@ import javax.jms.Session;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
|
||||
public class QueueServer extends QueueCommons implements MessageListener, ExceptionListener {
|
||||
|
||||
private static final String VERSION_NO = "4.0.11";
|
||||
@ -53,13 +52,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
throw new Exception(userHelp(propFile));
|
||||
}
|
||||
}
|
||||
FileInputStream propStream = null;
|
||||
try {
|
||||
propStream = new FileInputStream(propFile);
|
||||
} catch (Exception e) {
|
||||
System.out.println("couldn't read config file " + propFile.getAbsolutePath());
|
||||
System.exit(1);
|
||||
}
|
||||
FileInputStream propStream = new FileInputStream(propFile);
|
||||
Properties props = new Properties(System.getProperties());
|
||||
props.load(propStream);
|
||||
propStream.close();
|
||||
@ -85,7 +78,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
}
|
||||
});
|
||||
while (!qServ.connect()) {
|
||||
Thread.sleep(30000);
|
||||
Thread.sleep(10000);
|
||||
}
|
||||
while (true) {
|
||||
Thread.sleep(10000);
|
||||
@ -130,11 +123,8 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
// create JMS connection and session
|
||||
try {
|
||||
Context ctx = new InitialContext();
|
||||
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx.lookup(jmsFactory);
|
||||
if (connectionFactory instanceof ActiveMQConnectionFactory) {
|
||||
ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) connectionFactory;
|
||||
activeMQConnectionFactory.setTrustAllPackages(true);
|
||||
}
|
||||
QueueConnectionFactory connectionFactory =
|
||||
(QueueConnectionFactory) ctx.lookup(jmsFactory);
|
||||
conn = connectionFactory.createQueueConnection(jmsUserName, jmsPassWord);
|
||||
conn.setExceptionListener(this);
|
||||
queueSession = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
@ -215,11 +205,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
|
||||
try {
|
||||
logger.log(Level.INFO, "sendStatus(" + queueMessage + ")");
|
||||
Context ctx = new InitialContext();
|
||||
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) ctx.lookup(jmsFactory);
|
||||
if (connectionFactory instanceof ActiveMQConnectionFactory) {
|
||||
ActiveMQConnectionFactory activeMQConnectionFactory = (ActiveMQConnectionFactory) connectionFactory;
|
||||
activeMQConnectionFactory.setTrustAllPackages(true);
|
||||
}
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup(jmsFactory);
|
||||
Destination queue = (Destination) ctx.lookup(jmsStatusQueue);
|
||||
statusConnection = connectionFactory.createConnection(jmsUserName, jmsPassWord);
|
||||
statusSession = statusConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
|
Loading…
Reference in New Issue
Block a user