我已经部署了一个带有本地和远程接口的EJB,我可以在部署后查找本地的一个,但是我无法从Java SE客户端使用远程.
EJB代码很简单:
@Local(DemoFacade.class)
@Remote(DemoFacadeRemote.class)
@Stateless
public class DemoFacadeBean implements DemoFacade
<snip>
Run Code Online (Sandbox Code Playgroud)
查找代码也很简单:
Properties env1 = new Properties();
env1.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
env1.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2809");
Context initialContext;
initialContext = new InitialContext(env1);
Object ejbHome = initialContext.lookup("cell/nodes/OVLM46008QPZKQ1Node01/servers/server1/ejb/DemoFacadeRemote");
Run Code Online (Sandbox Code Playgroud)
我也尝试了jndi查找的许多变体,但都失败了同样的错误.
Object ejbHome = initialContext.lookup("cell/nodes/OVLM46008QPZKQ1Node01/servers/server1/java:global/WebSphereDemo/WebSphereDemoEJB/DemoFacadeBean!com.test.DemoFacadeRemote");
Run Code Online (Sandbox Code Playgroud)
我添加了以下参数来帮助调试:
-Dcom.ibm.CORBA.Debug=true -Dcom.ibm.CORBA.CommTrace=true -Dcom.ibm.CORBA.Debug.Output=c:/temp/client.log -Dcom.ibm.ejs.ras.lite.traceSpecification=*=all -Djava.endorsed.dirs=C:/data/workspace/WebSphereDemoEJBTest/lib/websphereclient/eee
Run Code Online (Sandbox Code Playgroud)
类路径设置为websphere/lib文件夹的所有jar.
完整的控制台输出是(抱歉输出的长度,其中一些是省略的).真正的错误在最后.谢谢你的任何建议.
************ Start Display Current Environment ************
<snip>
[26/07/2011 15:49:32:122 EST] 00000000 com.ibm.ws.naming.ipbase.NameSpace > lookUpRootContext Entry
bindingName=IIOP_DEFAULT_ROOT
rootBindingData=com.ibm.ws.naming.ipbase.BindingsTableData@fffd6386
[26/07/2011 15:49:32:123 EST] 00000000 com.ibm.ws.naming.ipbase.NameSpace < lookUpRootContext Exit
javax.naming.NameNotFoundException: Root context not found.
[26/07/2011 15:49:32:123 EST] 00000000 com.ibm.ws.naming.jcache.Cache …Run Code Online (Sandbox Code Playgroud) 我正在编写调度程序或排序.它基本上是一个包含exes列表的表(如"C:\ a.exe")和一个控制台应用程序,它每分钟左右查看表中的记录并运行尚未运行的任务.
我运行这样的任务:
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = someExe; // like "a.exe"
p.Start();
Run Code Online (Sandbox Code Playgroud)
如何判断特定任务是否失败?例如,如果a.exe抛出未处理的异常怎么办?我想让上面的代码知道这种情况何时发生,并用"特定任务失败"等内容更新任务表.
我怎样才能做到这一点?
我没有使用Sql Agent或Windows Scheduler,因为其他人告诉我不要.他有更多的"经验"所以我基本上只是遵循命令.随意提出替代方案.
MyObject myObject = repositoryHibernateImpl.getMyObjectFromDatabase();
//transaction is finished, and no, there is not an option to reopen it
ThirdPartyUtility.doStuffWithMyObjectType( myObject );
Run Code Online (Sandbox Code Playgroud)
此时你已经定义了什么是懒惰和急切加载,第三方实用程序将尝试调用你的"myObject"实例上的所有方法,这很好,因为你不想为懒惰返回任何东西加载属性,不幸的是它不返回null,它抛出一个LazyInitializationException.
发生这种情况是因为您实际上是在Hibernate的对象代理上调用该方法,并且它知道它没有获取该数据,并抛出异常.
甚至可以使用null值获取底层对象,以便getter只返回null,并且不会抛出异常?基本上分离对象,以便Hibernate完全不再了解它.延迟加载的对象的访问器必须返回null,它不能返回实际值,我们希望能够将实体转换为POJO,而不必创建看起来像实体的对象,并且必须重新映射所有值.
当渲染视图时,我遇到了(in)着名的hibernate和延迟加载问题......正如许多人所说,只有两个解决方案是:
后者是优选的IMO.无论如何我不确定这个拦截器是否正在触发(事实上我得到了相同的延迟加载异常并且没有任何变化):
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: it.jsoftware.jacciseweb.beans.Listino.prodotti, no session or session was closed
Run Code Online (Sandbox Code Playgroud)
我正在使用简单的基于注释的url映射,所以阅读Spring 3的文档,我在servlet-context.xml中使用它:
<bean id="handlerMapping"
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<!-- <property name="order" value="2" /> -->
<property name="interceptors">
<list>
<ref bean="openSessionInViewInterceptorInst" />
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
哪个应该成功.但它没有用,我得到了例外.我如何确保我的拦截器正在射击?我该如何解决这个问题?
对于我们的应用程序的配置,我们希望将一些配置放在应用程序服务器中.
我们目前正在使用WebSphere JNDI工具来查找URL和数据源.
另外,我们希望在应用程序服务器中放置简单的字符串.我们不想使用WebSphere"Enviroment变量".
"资源环境"可以用于此目的吗?如果是这样,它怎么用?
我们想要获得字符串:
InitialContext ctx = new InitalContext();
String myString = (String)ctx.lookup("jndi/string/myString");
Run Code Online (Sandbox Code Playgroud)
有没有更简单的替代品?
我们正在使用WebSphere Application Server 7.
我们axis在项目中使用webservices.
到目前为止,我们已经在内部生成了Web服务客户端Eclipse.我们选择New -> Other -> Web Services -> Web Service Client.之后我们选择了wsdl,更改了开发客户端的步骤并选择了轴web服务运行时.
除了元素Eclipse生成5个存根/代理类.
作为最佳实践,我们现在尝试使用轴编写代理生成脚本wsdl2java.
我们正在使用:
wsdl2java.bat -uri ..\MyService.wsdl -S . -s
Run Code Online (Sandbox Code Playgroud)
这会产生:
的MyServiceProxy缺失.不幸的是,我们编码了这个代理,它基本上是围绕其他4个clases的包装器.没有代理类,我必须交换使用此代理的遗留代码.
如何生成此缺少的代理类.我检查了wsdl2java文档但是我无法弄清楚我需要设置什么选项.我想知道代理是否不是轴生成和自定义类的一部分Eclipse.
编辑:我刚刚注意到一个列出代理的不同帖子.可能它不是RAD特定的,它可能是Eclipse功能.
我正在编写一个Visual Studio扩展,我正在创建需要在用户调整代码视图大小时调整大小的行装饰.即当用户调整Visual Studio的窗口宽度时,我会修改装饰的宽度和高度.我正在处理这个IWpfTextView.LayoutChanged事件,我正在调整我的装饰.为了避免装饰品与下面的线条重叠,我还实施了ILineTransformSource.GetLineTransform来扩大线条的高度以适应装饰的大小.
但是,当我更改装饰的尺寸时(处理IWpfTextView.LayoutChanged事件时)我没有调用我的ILineTransformSource.GetLineTransform函数来调整行变换的大小.这使得装饰物与其下方的线重叠.我似乎无法找到任何强制呼叫的方法ILineTransformSource.GetLineTransform.(虽然,如果用户滚动视图,我会接到这些调用.但是,我不想强迫用户滚动窗口来修复视觉故障.)
有没有人知道强制Visual Studio调用我的方法,ILineTransformSource.GetLineTransform这样当我的装饰物改变高度时我可以调整线条变换的大小?
我想编写一个spring命令行程序,该程序使用属性文件进行初始化,该属性文件作为命令行参数传递.怎么办?
上课:
public static void main (String [] args) {
String configFilename = args[0];
ApplicationContext ctx = new ClassPathXmlApplicationContext(
"classpath:/context/applicationContext.xml");
MyBean bean = ctx.getBean(MyBean.class);
bean.getStarted();
}
Run Code Online (Sandbox Code Playgroud)
applicationContext.xml中:
<context:property-placeholder location="CONFIGFILENAME" ignore-unresolvable="true"/>
Run Code Online (Sandbox Code Playgroud)
如何从我的main方法获取配置文件名到实际的spring上下文,以便我可以加载正确的依赖于环境的属性?
跟进此问题: 筛选 CloudWatch Logs 以提取实例 ID
我认为这使得问题不完整,因为它没有说明如何使用 python 访问事件对象。
我的目标是:
Cloudwatch触发事件是:
{
"source": [
"aws.ec2"
],
"detail-type": [
"EC2 Instance State-change Notification"
],
"detail": {
"state": [
"running"
]
}
}
Run Code Online (Sandbox Code Playgroud)
我可以看到这样的例子:
def lambda_handler(event, context):
# here I want to get the instance tag value
# and set the tag filter based on the instance that
# triggered the event
filters = [{
'Name': 'tag:StartGroup',
'Values': ['startgroup1']
},
{
'Name': 'instance-state-name',
'Values': ['running']
}
]
instances = …Run Code Online (Sandbox Code Playgroud) 我有一个 Java / Maven 项目,我在家里用 Windows 构建并正确执行了 checkstyle。它使用内置规则集,但我也尝试了外部文件。
查看相同的代码 / pom.xml 它似乎不适用于 macOS。奇怪的是,如果我使用sun_checks.xml它工作正常。使用 8.8 没有什么区别。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.7</version>
</dependency>
</dependencies>
<configuration>
<encoding>UTF-8</encoding>
<configLocation>google_checks.xml</configLocation>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
如果我这样运行它,它会在不做任何检查的情况下完成:
mvn checkstyle:check -X
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T18:58:13+11:00)
Maven home: /gdev/apache-maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre
Default locale: en_AU, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
[..]
[DEBUG] The resource 'google_checks.xml' was found as jar:file:/Users/udoheld/.m2/repository/com/puppycrawl/tools/checkstyle/8.7/checkstyle-8.7.jar!/google_checks.xml. …Run Code Online (Sandbox Code Playgroud) java ×5
c# ×2
hibernate ×2
lazy-loading ×2
spring ×2
websphere ×2
aws-lambda ×1
axis ×1
checkstyle ×1
eclipse ×1
ejb ×1
eventtrigger ×1
jndi ×1
macos ×1
maven ×1
python ×1
sql ×1
vsx ×1
websphere-7 ×1
websphere-8 ×1
wsdl2java ×1