大家好
我们所有的Maven脚本目前都是在tomcat6(开发)服务器上编译/打包和部署的.这有助于我们实现构建部署过程的自动化.
展望未来,我们希望使用MAVEN脚本自动部署到WAS7(Websphere 7)服务器.我读过的文章很少谈到调用可以执行部署到websphere的ANT任务.
有人可以共享maven脚本/标签吗?
我正在研究在Websphere 7.0上运行的Java EE 5应用程序,并且我正在尝试找到一种线程安全且高性能的方法来多线程化数据库审计日志记录的持久性. 是否有任何已知的方法可以在Java EE应用程序中安全有效地执行多线程审计日志记录?
如果您需要一些背景信息:该应用程序是一个Web服务,它收到的每个请求消息都会导致创建100或200个审核日志消息,这些消息必须持久保存到数据库中.最初审计日志记录是使用扩展java.util.logging.Handler的自定义审计处理程序类完成的,而publish方法将打开数据库连接,从LogRecord填充预准备语句,然后执行插入.由于此自定义处理程序在EJB的线程内运行,因此审计日志记录可能会为每个请求消息的响应时间增加几秒钟,并导致错过SLA.
因此,审计处理程序被一个包装处理程序替换,该处理程序添加会创建一个单独的线程(是的,使用新的Thread(),而不是Java EE的规则).包装器处理程序使用Vector对审计记录进行排队,并使用审计处理程序在单独的线程中尽可能快地将它们保留.
虽然它破坏了Java EE线程的规则,但是这个包装器运行得很好...... 直到我们允许在MDB上进行并发调用. 当允许多个EJB调用时,包装器可能会搞砸,并且可能会将每个日志记录多次保存到数据库中.这似乎表明包装器或线程创建逻辑有一个bug.
我本来打算找出并解决这个问题,但我想我会先问问是否有更好的方法.
我想不使用内置的Websphere 7 jpa插件,而是使用应用程序WEB-INF/lib/open-jpa 2和专有的持久性提供程序.我无法为Websphere安装OSGI和JPA 2功能包.
最初,我只是尝试加载persistence.xml(版本="2"不支持)时收到sax解析错误.该错误是由open-jpa 1.2.3中的类抛出的.当我运行websphere/appserver/bin/wsjpaversion.bat时,会显示open-jpa 1.2.3 jar.默认情况下,它会覆盖应用程序中的open-jpa 2 jar.我创建了一个包含open-jpa 2 jar的共享库,并检查了这个配置选项:'为这个共享库使用一个独立的类加载器'.我将应用程序类加载器设置为最后加载父类,并为其分配新的共享库资源."版本2"错误消失了,但还有另一个问题.当我尝试初始化EntityManager时,我收到一个错误:
Caused by: javax.persistence.PersistenceException: Failed to load provider from META-INF/services
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:91)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
... 2 more
Caused by: java.lang.ClassCastException: com.ibm.websphere.persistence.PersistenceProviderImpl incompatible with javax.persistence.spi.PersistenceProvider
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:110)
... 11 more
Run Code Online (Sandbox Code Playgroud)
还有一个细节:在persistence.xml中,provider元素设置为专有的PersistenceProviderImpl而不是默认的Websphere持久性提供程序.那么这个websphere默认来自何处以及如何防止它?(另一个重要的注意事项:当我完全删除persistence.xml时,我得到了同样的错误)
谢谢
我正在使用Websphere 7.使用现有的WSDL,我使用wsimport ant任务(com.sun.tools.ws.ant.WsImport)创建了WS客户端.
有没有办法可以记录此客户端发送/接收的SOAP xml请求/响应?
我尝试使用 iiop 协议从容器外部查找 Websphere 应用服务器 7.0 上定义的资源,如下所示:
(RMI客户端)Test.jar的Java代码:
public static void main(String[] args){
Hashtable<Object, Object> properties = new Hashtable<Object, Object>();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put(Context.PROVIDER_URL, "iiop://localhost:2809");
InitialContext intCt;
try {
InitialContext initCtx = new InitialContext(properties);
Object obj = intCt.lookup(JNDI_NAME);
}catch (NamingException namingE) {
System.out.println("Naming Exception occurred :");
namingE.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
调用 Test.jar 的命令文件:
设置 appClassPath=C:\WebSphere\AppServer7.0\deploytool\itp\plugins\com.ibm.websphere.v7_7.0.1.v20090422_1423\wasJars\naming.jar;C:\WebSphere\AppServer7.0\deploytool\itp\plugins \com.ibm.websphere.v7_7.0.1.v20090422_1423\wasJars\namingclient.jar;C:\WebSphere\AppServer7.0\properties;C:\Batch\CommandFiles\JobServer\Test.jar C:\WebSphere\AppServer7.0\java\jre\bin\java -jar -cp "%appClassPath%" C:\Batch\CommandFiles\JobServer\Test.jar %Parameters%
注意:请注意,我在本地机器上运行客户端,引导主机是:localhost,端口是 2809。
在运行命令文件中的 Test.jar 代码时,我收到以下错误:
javax.naming.NoInitialContextException:无法使用散列表 {java.naming.provider.url=iiop://localhost:2809, java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory} 中指定的工厂创建 InitialContext [根异常是java.lang.NullPointerException] 在 javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:243) 在 javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:327) 在 javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:357) 在 javax.naming.InitialContext.internalInit(InitialContext.java:295) 在 …
假设我们有一个具有以下属性和操作的MBean.
属性:名称大小
操作:getName()getSize()
有没有办法以编程方式检查属性和操作?我一直在使用IBM WebSphere MBeans,他们的文档不是很好.
例如,如果您转到IBM Infocenter并导航到Network Deployment - > Reference - > Programming interfaces - > Mbean interfaces - > ThreadPool.它们只列出属性而没有操作.
使用WebSphere wsadmin工具,我实际上可以检查以查看操作和属性.我想知道是否有办法对所有MBean这样做.
wsadmin>print Help.attributes(object)
Attribute Type Access
name java.lang.String RO
maximumSize int RW
minimumSize int RW
inactivityTimeout long RW
growable boolean RW
stats javax.management.j2ee.statistics.Stats RO
wsadmin>print Help.operations(object)
Operation
java.lang.String getName()
int getMaximumPoolSize()
void setMaximumPoolSize(int)
int getMinimumPoolSize()
void setMinimumPoolSize(int)
long getKeepAliveTime()
void setKeepAliveTime(long)
boolean isGrowAsNeeded()
void setGrowAsNeeded(boolean)
javax.management.j2ee.statistics.Stats getStats()
Run Code Online (Sandbox Code Playgroud) 有人有适用于 WebSphere 的 Spring Security 示例 PreAuthentication Filter (WebSpherePreAuthenticatedProcessingFilter) 吗?关于它的文档很少,我似乎无法确定它。我正在寻找能够正常工作并且可能愿意提供您的配置示例的人。非常适合 Spring 3.1 和 WAS 7 或 8。
我有一个配置,看起来它“有点”工作。我可以使用 WebSphere 进行身份验证,然后在我的应用程序中点击 URL,但浏览器返回以下消息:
错误 500:java.lang.RuntimeException:查找用户组时发生异常
我得到如下异常堆栈跟踪:
java.lang.RuntimeException: Error while invoking method java.lang.reflect.Method.getGroupsForUser([UNAUTHENTICATED])
at org.springframework.security.web.authentication.preauth.websphere.DefaultWASUsernameAndGroupsExtractor.invokeMethod(DefaultWASUsernameAndGroupsExtractor.java:147) [spring-security-web-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.security.web.authentication.preauth.websphere.DefaultWASUsernameAndGroupsExtractor.getWebSphereGroups(DefaultWASUsernameAndGroupsExtractor.java:115) [spring-security-web-3.1.3.RELEASE.jar:3.1.3.RELEASE]
at org.springframework.security.web.authentication.preauth.websphere.DefaultWASUsernameAndGroupsExtractor.getWebSphereGroups(
...
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) ~[na:1.6.0]
...
Caused by: com.ibm.websphere.security.EntryNotFoundException: null
at com.ibm.ws.wim.registry.util.MembershipBridge.getGroupsForUser(MembershipBridge.java:293) ~[com.ibm.ws.runtime.wim.core.jar:201207200704]
...
[12/28/12 14:05:15:879 CST] 00000055 LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
[12/28/12 14:05:15:879 CST] 00000055 webapp E …
Run Code Online (Sandbox Code Playgroud) websphere spring-security websphere-7 pre-authentication websphere-8
请原谅我的英语
我有一个使用jax-ws和spring 的应用程序,它在 tomcat 上运行良好,但我应该将其部署在Websphere 7上。
WAS7 抛出以下异常:
00000027 WSModuleDecr E WSWS7027E:由于以下错误,无法正确构建 JAX-WS 服务描述:javax.xml.ws.WebServiceException:WSWS7054E:无法为 com.foo 生成 Web 服务描述语言 (WSDL) 文件。 MyEndpoint Web 服务实现类,因为出现以下错误:java.lang.Exception:无法为实现类生成 WSDL 定义:com.foo.MyEndpoint at com.ibm.ws.websvcs.wsdl.WASWSDLGenerator.generateWsdl(WASWSDLGenerator .java:230)
我的端点类是:
@WebService(endpointInterface = "com.foo.MyService", targetNamespace = "http://www.foo.com/xsd")
public class MyEndpoint implements MyService
{
...
}
Run Code Online (Sandbox Code Playgroud)
接口是:
@WebService(portName = "MyPort", serviceName = "MyService",
targetNamespace = "http://www.foo.com/xsd")
public interface MyService
{
...
}
Run Code Online (Sandbox Code Playgroud)
知道什么会导致这个问题吗?如何检查,这里到底出了什么问题?错误信息太模糊了...
我正在尝试从url https://someurl.com使用RESTful服务.我在代码中添加了以下属性:
Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
Security.setProperty("ssl.ServerSocketFactory.provider", "com.ibm.jsse2.SSLServerSocketFactoryImpl");
Security.setProperty("javax.net.ssl.trustStore", "cacerts.jks");
Security.setProperty("javax.net.ssl.keyStore", "keystore.jks");
Security.setProperty("javax.net.ssl.keyStoreType", "pkcs12");
Security.setProperty("javax.net.ssl.trustStoreType", "JKS");
Run Code Online (Sandbox Code Playgroud)
到目前为止我所做的配置更改是:
com.ibm.websphere.ssl.retrieveLeafCert
为true
但我得到以下异常:
java.security.cert.CertPathValidatorException: Certificate chaining error
javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
java.security.cert.CertPathValidatorException: The certificate issued by CN=Walmart Root CA, O=Wal-Mart Stores Inc is not trusted; internal cause is:
java.security.cert.CertPathValidatorException: Certificate chaining error
at com.ibm.jsse2.o.a(o.java:22)
at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:423)
at com.ibm.jsse2.kb.a(kb.java:192)
at com.ibm.jsse2.kb.a(kb.java:176)
at com.ibm.jsse2.lb.a(lb.java:53)
at com.ibm.jsse2.lb.a(lb.java:464)
at com.ibm.jsse2.kb.s(kb.java:545) …
Run Code Online (Sandbox Code Playgroud) 我已经使用 spring boot 创建了 Web 应用程序(Spring MVC)并通过内置服务器 apache tomcat(maven tomcat 插件)执行它。它工作正常。所以我的问题是如何将此 WAR 部署到 WAS 7.0 应用程序服务器中。
websphere-7 ×10
java ×4
websphere ×2
deployment ×1
java-ee ×1
jax-ws ×1
jmx ×1
jndi ×1
logging ×1
maven ×1
mbeans ×1
openjpa ×1
persistence ×1
soap ×1
spring-boot ×1
spring-mvc ×1
web-services ×1
websphere-8 ×1
wsdl ×1